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:
Can be integrated into your .bashrc if you like. You'll probably want to grep out my name.
This will open an awful lot of little windows, but is quite useful if you want to quickly patch something on a cluster of servers.
Debian-specific but very useful as cron files are prone to very subtle gotchas
The -d flag sets the lifetime of a metric and defaults to 0 hence why old metrics continue to be graphed in the dashboard. Submitting a dummy value and short lifetime ensures that the metric is removed from the dashboard.
Note that this assumes the application is an SVN checkout and so we have to throw away all the .svn files before making the substitution.
A good way to understand what you've let yourself in for. Potential project metric could be the count:
svn log | grep -c "bodge\|fudge\|hack\|dirty"
You will need libnotify-bin for this to work:
sudo aptitude install libnotify-bin
This loops through all tables and changes their collations to UTF8. You should backup beforehand though in case some data is lost in the process.
Useful for monitoring both MySQL and the server load at the same time.
The hyphen tells vim to open from STDOUT - saves having to create temporary files.
I have this on a daily cronjob to backup the commandlinefu.com database from NearlyFreeSpeech.net (awesome hosts by the way) to my local drive. Note that (on my Ubuntu system at least) you need to escape the % signs on the crontab.
Simple use of ImageMagick identify function.
Watch is a very useful command for periodically running another command - in this using mysqladmin to display the processlist. This is useful for monitoring which queries are causing your server to clog up.
You'll need to make sure your xorg.conf permits a virtual screen size this big. If it doesn't then xrandr should return a suitable error message that tells you the required size.
Useful for massive files where doing a full diff would take too long. This just runs diff on the first 500 lines of each. The use of subshells to feed STDIN is quite a useful construct.
This removes the type prefix used in Hungarian notation (v. bad) for PHP variables. Eg. variables of the form $intDays, $fltPrice, $arrItems, $objLogger convert to $days, $price, $Items, $logger.
Not that useful really, more novel. Can open up an awful lot of terminal windows.
Good for one off jobs that you want to run at a quiet time. The default threshold is a load average of 0.8 but this can be set using atrun.
Useful in scripts when the file is passed in as an argument. Eg.
Useful for checking if there are differences between local and remote files.
This decompresses the file and sends the output to STDOUT so it can be grepped. A good one to put in loops for searching directories of gzipped files, such as man pages.
Useful for getting to know the available keyboard shortcuts.
This is useful for keeping an eye on an error log while developing. The !^ pulls the first arg from the previous command (which needs to be run in a sub-shell for this shortcut to work).