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

diff 2 remote files

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" }

Adding leading zeros to a filename (1.jpg -> 001.jpg)
From: http://grml.org/zsh/zsh-lovers.html

tcpdump top 10 talkers
capture 2000 packets and print the top 10 talkers

ruby one-liner to get the current week number

wget download with multiple simultaneous connections

Speed up upgrades for a debian/ubuntu based system.
Please install aria2c before you try the above command. On ubuntu the command to install aria2c would be: $sudo aptitude install aria2

uniq without pre-sorting
Reads stdin, and outputs each line only once - without sorting ahead of time. This does use more memory than your system's sort utility.

Send a local file via email
This just reads in a local file and sends it via email. Works with text or binary. *Requires* local mail server.

!* Tells that you want all of the *arguments* from the previous command to be repeated in the current command
Example: touch file{1,2,3}; chmod 777 !*


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: