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:
Commandline perl filter for, using a production.log from a rails app, display on realtime the count of requests grouped by "seconds to complete" (gross round, but fair enough for an oneliner) :)
Just want to post a Perl alternative.
Does not count hidden files ('.' ones).
If you don't have seq, you can use perl.
(follow with next command)
tail -f from.log | colorize.pl +l20:".*" &
Use with http://www.commandlinefu.com/commands/view/10031/intercept-monitor-and-manipulate-a-tcp-connection. - can use to view output of tees that send traffic to files - output will be interwoven with red for sent traffic and green for received.
get colorize.pl from http://www.flinkmann.de/71-1-Colorizepl.html
The command creates an alias called 'path', so it's useful to add it to your .profile or .bash_profile. The path command then prints the full path of any file, directory, or list of files given. Soft links will be resolved to their true location. This is especially useful if you use scp often to copy files across systems. Now rather then using pwd to get a directory, and then doing a separate cut and paste to get a file's name, you can just type 'path file' and get the full path in one operation.
Easily removes line #2 in ~/.ssh/known_hosts.
A different approach to the problem - maintain a small sorted list, print the largest as we go, then the top 10 at the end. I often find that the find and sort take a long time, and the large file might appear near the start of the find. By printing as we go, I get better feedback. The sort used in this will be much slower on perls older than 5.8.
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]).
Better awk example, using only mplayer, grep, cut, and awk.
parse `lsmod' output and pass to `dot' drawing utility then finally pass it to an image viewer
You need to install WWW::Mechanize Perl module with
# cpan -i WWW::Mezchanize
or by searching mechanize | grep perl in your package manager
With this command, you can get forms, images, headers too
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.
This fixes a bug found in the other scripts which fail when a branch has the same name as a file or directory in the current directory.
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.
added greedy trick in wildcard match (.*?) from
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.