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:
Here's a perl version that only considers printable characters. Change the regex /[[:print:]]/ to look for different sets of delimiter characters.
This is especially useful to get crazy stuff like space characters copied to your pasteboard correctly.
Removes special characters (colors) in '^]]Xm' and '^]]X;Ym' format from file.
Use pipe ('input | perl [...]') or stream ('perl [...]
You can use 'cat -v infile' as 'input' to show special characters instead of interpreting (there is problem with non-ASCII chars, they are replaced by M-[char]).
This will also print the path to file which is not included in the other examples.
parse `lsmod' output and pass to `dot' drawing utility then finally pass it to an image viewer
This will create a new file with proper code formatting and all comments removed.
convert a unix timestamp to a human readable format.
Lists all the modules that were installed the "proper way". It also uses Perl 5.10(or higher)'s say command for less typing.
making it "sound" more "natural" language like -- additionally sorting the longest words alphabetically:
this approach is using:
* to get at all lines of input
* post-"for" structure
* short-circuit-or in sort: if the lengths are the same, then sort alphabetically otherwise don't even evaluate the right hand side of the or
* -C sets all input and ouput channels to utf8
dirrrty: use -p to chomp automatically, substitute all newlines away and then replace the "---" by a newline ? bingo!
s/// => s/// is just a cooler way to write s///, s/// which is just the small brother of s///; s/// (comma is an operator!)
the output of svn log is annoying to grep, since it spreads the useful info over multiple lines. This compacts the output down to one line so eg you can grep for a comment and see the rev, date & committer straight away.
Updated: MUCH shorter, easier to remember. Now it just replaces newlines with spaces, except on '---' lines.
Require: perl -MCPAN -e 'install Acme::POE::Tree'
with a semicolon text file map, apply multiple replace to a single file
added greedy trick in wildcard match (.*?) from
Calls the POSIX strerror() function to look up the meaning of integer ERRNOs set by some functions.
say only processes a complete file, at eof, so following a file isn't possible. Quick and dirty perl oneliner to feed each line from the tail -f to say. Yes, expensive to lauch a new process each line.
This little ditty was prompted by a discussion on how horrible it is to use VoiceOver on ncurses programs such as irssi.
Find which directories on your system contain a lot of files.
Edit: much shorter and betterer with -n switch.
PmWiki stores wiki pages as Group.Name. Simply split the directory listing and count frequency of group occurances.
Perl version - just for completeness sake ;)