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

All what exists in dir B and not in dir A will be copied from dir B to new or existing dir C
Assumed dir A, B, C are subdirs of the current dir Exact syntax of the command is: rsync -v -r --size-only --compare-dest=/path_to_A/A/ /path_to_B/B/ /path_to_C/C/ (do not omit end-slashes, since that would copy only the names and not the contents of subdirs of dir B to dir C) You can replace --size-only with --checksum for more thorough file differences validation Useful switch: -n, --dry-run perform a trial run with no changes made

Replace + Find

Add timestamp to history
History usually only gives the command number and the command. This will add a timestamp to the history file. Note: this will only put the correct timestamp on commands used after the export is done. You may want to put this in your .bashrc

Adding formatting to an xml document for easier reading
Sometimes you're trying to read through an xml file to determine whats wrong with it and a tool had removed all the linebreaks. xmllint will go ahead and make it pretty for you.

Shows size of dirs and files, hidden or not, sorted.

Install pip with Proxy
Installs pip packages defining a proxy

Selecting a random file/folder of a folder
Also looks in subfolders

scp with compression.
-C is for compression.

Rename files in batch

Extracting frames from a video as jpeg files
This command extracts 10 seconds worth of frames, starting from 00:15:45 position, from filename.avi and stores them into out_frames folder as jpeg files. Subtitles are turned off with -sid 999 option.


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: