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:
Remove old kernels (*-generic and *-generic-pae) via apt-get on debian/ubuntu based systems. Tested on ubuntu 10.04 - 12.04.
small update for this command to work with linux kernels 3.x
Nothing fancy, just a regular filesystem scan that calls the badblocks program and shows some progress info. The used options are:
-c ? check for bad sectors with badblocks program
-D ? optimize directories if possible
-f ? force check, even if filesystem seems clean
-t ? print timing stats (use -tt for more)
-y ? assume answer ?yes? to all questions
-C 0 ? print progress info to stdout
/dev/sdxx ? the partition to check, (e.g. /dev/sda1 for first partition on first hard disk)
NOTE: Never run fsck on a mounted partition!
i've been writing a bash script where i needed to query the installed version number of the nvidia driver when it's not loaded. Unfortunately i have not found a easy way of doing this.
If i'm a stupid person, please enlighten me of a better way ;)
This command will search all subfolders of the current directory and list the names of the folders which contain less than 2 MB of data. I use it to clean up my mp3 archive and to delete the found folders pipe the output to a textfile & run:
while read -r line; do rm -Rv "$line"; done < textfile
extension to tali713's random fact generator. It takes the output & sends it to notify-osd. Display time is proportional to the lengh of the fact.