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

Join lines split with backslash at the end
Joins each line that end with backslash (common way to mark line continuation in many languages) with the following one while removing the backslash.

extract element of xml

Get all ip address for the host

search google on os x
Searches Google, but requires no "", and will also search all terms input in the CL, eg: > google foo bar returns search URL "http://www.google.com/search?q=foo%20bar" You could also use awk to replace all spaces with a +, which is how the Google search handles spaces, but that makes it more than one line.

Delete all flash cookies.
Maybe you want first check which files will be deleted: $ find $HOME -name '*.sol' -exec echo rm {} \;

watch iptables counters
Watch the number of packets/bytes coming through the firewall. Useful in setting up new iptables rules or chains. Use this output to reorder rules for efficiency.

Debug redirects between production reloads
Watches the headers of a curl, following any redirects and printing only the HTTP status and the location of the possible redirects.

Vim: Switch from Horizontal split to Vertical split
This allows to switch from horizontal to vertical split, putting the current buffer on the right side of the vertical split. To put it on the right use ^W-H. In a similar way, to switch from Vertical to Horizontal, do ^W-J (for bottom) and ^W-K (for top), but you vimers all guessed that one already :P

Create a new file

Batch rename extension of all files in a folder, in the example from .txt to .md
Same thing using bash built-in features instead of a sub-shell.


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: