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

Sync the existing directory structure to destination, without transferring any files

Add Password Protection to a file your editing in vim.
While I love gpg and truecrypt there's some times when you just want to edit a file and not worry about keys or having to deal needing extra software on hand. Thus, you can use vim's encrypted file format. For more info on vim's encrypted files visit: http://www.vim.org/htmldoc/editing.html#encryption

Which processes are listening on a specific port (e.g. port 80)
swap out "80" for your port of interest. Can use port number or named ports e.g. "http"

Using a single sudo to run multiple && arguments
Bash's here string

Submit command & rewrite orginal command
Similar to entering a command, but will not erase the command from the command line. Basically a shortcut from entering command, then pushing the up arrow key.

Grab the top 5 CLFUContest one-liners

Script Terminal Session
script -f /tmp/foo will place all output of the terminal, including carriage returns, to a file. This file can be tail dash-eff'ed by one or more other terminals to display the information of the main terminal. Good way to share one's screen on short notice. Note: This produces a very accurate output, but that includes depending on the size of your terminal to be the same. You can clear screens or even resize the terminal for others using this function; I use it in conjunction with the "mid" command in my list.

Recompress all .gz files in current directory using bzip2 running 1 job per CPU core in parallel

Find top 10 largest files in /var directory (subdirectories and hidden files included )
Same as above, but modified to show human readable output

Console clock
Shows a simple clock in the console -t param removes the watch header Ctrl-c to exit


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: