Are you command-line savvy?
The command line. That small place, where a lot can happen. And more so if you are a Linux user... How to maximize it? Where to harness its power?I discovered commandlinefu.com a few years ago, while looking for a way to do... something. I don't even enter that often, although it is a brilliant place to discover how to do X in Linux/UNIX.
Among its all time greats I found some gems, and some others I discovered elsewhere, or even I made up.
Command line gems (and rocks?)
Run the last command as root: sudo !! as inapt-get install somethingThe double exclamation mark recovers the last command in the history.
-> error, you have to be root
sudo !!
mkdir /path/to/somewhereChange to the previous directory: cd - as in (after the previous example to get back to where you started)
cd !$
cd -Backward history incremental search: C-r in the terminal prompt, start writing the command you want to backward-search. Press C-r to keep on searching for that term.
Correct typo in previous command: ^typo^corrected as in
sudo apt-get isntall somepackage
^isnt^inst
The same with find: evince "$(find -name 'NameOfPdf.pdf')"
Get Pid of a process by name: ps ax | grep "firefox"
I think I have a few more, but I just don't remember them.
What are your special command line tricks? Are you a command-line jedi or more like a command line young one?
You may be also interested in:














