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

Recursive search and replace (with bash only)
Replaces a string matching a pattern in one or several files found recursively in a particular folder.

check the status of 'dd' in progress (OS X)
"killall -USR1 dd" does not work in OS X for me. However, sending INFO instead of USR1 works.

Print line immediately before a matching regex.
Use this if you don't have access to GNU grep's -B option.

List just the executable files (or directories) in current directory
Does an 'ls' on just the files and directories in the current directory with an execute bit turned on. This version will list directories. Just tack on "-type f" to the start of the find to omit listing directories and list only files.

Find out the active XOrg Server DISPLAY number (from outside)
It's useful when you cannot access your env (systemd) or the process DISPLAY variable is not set. Perhaps also when you have a multi-head/user configuration.

Show a script or config file without comments or blank lines

Which processes are listening on a specific port (e.g. port 80)
swap out "80" for your port of interest. Can use port number or named ports e.g. "http"

find and reduce 8x parallel the size of JPG images without loosing quality via jpegoptim

MySQL: Slice out a specific table from the output of mysqldump
Only filters the statement related to a specific table ('departments', in the example), from the output of mysqldump

Rename files in batch


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: