All commands (14,187)

What's this?

commandlinefu.com is the place to record those command-line gems that you return to again and again. That way others can gain from your CLI wisdom and you from theirs too. All commands can be commented on, discussed and voted up or down.

Share Your Commands


Check These Out

Remove all backup files in my home directory
I use this simple command for remove all backup files generated usually by editors like Vim and Emacs.

Monitor memory fine-grained usage (e.g. firefox)
Sometimes top/htop don't give the fine-grained detail on memory usage you might need. Sum up the exact memory types you want

one-liner mpc track changer using dmenu
Add a [fluxbox] binding in your key file then this command provides a dmenu selector for the next track to play

To print a specific line from a file
Just one character longer than the sed version ('FNR==5' versus -n 5p). On my system, without using "exit" or "q", the awk version is over four times faster on a ~900K file using the following timing comparison: $ testfile="testfile"; for cmd in "awk 'FNR==20'" "sed -n '20p'"; do echo; echo $cmd; eval "$cmd $testfile"; for i in {1..3}; do time for j in {1..100}; do eval "$cmd $testfile" >/dev/null; done; done; done Adding "exit" or "q" made the difference between awk and sed negligible and produced a four-fold improvement over the awk timing without the "exit". For long files, an exit can speed things up: $ awk 'FNR==5{print;exit}'

Retrieve the size of a file on a server
- Where $URL is the URL of the file. - Replace the $2 by $3 at the end to get a human-readable size. Credits to svanberg @ ArchLinux forums for original idea. Edit: Replaced command with better version by FRUiT. (removed unnecessary grep)

recursively walk down no more than three levels and grab any file with an extension of mp3, mpg, mpeg, or avi

Watch the progress of 'dd'
run this in another terminal, were xxxx is the process ID of the running dd process. the progress will report on the original terminal that you ran dd on

Insert the last argument of the previous command
for example if you did a: $ ls -la /bin/ls then $ ls !$ is equivalent to doing a $ ls /bin/ls

Verify if ntpd is working properly
Used to verify if Network Time Protocol daemon is working properly.

Search some text from all files inside a directory


Stay in the loop…

Follow the Tweets.

Every new command is wrapped in a tweet and posted to Twitter. Following the stream is a great way of staying abreast of the latest commands. For the more discerning, there are Twitter accounts for commands that get a minimum of 3 and 10 votes - that way only the great commands get tweeted.

» http://twitter.com/commandlinefu
» http://twitter.com/commandlinefu3
» http://twitter.com/commandlinefu10

Subscribe to the feeds.

Use your favourite RSS aggregator to stay in touch with the latest commands. There are feeds mirroring the 3 Twitter streams as well as for virtually every other subset (users, tags, functions,…):

Subscribe to the feed for: