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

redirect stdout and stderr each to separate files and print both to the screen

Compare a remote dir with a local dir
You can compare directories on two different remote hosts as well: $ diff -y

reset hosed terminal

Delete DOS Characters via VIM (^M)
And in case you want to migrate back to, err.. MS-DOS: ":set ff=dos" does the opposite.

Get line count for any file ending with extension recursively rooted at the current directory.

sort ip by count quickly with awk from apache logs
creates associative array from apache logs, assumes "combined" log format or similar. replace awk column to suit needs. bandwidth per ip is also useful. have fun. I haven't found a more efficient way to do this as yet. sorry, FIXED TYPO: log file should obviously go after awk, which then pipes into sort.

Find class in jar

Rot13 using the tr command
rot13 maps a..mn..z (A..MN..Z) to n..za..m (n..za..m) and so does this alias.

Search $PATH for a command or something similar
Searches your $PATH for whatever you substitute for bash, though not sure if this will work if you substitute a different shell for bash!

print contents of file from first match of regex to end of file
Search in "filename" for the first line to match regex, and print to stdout from the matching line to the end of the file.


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: