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

Save man pages to pdf

Find the package that installed a command

List the URLs of tabs of the frontmost Chrome window in OS X
This also works with Safari if you just change the application name. Replace $ window 1 with $ windows to list the URLs of tabs in all windows instead of only the frontmost window. This also includes titles: $ osascript -e{'set o to""','tell app"google chrome"','repeat with t in tabs of window 1','set o to o&url of t&"\n"&" "&title of t&"\n"',end,end}|sed \$d .

Copy the full path of a file to the clipboard (requires xclip or similar)
Handy for those times you need to paste a file path in an IDE or some other app. sudo apt-get install xclip Then, for convenience, alias xclip to 'xclip -selection c' so you can just do something like realpath . | xclip

pretend to be busy in office to enjoy a cup of coffee
using seq inside a subshell instead of a bash sequence to create increments.

list txt files order by time
list all txt files order by time, newest first

Monitor open connections for httpd including listen, count and sort it per IP
It's not my code, but I found it useful to know how many open connections per request I have on a machine to debug connections without opening another http connection for it. You can also decide to sort things out differently then the way it appears in here.

get total of inodes of root partition

Validating a file with checksum

diff the same file in two directories.
This is useful when you're diffing two files of the same name in radically different directory trees. For example: Set $ path1='/some/long/convoluted/path/to/all/of/your/source/from/a/long/dead/machine' then $ path2='/local/version/of/same/file' then run the command. Much easier on the eyes when you're looking back across your command history, especially if you're doing the same diff over and over again.


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: