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

Change host name
With sed you can replace strings on the fly.

List last opened tabs in firefox browser

Perl One Liner to Generate a Random IP Address

"Pretty print" $PATH, separate path per line
from: http://www.unix.com/shell-programming-and-scripting/28047-split-print-path.html

Donwload media from *.rm from an url of type htttp://.../*.ram

Loop over the days of a month, in $YYYY$MM$DD format
Edit YYYY and MM at the beginning of the command with the year and month you want. Note that `DD=$(printf "%02d" $d)` will pad single digit integers with a leading zero. Substitute `echo $YYYY$MM$DD` at the end of the line with the command you want to launch, for instance script.pl --yyyymmdd $YYYY$MM$DD Also available on GitHub as bash util: https://github.com/fibo/yyyymmdd

dmesg with colored human-readable dates
Use sed to color the output of a human-readable dmesg output

Get the IP address of a machine. Just the IP, no junk.
Why use many different utilities all piped together, when you only need two?

Run a command for a given time
or "Execute a command with a timeout" Run a command in background, sleep 10 seconds, kill it. $! is the process id of the most recently executed background command. You can test it with: find /& sleep10; kill $!

capture selected window
I think, this is a shorter one :)


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: