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

Create cheap and easy index.html file
If your admin has disabled Apache's directory index feature but you want to have a cheap way to enable it for one folder, this command will just create an index.html file with a link to each file in the directory (including the index.html file, which is not ideal but makes the command much simpler). The HTML isn't even remotely compliant, but it could easily be improved on. Also, the command needs to be run each time a file is added or removed to update the index.html file.

Remove security limitations from PDF documents using ghostscript (for Windows)
#4345 also works under windows

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"

Sum columns from CSV column $COL

Start another instance of X via SSH

List all symbolic links in a directory matching a string
Finds all symbolic links in the specified directory which match the specified string pattern. I used this when upgrading from an Apple-supported version of Java 6 (1.6.0_65) to an Oracle-supported version (1.7.0_55) on Mac OS X 10.8.5 to find out which executables were pointing to /System/Library/Frameworks/JavaVM.framework/Versions/Current/Commands (Apple version) vs. /Library/Java/JavaVirtualMachines/jdk1.7.0_55.jdk/Contents/Home/bin (Oracle version). However, it appears the current JDK installation script already takes care of modifying the links.

Use jq to validate and pretty-print json output
The `jq` tool can also be used do validate json files and pretty print output: ` jq < file.json` Available on several platforms, including newer debian-based systems via `#sudo apt install jq`, mac via `brew install jq`, and from source https://stedolan.github.io/jq/download/ This alternative to the original avoids the useless use of cat

Search for a string inside all files in the current directory
ack seeks for , list all found files and display everything in nice colors. Look for it in http://betterthangrep.com/

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"

Start COMMAND, and kill it if still running after 5 seconds


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: