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

Write comments to your history.
A null operation with the name 'comment', allowing comments to be written to HISTFILE. Prepending '#' to a command will *not* write the command to the history file, although it will be available for the current session, thus '#' is not useful for keeping track of comments past the current session.

Rename files in batch

Bulk renames with find, sed and a little escaping
This command is a more flexible than my previous submission. It will work with spaces however suuuuper hacky and ugly. Source: http://www.unix.com/shell-programming-scripting/146173-find-rename-files-using-find-mv-sed.html

Push your present working directory to a stack that you can pop later
If are a Bash user and you are in a directory and need to go else where for a while but don't want to lose where you were, use pushd instead of cd. cd /home/complicated/path/.I/dont/want/to/forget pushd /tmp cd thing/in/tmp popd (returns you to /home/complicated/path/.I/dont/want/to/forget)

Are the two lines anagrams?
This works by reading in two lines of input, turning each into a list of one-character matches that are sorted and compared.

Check if a domain is available and get the answer in just one line
Returns nothing if the domain exists and 'No match for domain.com' otherwise.

Play online music videos in terminal
pvl 'link1' 'link2' 'link3' Play Youtube, Vimeo, etc links without visual elements. Great for music videos when you just want the audio. You can control mplayer with this! Hit Ctrl-C twice to exit (if you're playing multiple files)

Obtain last stock quote from google API with xmlstarlet

Secure copy from one server to another without rsync and preserve users, etc
Source: http://unix.derkeiler.com/Newsgroups/comp.unix.shell/2008-04/msg00068.html

Add GPG key easy - oneliner
Replace KEY with GPG key. This command will load GPG key and add it to your system so you can use software from third party repos etc.


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: