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

April Fools' Day Prank
Add this to a fiend's .bashrc. PROMPT_COMMAND will run just before a prompt is drawn. RANDOM will be between 0 and 32768; in this case, it'll run about 1/10th of the time. \033 is the escape character. I'll call it \e for short. \e7 -- save cursor position. \e[%d;%dH -- move cursor to absolute position \e[4%dm \e[m -- draw a random color at that point \e8 -- restore position.

Force an fsck on reboot
Force an fsck on reboot. Useful on a system where / has mounted read-only because of file system issues.

list all opened ports on host
in loop, until the last port (65535), list all opened ports on host. in the sample I used localhost, but you can replace with any host to test.

Install pip with Proxy
Installs pip packages defining a proxy

Clear ARP table in linux.
Clears the "arp" table, without entering manually addresses (tested in Ubuntu).

diff two unsorted files without creating temporary files
bash/ksh subshell redirection (as file descriptors) used as input to diff

extract element of xml
Prints the value of a XML node rather than the entire node.

A rainbow-colored Tux gives a fortune cookie for the day. Great

Generate random valid mac addresses
Python Alternative

make image semi-transparent


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: