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

Convert text to picture
generates a picture file with the text. Some other samples in: http://www.imagemagick.org/Usage/text/

get a list of top 1000 sites from alexa
a little bit smarter & i only want .de domains, so .....

Find broken symlinks and delete them
If you don't want to delete them, but just want to list them, do $ find -L /path -type l If you want to delete them with confirmation first, do $ find -L /path -type l -exec rm -i {} + Using the -L flag follows symlinks, so the -type l test only returns true if the link can't be followed, or is a symlink to another broken symlink.

Display the output of a command from the first line until the first instance of a regular expression.
Slightly simpler version of previous sed command that does the same thing. In this case, the output will stop at the command, and the entire command will be terminated as well, instead of proceeding through the whole file.

pip install into current directory without virtualenv
For subsequent commands in the prefixed path: $ PYTHONPATH=$PWD/lib/python*/site-packages ./bin/pip --version

Commit command to history file immedeately after execution
This could be added to .bashrc. Background: Linux usually saves history only on clean exit of shell. If shell ends unclean, history is lost. Also numerous terminals might confuse their history. With this variable set, history is immedeately written, accessible to all other open shells.

Quick syntax highlighting with multiple output formats
You can specify various output formats, theme styles, etc. $ python -m pygments -o source.png source.py $ python -m pygments -o source.rtf source.py Check available output formats, styles, etc.: $ python -m pygments -L Find pygments module here: http://pygments.org/

Synchronize date and time with a server over ssh
Shorter, easier to remember version of cmd#7636 NTP is better, but there are situations where it can't be used. In those cases, you can do this to sync the local time to a server.

Translate your terminal into Swedish Chef
Bork, bork, bork! To keep it short, the first terminal line doesn't show a prompt.

Easy and fast access to often executed commands that are very long and complex.
When using reverse-i-search you have to type some part of the command that you want to retrieve. However, if the command is very complex it might be difficult to recall the parts that will uniquely identify this command. Using the above trick it's possible to label your commands and access them easily by pressing ^R and typing the label (should be short and descriptive). UPDATE: One might suggest using aliases. But in that case it would be difficult to change some parts of the command (such as options, file/directory names, 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: