Quickly create graphical text banners

Tip 219, on page 254, discusses using the figlet command-line tool to create ASCII banners of words but if you want to quickly create text banners as a image file, perhaps for use on websites or presentations, you can use GNOME's font preview tool. It isn't really designed for this but appropriation of existing commands is the beauty of Linux!

You need to specify the text, plus which font to use (including its full path), and the output filename. The following will create a banner saying 'Ubuntu Kung Fu' using the Arial font contained within my Windows partition, outputting a file called banner.png:

$ gnome-thumbnail-font --text 'Ubuntu Kung Fu' '/media/disk/WINDOWS/ Fonts/ARIAL.TTF' banner.png

Obviously, you should ensure your Windows partition is mounted (select its entry on the Places menu) before running any command using fonts contained in its file system.

There are a handful of situations where securely erasing data can be useful. If you're about to sell-on a computer, or even if you're about to dispose of it, it makes sense to completely wipe the hard disk.

Simply deleting the files isn't good enough because they can still be recovered using specialized software. Instead you must overwrite the entire disk with junk data.

In addition to wiping entire storage devices, you occasionally might want to wipe a file on your existing hard disk that contains personal data so that it can't be recovered, either deliberately or accidentally.

Ubuntu's shred can help in both situations. It simply overwrites a file (or hard disk/removable storage) over and over again with random data, so that the original data isn't recoverable (even by extremely specialized data recovery agencies, or so it's claimed by shred's creators).

Wiping storage devices

Let's say you want to securely erase the data on a USB key stick, so that it can't be recovered. You would follow these steps:

1. First you must find how Ubuntu refers to the USB stick on a technical level. To do so, insert it so that its icon appears on the desktop and then make a note of its name. Then open a terminal window and type mount and look for the line in the output what refers to the USB keystick. For example, on my test PC, the keystick's label (name) was KINGSTON, so I picked out the following line (this line has been truncated for brevity):

/dev/sdb1 on /media/KINGSTON type vfat (rw,nosuid,nodev, ...

I then made a note of /dev/sdb (note that the number at the end should be dropped; it refers to the partition on the USB key stick, and we intend to wipe the entire thing, regardless of partitions).

It's very important you get this step right because there's no going back if you make a mistake! shred is irreversible.

2. After this, unmount the USB key stick by right-clicking it and selecting Unmount Volume.

3. Then, at the command-prompt, type the following:

Securely erase data M 163

It's VITAL that you replace /dev/sdb with what you discovered earlier! This is one situation where typos can be disastrous.

Following this, shred will wipe the key stick. It will probably take a long time to complete, but you'll see a progress report on-screen every few seconds.

By default shread overwrites the data 25 times, but you can speed up the process by using the -n command option, which tells shred how many times to overwrite. Unless you're expecting the CIA to come and visit, a value of -n1 should be good enough for most of us (the full command then becoming sudo shred -v -n1 /dev/sdb).

When the USB key stick has been erased, you'll need to reformat it, because the format component of the disk was part of that securely erased. This can be done by following the steps in Tip 44, on page 104.

Essentially the same method as described above can be used to wipe a hard disk but this time you must use Ubuntu's live distro mode on the install CD, so that the hard disk isn't mounted. Boot from your Ubuntu install CD on the computer whose disk you want to erase and select to Try Ubuntu from the boot menu. When the desktop appears, open a terminal window and type the following (this assumes the computer has one hard disk fitted; note that you should remove any type of removable storage device before issuing this command, such as USB key sticks):

Any hard disk containing any operating system (including Windows) can be wiped in this way. To wipe a floppy disk, replace /dev/sda with /dev/fd0.

Wiping files

Wiping files rather than entire disks is simply a matter of specifying the file, this time adding the -u command option.18 For example, let's say you wanted to destroy partypicture.jpg beyond recovery:

18. If you read the shred manual, you'll see a warning that when completely shredding files on journaled file systems—such as the ext3 system used by Ubuntu—some trace of the file might be left behind. However, this is only an issue for ext3 file systems that use the data=journal mode. Ubuntu uses the data=ordered mode, which allows shred to completely destroy files.

$ shred -v -n1 -u partypicture.jpg

Note that there is no need in this case to precede the command with sudo because the file belongs to you.

If you're a fan of this arcane text editor, you might be interested in the "hidden" games that help you take a break every now again. Start emacs and then hit (Esc) and type Q. Then type any from the following list: tetris, pong, snake, solitaire, gomoku, doctor (an Eliza clone).

If you find video playback is distorted or jumpy, open a terminal window and type gstreamer-properties. In the program window that appears, select the Video tab and, in the Plugin dropdown list beneath Default Output, select X Window System (No Xv).

If you run into problems with Totem video playback, you might be interested in installing an alternative media player: see Tip 231, on page 272.

Computer Hard Drive Data Recovery

Computer Hard Drive Data Recovery

Learn How To Recover Your Hard Drive Data After A Computer Failure.

Get My Free Ebook

Post a comment