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

Parallel mysql dump restore
this command works with one gziped file per table, and restore 4 tables in parallel.

Kill all processes belonging to a single user.

Compare a remote dir with a local dir
You can compare directories on two different remote hosts as well: $ diff -y

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"

Trace a DNS query from root to the authoritive servers.
Simple command to trace a DNS query from the root all the way to the authoritative servers.

Clean up poorly named TV shows.
Replace 'SHOWNAME' with the name of the TV show. Add -n to test the command without renaming files. Check the 'sample output'.

using tee to echo to a system file with sudo privileges
We sometimes need to change kernel parameters by echoing the file . This needs root privilege and if we do it using sudo like this , it fails $ sudo echo ondemand > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor -bash: /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor: Permission denied We can achieve this with the tee command by just doing sudo without logging as root user http://www.zaman4linux.in/2010/09/using-tee-to-echo-to-system-file-with.html

Enter a command but keep it out of the history
Put a space in front of your command on the command line and it will not be logged as part of your command line history.

multiline data block parse and CSV data extraction with perl
extract data in multiline blocks of data with perl pattern matching loop

Get the 10 biggest files/folders for the current direcotry


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: