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

Zip a directory on Mac OS X and ignore .DS_Store (metadata) directory
If you want to generate a cross-platform compatible zip file and ignore the Finder's hidden metadata directory

Super Speedy Hexadecimal or Octal Calculations and Conversions to Decimal.
^Hexadecimal Ten minus Octal Ten is Eight(in Decimal). $ echo "$(( 0xaf )) = $(( 0257 ))" ^Hexadecimal AF and Octal 257 are both Decimal 175.

Quickly re-execute a recent command in bash
! will expand to the last time you ran , options and all. It's a nicer alternative to ^R for simple cases, and it's quite helpful for those long commands you run every now and then and haven't made aliases or functions for. It's similar to command 3966, in some sense.

Colorizes an access log
Puts a splash of color in your access logs. IP addresses are gray, 200 and 304 are green, all 4xx errors are red. Works well with e.g. "colorize access_log | less -R" if you want to see your colors while paging. Use as inspiration for other things you might be tailing, like syslog or vmstat Usage: $ tail -f access.log | colorize

Convert ascii string to hex
Here's a version that uses perl. If you'd like a trailing newline: $ perl -pe 's/(.)/sprintf("\\x%x", ord($1))/eg; END {print "\n"}'

Find the package that installed a command

Build an exhaustive list of maildir folders for mutt
Of course, you can adjust "Maildir" to your config...

Create .pdf from .doc
sudo apt-get install cups-pdf

Duplicating service runlevel configurations from one server to another.
And then to complete the task: Go to target host; $ssh host Turn everything off: $for i in `chkconfig --list | fgrep :on | awk '{print $1}'` ; do chkconfig --level 12345 $i off; done Create duplicate config: $while read line; do chkconfig --level $line on; done < foo

Find usb device in realtime
Using this command you can track a moment when usb device was attached.


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: