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

start a VNC server for another user

Find broken symlinks and delete them
recursively deletes all broken symlinks using zsh globbing syntax.

Search for commands from the command line
Search at CommandLineFu.com from your terminal. Get the clfu-seach at http://www.colivre.coop.br/Aurium/CLFUSearch

Remove all leading and trailing spaces or tabs from all lines of a text file
Bash only, no sed, no awk. Multiple spaces/tabs if exists INSIDE the line will be preserved. Empty lines stay intact, except they will be cleaned from spaces and tabs if any available.

Erase CD RW

notify yourself when a long-running command which has ALREADY STARTED is finished
If you want to be notified when a long-running command is finished, but you have already started it: CTRL+Z $ fg; echo "finished" | sendmail me@example.com I use a script to post a tweet, which sends me a txt: $ fg; echo "finished" | tweet

Delete files older than..
This command will delete files i a given path (/dir_name) , which older than given time in days (-mtime +5 will delete files older than five days.

Perpetual calendar
Gets any date since today. Other examples of recognized expressions are "2 years 4 days ago", "7 months" (in the future), "next Sunday", "yesterday", "tomorrow", etc.

cd into another dir to run a one-liner, but implicitly drop back to your $OLD_PWD after
Obviously the example given is necessarily simple, but this command not only saves time on the command line (saves you using "cd -" or, worse, having to type a fully qualified path if your command cd's more than once), but is vital in scripts, where I've found the behaviour of "cd -" to be a little broken at times.

Batch Convert SVG to PNG (in parallel)
Convert some SVG files into PNG using ImageMagick's convert command. Run the conversions in parallel to save time. This is safer than robinro's forkbomb approach :-) xargs runs four processes at a time -P4


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: