commandlinefu.com is the place to record those command-line gems that you return to again and again.
Delete that bloated snippets file you've been using and share your personal repository with the world. 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.
If you have a new feature suggestion or find a bug, please get in touch via http://commandlinefu.uservoice.com/
You can sign-in using OpenID credentials, or register a traditional username and password.
First-time OpenID users will be automatically assigned a username which can be changed after signing in.
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.
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:
Thx Mass1 for the sharing
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
tail -f access.log | colorize
Is the better option on a Open SuSE Box
This will strip out the relivent disk information from kvm. I'm using it to find disks on a SAN which are no longer in use.
Backs up all databases, excluding test, mysql, performance_schema, information_schema.
Requires parallel to work, install parallel on Ubuntu by running: sudo aptitude install parallel
I used this to get all the remote connection ip addresses connected to my server... I had to start storing and tracking this data so thats why i built this out... probably not optimal as far as the egrep regex but it works ;)
UBNT iwlist command
This one has a better performance, as it is a one pass count with awk. For this script it might not matter, but for others it is a good optiomization.
make usable on OSX with filenames containing spaces. note: will still break if filenames contain newlines... possible, but who does that?!
Enhanced version: fixes sorting by human readable numbers, and filters out non MB or GB entries that have a G or an M in their name.
Uses the formatting of a man page to show an outline of its headers and sub-headers.
This was tested on Ubuntu 12.04 (Precise) LTS Server. It returns the name of the symlink within /dev/disk/by-id for the physical drive you specify. Change /dev/sda to the one you want, and replace ata- with scsi- or the appropriate type for your drive.
I used this to pre-configure grub-pc during a non-interactive install because I had to tell it which disk to install grub on, and physical disks don't have a UUID such as that blkid provides.
Not always does Xorg run on :0. For times like those, this script allows you to find out which it is.
find files recursively from the current directory, and list the extensions of files uniquely
looks at html for "ip" (it's a CSS class), then a little of cut and egrep to get IPv4 address.
I use this oneliner into conky.
Use meaningful exit codes
change "source" to "cat" to view output instead of assigning