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

Toggle a temporary ram partition
Creates a temporary ram partition To use: ram 3 to make a 3gb partition (Defaults to 1gb)

Send a binary file as an attachment to an email
The uuencode utility will encode your file so that it can be sent as an attachment to an email. It is part of the sharutils package in RHEL/CentOS/Fedora.

Find out what package some command belongs to (on RPM systems)
Replace 'more' command with any command which is in your PATH.

Print permanent subtitles on a video (international edition :) )
If it's Hebrew [most probably all RTL languages. Comments?], add -flip-hebrew and -noflip-hebrew-commas to the mplayer switches: $ transcode -i myvideo.avi -x mplayer="-utf8 -flip-hebrew -noflip-hebrew-commas -sub myvideo.srt" -o myvideo_subtitled.avi -y xvid

Efficiently extract lines between markers
GNU Sed can 'address' between two regex, but it continues parsing through to the end of the file. This slight alteration causes it to terminate reading the input file once the STOP match is made. In my example I have included an extra '/START/d' as my 'start' marker line contains the 'stop' string (I'm extracting data between 'resets' and using the time stamp as the 'start'). My previous coding using grep is slightly faster near the end of the file, but overall (extracting all the reset cycles in turn) the new SED method is quicker and a lot neater.

Remove comments in XML file
In Redhat, xmlstarlet is called just xml which can be found in xmlstarlet RPM.

Edit file(s) that has been just listed
That will open vi with the four README files in different viewports. Specially handy when you find there is only one file matching your pattern and you don't want to specify the full path.

prevent accidents while using wildcards
alternative for "echo rm *.txt". Just doubletab the command you are willing to use and it will show you the affected files.

Never rewrites a file while copying (or moving)
Allows you to preserve your files when using cp, mv, ln, install or patch. When the target file exists, it will generate a file named XXX.~N~ (N is an auto-incremental number) instead of deleting the target file.

View the newest xkcd comic.


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: