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

View Processeses like a fu, fu
I don't truly enjoy many commands more than this one, which I alias to be ps1.. Cool to be able to see the heirarchy and makes it clearer what need to be killed, and whats really going on.

Google Spell Checker
I took matthewbauer's cool one-liner and rewrote it as a shell function that returns all the suggestions or outputs "OK" if it doesn't find anything wrong. It should work on ksh, zsh, and bash. Users that don't have tee can leave that part off like this: $spellcheck(){ typeset y=$@;curl -sd "$y" https://google.com/tbproxy/spell|sed -n '/s="[1-9]"/{s/]*>/ /g;s/\t/ /g;s/ *\(.*\)/Suggestions: \1\n/g;p}';}

Runs previous command replacing foo by bar every time that foo appears
To replace foo by bar, but not execute, do ^foo^bar^:p To replace all foo by bar, but not execute, do ^foo^bar^:&:p

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"

Get a funny one-liner from www.onelinerz.net
Put this command in .bashrc and every time you open a new terminal a random quote will be downloaded and printed from onelinerz.net. By altering the URL in the w3m statement you can change the output: 1 to 10 lines - http://www.onelinerz.net/random-one-liners/(number)/ 20 newest lines - http://www.onelinerz.net/latest-one-liners/ Top 10 lines - http://www.onelinerz.net/top-100-funny-one-liners/ Top 10 lines are updated daily.

Discover the process start time
That is useful to discover the start time of process older than 1 day. You can also run: $ ls -ld /proc/PID That's returning the creation date of the proc files from the process. Some users reported that this way might show you a wrong date since any other process like cron, for example, could change this date.

Second pass dvd rip... The set of commands was too long, so I had to separate them into two.
This set of commands will rip a dvd title using a 2 pass mencoder xvid encode. It will provide a great quality rip. It will rip as close to 700MB as possible. (note the bitrate of -700000) Enjoy!

faster version of ls *
I know its not much but is very useful in time consuming scripts (cron, rc.d, etc).

Make vim open in tabs by default (save to .profile)
I always add this to my .profile rc so I can do things like: "vim *.c" and the files are opened in tabs.

Remove comments from files
Use sed to remove comments from a file. In this example the comments begin with #. The command '/^#/d' remove line starting with #. The command 's/#.*$//' remove comments at end of lines.


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: