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:
This command will traverse all of the folders and subfolders under current working directory. For every file inside it, it will do a search inside the content of the file for a specific term 'what'. Then it will print a list of the lines that contain that term (and match that pattern). Each matching line will be preceded with the path and name to the file and then the line number iside taht file wehre the pattern was found. Then the actual content of the matching lien will be printed.
The output will be piped throug less, so that the user can scroll through it if it goes beyond the limits of the current display window.
Edit YYYY and MM at the beginning of the command with the year and month you want.
Note that `DD=$(printf "%02d" $d)` will pad single digit integers with a leading zero.
Substitute `echo $YYYY$MM$DD` at the end of the line with the command you want to launch, for instance
script.pl --yyyymmdd $YYYY$MM$DD
lsblk | grep mountpoint
displays a list of all file extensions in current directory and how many files there are of each type of extension in ascending order (case insensitive)
When running a long `diff -r` over folders, this simulates a "verbose" mode where you can see where diff is in the tree.
Replace $file with the first part of the path being compared.
Specific to OSX.
With this command, you can check the difference between the volumes mounted and the volume in /etc/fstab.
This command removes all ruby gems except the default ones that can not be removed. It is based on http://geekystuff.net/2009/01/14/remove-all-ruby-gems/
This command will show the sum total of memory used in gigabytes by a program that spawns multiple instances of itself. Replace chrome with whatever program's memory usage you are investigating. This command is rather useless on software that only spawns a single instance of itself.
This lists the number of ogg/mp3/wav/flac files in each subdirectory of the current directory. The output can be sorted by piping it into "sort -n".
Shows all available keyboard bindings in bash. Pretty printing.
Fetches latest stable release version from first entry between tags
Checks for syntax errors in PHP files modified in current working copy of a Git repository.
Creates a temporary ram partition
to make a 3gb partition (Defaults to 1gb)
-c will count the number of times your search matches in the file.