Wednesday, July 21, 2010

Ubuntu Kung-Fu – 10 Best Tricks (and some even work on Macs)

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:
sudo apt-get install trash

Read more: canoo

Posted via email from .NET Info