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

archlinux: shows list of files installed by a package
Shows the files which the package, for example gvim, installed on your system.

mysqlcheck --defaults-file=/etc/mysql/debian.cnf --auto-repair --all-databases

grep tab chars
mixing tabs and spaces for indentation in python would confuse the python interpreter, to avoid that, check if the file has any tab based indentation. "^V" => denotes press control + v and press tab within quotes. $ cat improper_indent.py class Tux(object): print "Hello world.." $ grep " " improper_indent.py print "Hello world.."

pretend to be busy in office to enjoy a cup of coffee
Not as taxing on the CPU.

Search some text from all files inside a directory

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"

Diff two directories by finding and comparing the md5 checksums of their contents.
Compares the md5 checksums of the contents of two directories, outputting the checksum and filename where any files differ. Shows only the file name, not the full path.

watch iptables counters
This will allow you to watch as matches occur in real-time. To filter out only ACCEPT, DROP, LOG..etc, then run the following command: watch 'iptables -nvL | grep -v "0 0" && grep "ACCEPT"' The -v is used to do an inverted filter. ie. NOT "0 0"

Binary injection
Replace (as opposed to insert) hex opcodes, data, breakpoints, etc. without opening a hex editor. HEXBYTES contains the hex you want to inject in ascii form (e.g. 31c0) OFFSET is the hex offset (e.g. 49cf) into the binary FILE

Send test prints to networked printer.
This will send a test print job to a networked printer.


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: