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:
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.
This uses wget instead of curl
Find all files in /var/spool/mqueue older than 7 days, pass to perl to efficiently delete them (faster than xargs or -exec when you've got millions or hundreds of thousands to delete). Naturally the type, directory, and file age vars can be adjusted to meet your specific needs.
Much better alternatives - grep-alikes using perl regexps. With more options, and nicer outputs.
If you've ever tried "grep -P" you know how terrible it is. Even the man page describes it as "highly experimental". This function will let you 'grep' pipes and files using Perl syntax for regular expressions.
The first argument is the pattern, e.g. '/foo/'. The second argument is a filename (optional).
this command example converts to 25 fps subtitles that were originally created for 24 fps movie
The output of lsof is piped to txt2html which converts it to html.
# Perl module HTML::TextToHTML needed
If your contact information was entered when your user account was created (it gets added to /etc/passwd) then this gets that info and creates a QR code for you automatically
Randomizes a file. The opposite of sort is sort -R!
The same with colors
more idiomatic version of the same, using the flip-flop-operator; also printing lines with '//'-style comments