commandlinefu.com is the place to record those command-line gems that you return to again and again.
You can sign-in using OpenID credentials, or register a traditional username and password.
Subscribe to the feed for:
The description of how the one-liner works is here at my blog:
Greps IRC logs for phrases and lists users who said them.
shows all RPMs with files in the current directory & its subdirectories.
Ever use 'locate' to find a common phrase in a filename or directory name? Often you'll get a huge list of matches, many of which are redundant, and typically the results are not sorted. This command will 'locate' your search phrase, then show you a sorted list of just the relevant directories, with no duplications. So, for example, maybe you have installed several versions of the java jre and you want to track down every directory where files matching "java" might exist. Well, a 'locate java' is likely to return a huge list with many repeated directories since many files in one directory could contain the phrase "java". This command will whittle down the results to a minimal list of unique directory names where your search phrase finds a match.
bash/ksh subshell redirection (as file descriptors) used as input to diff
This grabs all lines that make an instantation or static call, then filters out the cruft and displays a summary of each class called and the frequency.
Recursively searches current directory and outputs sorted list of each directory's disk usage to a text file.
This uses awk to grab the IP address from each request and then sorts and summarises the top 10.
ps returns all running processes which are then sorted by the 4th field in numerical order and the top 10 are sent to STDOUT.