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

Resample a WAV file with sox
Change the sample rate with sox, the swiss army knife of sound processing.

How many days until the end of the year

Find files and calculate size of result in shell
Using find's internal stat to get the file size is about 50 times faster than using -exec stat.

Generate SSH public key from the private key

Map the slot of an I/O card to its PCI bus address
Recent hardware may or may not enumerate *both of* these values

Get a shell with a not available account

print line and execute it in BASH
!# is the currennt line so far, by using !#:- you can go from the second arg (it's zero indexed) to the last ($) (did I understand the problem correctly?)

Press ctrl+r in a bash shell and type a few letters of a previous command
In the sample output, I pressed ctrl+r and typed the letters las. I can't imagine how much typing this has saved me.

Convert seconds to [DD:][HH:]MM:SS
Converts any number of seconds into days, hours, minutes and seconds. sec2dhms() { declare -i SS="$1" D=$(( SS / 86400 )) H=$(( SS % 86400 / 3600 )) M=$(( SS % 3600 / 60 )) S=$(( SS % 60 )) [ "$D" -gt 0 ] && echo -n "${D}:" [ "$H" -gt 0 ] && printf "%02g:" "$H" printf "%02g:%02g\n" "$M" "$S" }

Create a tar archive using xz compression
Compress files or a directory to xz format. XZ has superior and faster compression than bzip2 in most cases. XZ is superior to 7zip format because it can save file permissions and other metadata data.


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: