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

Sorted list of established destination connections
no need grep. its redundant when awk is present.

Source zshrc/bashrc in all open terminals
Put this in your zshrc, source it, then run 'pkill -usr1 zsh' to source it in all open terminals. Also works with bash. More info: http://www.reddit.com/r/commandline/comments/12g76v/how_to_automatically_source_zshrc_in_all_open/

Copy specific files to another machine, keeping the file hierarchy
Notes: * Adjust the find command to your own filters. * The -P flag forces to keep absolute paths in the tarball, so that you can be sure that the exact same file hierarchy will be created on the second machine.

Print all lines in a file that are not a certain length
Alternatively, print all the lines that are a certain length: $awk 'length($0)==12 {print}' your_file_name

Find the package that installed a command

Content search.
Grep will read the contents of each file in PWD and will use the REs $1 $2 ... $n to match the contents. In case of match, grep will print the appropriate file, line number and the matching line. It's just easier to write $ ff word1 word2 word3 Instead of $ grep -rinE 'word1|word2|word3' .

Show the number of current httpd processes

Find the package that installed a command

generate random password (works on Mac OS X)
Prepending env LC_CTYPE=C fixes a problem with bad bytes in /dev/urandom on Mac OS X

Scroll up (or Down (PgDn)) in any terminal session (except KDE)


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: