How to: Erase Hard Drives at Linux Command Line

How to: Erase Hard Drives at Linux Command Line

The simplest way is the dd command. Simply type:
dd if=/dev/zero of=/dev/

This process takes a while but it will write zeros to the whole hard drive. The DD command can also be used to write zeros to just one partition, and should work on just about any Unix or Unix like system. But this may not be the end all and you’ll want a bit more security. Luckily several utilities exist for just such an occasion.

Wipe is one of the better ones I’ve seen. It claims to use the Gutmann method as one of it’s processes.

Another method is one of the simplest and makes reading man pages profitable. The good old rm command with -P does a three time wipe on each file, by (according to the man page) writing “first with the byte pattern 0xff, then 0x00, and then 0xff again.

Secure rm or “srm” is a fancy remove program that overwrites the files it deletes much like rm -P command. By default it overwrites, renames, then truncates the file(s) before unlinking and removing them. Two flags can be specified for the really paranoid, -m does “overwrite the file with 7 US DoD compliant passes (0xF6, 0x00, 0xFF, random, 0x00, 0xFF, random)” and -z which zeros the files after overwriting. So srm -rf -m -z /dev/<drive name>/ would do a pretty good job of killing everything on the hard drive.

Another trick I picked up from the FreeBSD mailing list is: split -b 200m /dev/random randomdata ; sync && rm randomdata* This uses part of my preferred method of splitting the hard drive into multiple partitions then writing random data over each piece. If can be ran as many times as needed and by changing the -b flag’s size could make most data very unreadable.

And last but not least, Techrepublic has a post about using Shred to delete files and filesystems.

How To: Disable Dashboard in OS X

How To: Disable Dashboard in OS X

Dashboard in Leopard is a love it or hate it application. There are several useful applications that can make life easier. On the other hand, it’s easy to hit the activation buttons on Mighty Mouse by accident. Other people may begrudge Dashboard’s use of memory. It’s not much, but on low end machines every bit counts.

This is how to disable Dashboard:

Open Terminal (as an admin user)

type: defaults write mcx-disabled -boolean YES

Hit Enter

type: killall Finder

When Finder restarts, Dashboard should be gone. To turn it back on follow the same instructions, but replace YES with NO.

The first command is the powerful one. There are a lot of default behaviors that can be changed in OS X if the write command is known.

The second command, killall Finder simply does the same as force quitting Finder from the GUI. It forces the Finder to quit, relaunch and reload everything, including the Dock. In this case it does not relaunch Dashboard though.

Please let me know if you find this helpful. Also suggestions for other terminal commands would be appreciated.

How To: Check OS X Disk Usage

How To: Check OS X Disk Usage

In OS X there are two ways to do everything. Via the GUI, or Via the command line. Frequently the GUI method does fine for most uses. But sometimes a bit more information is needed.

In the GUI, getting Disc Usage is simple. Open Finder, click on the drive and look at the bottom of the finder window. The number of files selected and the space available is displayed. But, this only shows the current directory and includes ALL sub folders under it.

But with a little use of the command line we can get a lot more information. Opening terminal defaults to the active user’s home directory.

At this point type du -sh * We’re adding the s for “Display an entry for each specified file,” and h for “Human-readable” output.

This will give a readout like this:
28G Desktop
41G Documents
13G Downloads
3.9G Library
0B Movies
5.1G Music
42G Pictures
121M Public
374M Sites

As can be seen this then gives a readout of each directory in the current one and provides the total space it takes up. In cases of low hard drive space this gives a good way to quickly find folders that may be too big. It could also be run in the /Users folder on multi-user machines to find out who it using all the hard drive space.