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

Make a playlistfile for mpg321 or other CLI player
A short variant if you have only one directory whit only audio files in it.

list files recursively by size

Force wrap all text to 80 columns in Vim
This is assuming that you're editing some file that has not been wrapped at 80 columns, and you want it to be wrapped. While in Vim, enter ex mode, and set the textwidth to 80 columns: $ :set textwidth=80 Then, press: $ gg to get to the top of the file, and: $ gqG to wrap every line from the top to the bottom of the file at 80 characters. Of course, this will lose any indentation blocks you've setup if typing up some source code, or doing type setting. You can make modifications to this command as needed, as 'gq' is the formatting command you want, then you could send the formatting to a specific line in the file, rather than to the end of the file. $ gq49G Will apply the format from your current cursor location to the 49th row. And so on.

Change host name
With sed you can replace strings on the fly.

get a process list by listen port

Purge configuration files of removed packages on debian based systems

Find corrupted jpeg image files
Finds all corrupted jpeg files in current directory and its subdirectories. Displays the error or warning found. The jpeginfo is part of the jpeginfo package in debian. Should you wish to only get corrupted filenames, use cut to extract them : $ find ./ -name *jpg -exec jpeginfo -c {} \; | grep -E "WARNING|ERROR" | cut -d " " -f 1

Set all CPU cores' CPU frequency scaling governor to maximum performance

Create a backup copy of a MySQL database on the same host
This should probably only be used for testing in a dev environment as it's not terribly efficient, but if you're doing something that might trash a DB and you still want the old data available, this works like a charm.

Get your external IP address
Yeah I know it's been up here a million times, but this service is a really clean and nice one. Nothing but your IP address on it. Actually I was to write something like this, and noticed this on appspot... ;)


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: