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

Extract your list of blocked images hosts from Firefox database
I use this to replicate my blocked images hosts list between work and home to keep my browsing ad-free.

Find removed files still in use via /proc
Oracle DBA remove some logfiles which are still open by the database and he is complaining the space has not been reclaimed? Use the above command to find out what PID needs to be stopped. Or alternatively recover the file via: $ cp /proc/pid/fd/filehandle /new/file.txt

Batch rename extension of all files in a folder, in the example from .txt to .md
Batch rename extension of all files in a folder, in the example from .txt to .md

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"

Display command lines visible on commandlinefu.com homepage
Uses the fabulous Hpricot library to parse HTML from Ruby. Extracts all elements of "command' class and displays unescaped text from inside these elements. The following command can help install dependencies (apart from Ruby itself) $ gem sources -a http://gems.github.com && sudo gem install why-hpricot

See system users

draw rhomb

Rename files in batch

grep compressed log files without extracting
accomplishes the same thing without unzipping the whole file, and while i have never seen a log.tar.gz file that was a binary, i will concede that it might happen, so add the -a in there: $zgrep -ia "string" log.tar.gz it's still shorter/easier to type...

Create a tar of directory structure only
The original suggestion did not work for me, when operating on folders located on an external mount (ie other than the root device) in Ubuntu. A variation using xargs does the trick.


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: