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

Look for English words in /dev/urandom
* to get the English dictionary: wget http://www.mavi1.org/web_security/wordlists/webster-dictionary.txt

Which processes are listening on a specific port (e.g. port 80)
swap out "80" for your port of interest. Can use port number or named ports e.g. "http"

Get all upgradable deb packages in a single line
Works for debian and ubuntu based distros.

Find the package that installed a command

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

Colorizes an access log
Puts a splash of color in your access logs. IP addresses are gray, 200 and 304 are green, all 4xx errors are red. Works well with e.g. "colorize access_log | less -R" if you want to see your colors while paging. Use as inspiration for other things you might be tailing, like syslog or vmstat Usage: $ tail -f access.log | colorize

Numeric zero padding file rename
This uses Perl's rename utility (you may have to call it as prename on your box) and won't choke on spaces or other characters in filenames. It will also zero pad a number even in filenames like "vacation-4.jpg".

My random music player
This is my favorite music player I use in my beloved Linux systems,server or desktop Enjoy :-)

check open ports without netstat or lsof

Find files and calculate size of result in shell
Using find's internal stat to get the file size is about 50 times faster than using -exec stat.


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: