Ubuntu Kung-Fu – 10 Best Tricks (and some even work on Macs)
By my count, Ubuntu Kung-Fu from Pragmatic Bookshelf is the perfect summer reading book. It’s light, the content is not going to strain your mind the way some computer science tomes will; it’s easy to read, as always with Prag books the writing is conversational and the fonts large; and it’s fun, where else can you read about easter eggs like talking cows and floating desktop fish.
Admittedly, some of the 315 tips are useless. I’m not sure when I’ll ever use the “cowsay” command to invoke a talking ascii cow, but for some reason I’m glad I know about it. I predict the error output in my Bash scripts is about to get a lot more bovine. Most of the tips are good, though. Of the 315 total tips (less than a page long each), there are maybe 25 dual boot and Windows related tips and maybe 25 more system recovery and troubleshooting tips. It isn’t a comprehensive reference to administration or dual booting, but these tips are still good to keep around in case of emergencies. Someone switching from Windows and still dual booting will find this book extremely helpful. There are also quite a few Gnome desktop tips for how to tune the desktop manager; for instance, how to use drapes to change the wallpaper every morning. But the majority of the book details cool and useful programs and packages to install… stuff I didn’t realize I needed until I found out about it. Normally I prefer printed books, but the best way to read Ubuntu Kung-Fu is by viewing the PDF directly on the computer and having a command prompt open to try the tips as you go.
If your vision of a great vacation is laying down with a laptop on your belly, banging away on new bash commands and scripts, then this is the book for you.
Now here are my favorite 10 tips.
1. Command History Search with Ctrl+R – In a terminal, the up and down arrow shuffles through recent commands on almost any operating system. I had been using grep to search my history (history | grep something) until I found out about Ctrl+R. When you type Ctrl+R, the terminal goes into a matching mode where it tries to guess the entry from your history based on what you type. So type the first few letters of a recent command and the entire thing comes up. This is great, and I use it regularly to expand out “git pu” into a full “git pull origin master”. But don’t get the wrong idea! I still think git is awful.
2. Running jobs with & and nohup – I discovered & long ago. If you run a program from the command line then the terminal is frozen until the program completes. But if you append & (for instance, “gedit &”) then it launches as a job and you can use the terminal again while your program runs simultaneously. The problem is if you close the terminal then your other program closes as well. Instead use nohup (“nohup gedit”) so that your program does not hang up when the terminal closes.
3. Use Trash for Command Line File Deletes – There are a bunch of safe alternatives to deleting files using “rm -rf”, and this type lists yet another one. However, I prefer to use the “trash” package. Just run:
|
1 |
sudo apt-get install trash-cli |
4. gconf-edit – Desktop programs usually have a preferences panel, but not all preferences or settings are available there. The “gconf-edit” program in Gnome looks a little like a Registry Editor and is where all Free Desktop programs must store their configuration settings. Even if it is not in the preferences window you can still access it through gconf-edit. Take a look at what is available for Nautilus and gedit. It should be quite easy to expand your gedit recent files list to be 10 entries long, for example.
5. Command Line Image Manipulation - There are a whole bunch of command line and batch image tricks you can perform with “imagemagick”. Shrink and enlarge in batch using “convert -resize 50% filename.bmp”, convert formats using “convert -quality 80 filename.bmp filename.jpg”, and sharpen images using “convert -sharpen 0×1 filename.bmp”. Of course, for ascii aficionados like me, there is no beating asciiview. Install these:
|
1 2 |
sudo apt-get install imagemagick sudo apt-get install asciiview |
6. Fonts Galore – I agree, Ubuntu fonts just look better, but the author is a little obsessive including 5 different font tips. You can “Make Fonts look superb” by turning on autohinting using a somewhat lengthy process. Or you can just install a whole slew of fonts such as the 465 fonts in ttf-aenigma, the Microsoft imitation fonts in ttf-liberation, or the Comic Sans style fonts in the ttf-fifthhorseman-dkg-handwriting, ttf-sjfonts, and ttf-breip packages. There’s even directions on stealing the Mac or Windows fonts by mounting the alternative OS, copying all the .ttf files locally, and then installing them into Ubuntu. This is probably the only tip that is not 100% legal. Install these:
|
1 2 3 4 5 |
sudo apt-get install ttf-aenigma sudo apt-get install ttf-liberation sudo apt-get install ttf-fifthhorseman-dkg-handwriting sudo apt-get install ttf-sjfonts sudo apt-get install ttf-breip |
7. Command Line Web Browser – I don’t know why but I get a real kick out of the “links” command line web browser. I enjoy the absurdities in life and browsing a text online web from the console seems like one of them. Install it with:
|
1 |
sudo apt-get install links |
8. Install all the multimedia codecs you’ll ever need – My family’s favorite baby sitter is the DVD player. When a parent needs a break, there is no joy like popping in a princess or dinosaur movie and seeing a child fall quickly into an animation induced stupor. Peace and quiet at last! Except when the DVD doesn’t play because of missing codecs. Curse you copyright laws! Best to be prepared and just install all of these through Synaptic now:
GStreamer extra plugins
GStreamer ffmpeg video plugin
Ubuntu restricted extras
GStreamer plugins for mms, wavpack, quicktime, musepack
GStreamer plugins for aac, xvid, mpeg2, faad
GStreamer fluendo MPEG2 demuxing plugi
Finally, be sure to run the DVD playback enabler script: sudo /usr/share/doc/libdvdread3/install-css.sh
9. See a Quote of the Day Whenever You Log In – I love quotes, so seeing a new one at the top of all my Terminal windows is a real bonus. Just install signify, create a ~/.signify file, and then edit your ~/.bashrc so that the last line reads “signify”. The format for the .signify file is % { quote % | quote % | quote % }. Yes, you read correctly, that is a “% |” delimited list with a “% {” start identifier and a “% }” end identifier, which makes the .signify file qualify as the most ridiculous text file data format I have ever seen. Oh well, just install:
|
1 |
sudo apt-get signify |
10. Play Old MS-DOS Games. Hell yes, Bard’s Tale is about to be run! First install “dosbox” and create an empty directory on your disk called “dosbox_c”. Then, using the DOSBox user interface, mount your empty directory by typing “mount C dosbox_c” and then switch to it by typing “C:”. You are now at the DOS prompt. Browse on over to your favorite abandon ware site and start downloading the classics. I suggest raiding http://www.abandonia.com. Install with:
|
1 |
sudo apt-get install dosbox |
So that is my best 10. All I have left to say is:
|
1 2 3 4 5 6 7 8 |
____________________________ < I want a Bash Kung-Fu book > ---------------------------- ^__^ (oo)_______ (__) )/ ||----w | || || |













Derek said,
July 22, 2010 @ 7:56
The trash command install is:
sudo apt-get install trash-cli
ErMejo said,
July 22, 2010 @ 7:57
Hmm, suggestion 3 should be:
sudo apt-get install trash-cli
Jim said,
July 22, 2010 @ 7:58
I used to use a unix script that moved files to /tmp/datestamp. I was glad to see someone hooked into the destop trash api. This is much, much better.
One minor correction, though:
sudo apt-get install trash-cli
Skomli said,
July 22, 2010 @ 8:00
Ok, the blog don’t like double quotes in comments.
The package is called trash-cli
Hamlet said,
July 22, 2010 @ 8:04
D’oh… it is trash-cli and not just trash. I fixed it.
gary thompson said,
July 22, 2010 @ 8:17
tip 1 requires a bash shell there doesn’t appear to be a similar command in tcsh (! followed by a tab will find the first old command that starts with eg !l tab would find ls in the command list)
cheers
gary
Deepak said,
July 22, 2010 @ 11:52
Suggestion for number 7:
There’s already a command line browser preinstalled in Ubuntu and its called w3m.
Jeff Dege said,
August 3, 2010 @ 23:51
Hamlet, in re. “Command Line Image Manipulation”:
Have you ever looked at the Portable Bitmap toolkit?
http://netpbm.sourceforge.net/doc/
$ sudo apt-get install netpbm