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

Install pip with Proxy
Installs pip packages defining a proxy

Delicious search with human readable output
You can install filterous with $ sudo apt-get install libxslt1-dev; sudo easy_install -U filterous

Listen to BBC Radio from the command line.
This command lets you select from 10 different BBC stations. When one is chosen, it streams it with mplayer. Requires: mplayer with wma support.

Add the time to BASH prompt
Adds the time in 12hr AM/PM format to the beginning of a prompt. Change \@ to \t for 24-hour time or \T for 12hr without AM/PM. To keep the time the next time you open a terminal, edit ~/.bashrc and stick the command at the bottom.

Search commandlinefu from the command line
There's probably a more efficient way to do this rather than the relatively long perl program, but perl is my hammer, so text processing looks like a nail. This is of course a lot to type all at once. You can make it better by putting this somewhere: $ clf () { (curl -d "q=$@" http://www.commandlinefu.com/search/autocomplete 2>/dev/null) | egrep 'autocomplete|votes|destination' | perl -pi -e 's/$/\n\n/g;s/^ +|\([0-9]+ votes,//g;s/^\//http:\/\/commandlinefu.com\//g'; } Then, to look up any command, you can do this: $ clf diff This is similar to http://www.colivre.coop.br/Aurium/CLFUSearch except that it's just one line, so more in the spirit of CLF, in my opinion.

cleanup /tmp directory
Cleans all files in /tmp that have been accessed at least 2 days ago.

GRUB2: Set Imperial Death March as startup tune
Kudos to http://www.commandlinefu.com/commands/view/8275/grub2-set-super-mario-as-startup-tune

View network activity of any application or user in realtime
The "-r 2" option puts lsof in repeat mode, with updates every 2 seconds. (Ctrl -c quits) The "-p" option is used to specify the application PID you want to monitor. The "-u' option can be used to keep an eye on a users network activity. "lsof -r 2 -u username -i -a"

Pick a random line from a file

Extract the MBR ID of a device
Useful when you want to know the mbrid of a device - for the purpose of making it bootable. Certain hybridiso distros, for eg the OpenSUSE live ISO uses the mbrid to find the live media. Use this command to find out the mbrid of your USB drive and then edit the /grub/mbrid file to match it.


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: