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:
Uses lsof to list open network connections (file descriptors), grepping for only those in an established state
I like to make it an alias in my .bashrc file, as such:
alias psme='ps -ef | grep $USER'
Kill all processes with foo in them. Similar to pkill but more complete and also works when there is no pkill command.
Works on almost every Linux/Unix platform I have tried.
We use this to quickly highlight differences and provide a quick way to cut and paste the command to view the files using the marvellous vimdiff
Open a terminal (urxvt in this case) to connect to a screen session (named "main") and create the screen session if necessary.
Variant of find grep that ignores files with .svn in the name. Useful for searching through a local repository of source code.
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.
Simple use of find and grep to recursively search a directory for files that contain a certain term.
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.
This greps all PHP files for a given classname and displays both the file and the usage.
Creates a command alias ('cr' in the above example) that searches the contents of files matching a set of file extensions (C & C++ source-code in the above example) recursively within the current directory. Search configured to be in colour, ignore-case, show line numbers and show 4 lines of context. Put in shell initialisation file of your choice. Trivially easy to use, e.g:
Searches all .php files for a static instantiation of a class and displays the class names along with their frequencies.