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

Creating A Single Image Video With Audio via ffmpeg

Extract audio stream from an AVI file using mencoder
This commands saves the output in the audio directory. The portion ${file/%avi/mp3} uses bash string replacement to replace the avi to mp3 within the ${file} variable.

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"

Recursive replace of directory and file names in the current directory.
no grep, no perl, no pipe. even better in zsh/bash4: $ for i in **/*oldname*; do "mv $i ${i/oldname/newname/}"; done No find, no grep, no perl, no pipe

Stripping ^M at end of each line for files
just deletes to rogue CR from dos files, and tr is always available.

Quickly generate an MD5 hash for a text string using OpenSSL
Thanks to OpenSSL, you can quickly and easily generate MD5 hashes for your passwords. Alternative (thanks to linuxrawkstar and atoponce): $ echo -n 'text to be encrypted' | md5sum - Note that the above method does not utlise OpenSSL.

Print a list of installed Perl modules
Works only if modules are installed "the right way"

ASCII webcam live stream video using mplayer
Mplayer starts a webcam capture using ASCII art. Only mplayer required

Maximum PNG compression with optipng, advpng, and advdef
optipng and advancecomp (for the the advpng and advdef tools) are the best FOSS tools for losslessly compressing PNGs. With the above tool chain, you can cut off as much as 20% off a PNG's file size.

View all date formats, Quick Reference Help Alias
If you have used bash for any scripting, you've used the date command alot. It's perfect for using as a way to create filename's dynamically within aliases,functions, and commands like below.. This is actually an update to my first alias, since a few commenters (below) had good observations on what was wrong with my first command. # creating a date-based ssh-key for askapache.github.com $ ssh-keygen -f ~/.ssh/`date +git-$USER@$HOSTNAME-%m-%d-%g` -C 'webmaster@askapache.com' $ # /home/gpl/.ssh/git-gplnet@askapache.github.com-04-22-10 # create a tar+gzip backup of the current directory $ tar -czf $(date +$HOME/.backups/%m-%d-%g-%R-`sed -u 's/\//#/g'


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: