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

Watch movies in your terminal
requires mplayer

Rename files in batch

delete command line last word

Recursive search inside the content of files under current directory - then view the result paginated with 'less'
This command will traverse all of the folders and subfolders under current working directory. For every file inside it, it will do a search inside the content of the file for a specific term 'what'. Then it will print a list of the lines that contain that term (and match that pattern). Each matching line will be preceded with the path and name to the file and then the line number iside taht file wehre the pattern was found. Then the actual content of the matching lien will be printed. The output will be piped throug less, so that the user can scroll through it if it goes beyond the limits of the current display window.

while using lxde and being blinded by your laptop screen, you can type:
I'm not sure what apt this is, but it seems to work on most X screens, an is useful for saving power, and not straining your eyes

Wait the end of prog1 and launch prog2

port scan using parallel
It takes over 5 seconds to scan a single port on a single host using nmap $ time (nmap -p 80 192.168.1.1 &> /dev/null) real 0m5.109s user 0m0.102s sys 0m0.004s It took netcat about 2.5 minutes to scan port 80 on the class C $ time (for NUM in {1..255} ; do nc -w 1 -z -v 192.168.1.${NUM} 80 ; done &> /dev/null) real 2m28.651s user 0m0.136s sys 0m0.341s Using parallel, I am able to scan port 80 on the entire class C in under 2 seconds $ time (seq 1 255 | parallel -j255 'nc -w 1 -z -v 192.168.1.{} 80' &> /dev/null) real 0m1.957s user 0m0.457s sys 0m0.994s

Convert a flv video file to avi using mencoder

pngcrush all .png files in the directory
Nothing too magical here, just uses pngcrush to losslessly compress all your pngs!

Copy files for backup storage
Backup a whole directory copying only updated files.


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: