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

Execute a command at a given time
This is an alternative to cron which allows a one-off task to be scheduled for a certain time.

Print every Nth line
Sometimes commands give you too much feedback. Perhaps 1/100th might be enough. If so, every() is for you. $ my_verbose_command | every 100 will print every 100th line of output. Specifically, it will print lines 100, 200, 300, etc If you use a negative argument it will print the *first* of a block, $ my_verbose_command | every -100 It will print lines 1, 101, 201, 301, etc The function wraps up this useful sed snippet: $ ... | sed -n '0~100p' don't print anything by default $ sed -n starting at line 0, then every hundred lines ( ~100 ) print. $ '0~100p' There's also some bash magic to test if the number is negative: we want character 0, length 1, of variable N. $ ${N:0:1} If it *is* negative, strip off the first character ${N:1} is character 1 onwards (second actual character).

Find top 10 largest files in /var directory (subdirectories and hidden files included )
Should work even when very large files exist.

GREP a PDF file.
This is a good alternative to pdf2text for Ubuntu. To install it: sudo apt-get install python-pdfminer

MPD + Digitally Imported
1.- Enter into the playlist path. 2.- Run the command. 3.- Playlists created!

Binary clock
Fun idea! This one adds seconds and keeps running on the same line. Perl's probably cheating though. :)

Download all recently uploaded pastes on pastebin.com

Watch for when your web server returns
If your web server is down, this command will periodically attempt to connect to it. If the output is blank, your server is not yet up. If you see HTML, your server is up. Obviously, you need to replace the Google URL with your web server URL... * 'watch' -- a command for re-executing a command and displaying the output * '-n 15' -- tells watch to redo the command every 15 seconds * 'curl' -- a handy utility for getting the source of a web page * '-s' -- tells curl to be silent about failing * '--connect-timeout 10' -- Try to connect for 10 seconds

Install pip with Proxy
Installs pip packages defining a proxy

generate random password
for Mac OS X


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: