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

Print just line 4 from a textfile
Prints the 4th line and then quits. (Credit goes to flatcap in comments: http://www.commandlinefu.com/commands/view/6031/print-just-line-4-from-a-textfile#comment.)

get a random 0/1, use it for on/off, yes/no
use it to add a random boolean switch to your script

List files with full path

Fetch the Gateway Ip Address
This is to fetch the Gateway Ip Address of a machine. Use the below format to put the value in a variable if you wish to find the gateway ip in a script $GATEWAY=$(netstat -nr | awk 'BEGIN {while ($3!="0.0.0.0") getline; print $2}')

zgrep across multiple files

Run command from another user and return to current

Find the package that installed a command

Batch-Convert text file containing youtube links to mp3

Convert the output of one or more (log, source code ...) files into html,
Requires the "enscript" package. frank@zappa:~# sudo apt-get install enscript Or http://www.codento.com/people/mtr/genscript/ "use your head"

Burst a Single PDF Document into Single Pages and Report its Data to doc_data.txt
Require the pdftk package It ll split each page in your pdf file , into a new pdf file and report info on doc_data.txt


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: