Commands by chickenkiller (2)

  • Uses the fabulous Hpricot library to parse HTML from Ruby. Extracts all elements of "command' class and displays unescaped text from inside these elements. The following command can help install dependencies (apart from Ruby itself) gem sources -a && sudo gem install why-hpricot

    ruby -ropen-uri -e 'require "hpricot";(Hpricot(open(""))/".command").each{|c| puts c.to_plain_text}'
    chickenkiller · 2009-02-16 15:32:58 0
  • This is the simple revision number on stdout, that can be fed to any useful/fun script of yours. Setting LC_ALL is useful if you use another locale, in which case "Revision" is translated and cannot be found. I use this with doxygen to insert my source files revisions into the doc. An example in Doxyfile: FILE_VERSION_FILTER = "function svn_filter { LC_ALL=C svn info $1 | grep Revision | awk '{print $2}'; }; svn_filter" Share your ideas about what to do with the revision number ! Show Sample Output

    LC_ALL=C svn info | grep Revision | awk '{print $2}'
    chickenkiller · 2009-02-16 14:53:52 1

What's this? is the place to record those command-line gems that you return to again and again. 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.

Share Your Commands

Check These Out

Length of longest line of code
Here's an awk version.

nmap port scanning
TCP Connect scanning for localhost and network

find the biggest files recursively, no matter how many
This command will find the biggest files recursively under a certain directory, no matter if they are too many. If you try the regular commands ("find -type f -exec ls -laSr {} +" or "find -type f -print0 | xargs -0 ls -laSr") the sorting won't be correct because of command line arguments limit. This command won't use command line arguments to sort the files and will display the sorted list correctly.

Print Memory Utilization Percentage For a specific process and it's children
Change the name of the process and what is echoed to suit your needs. The brackets around the h in the grep statement cause grep to skip over "grep httpd", it is the equivalent of grep -v grep although more elegant.

replace a character/word/string in a file using vim
Replace all ocurrences in the file. The g option is to replace more than one occurrence in the same line. Whitout the g option, it only replace the first occurrence in the line.

Ctrl+S Ctrl+Q terminal output lock and unlock
These are simple shortcuts to pause and continue terminal output, works in most terminals and screen multiplexers like screen. You can use it to catch something if things change too fast, and scroll with Shift + PgUp PgDown. On linux console ScrollLock can also be used.

Check syntax of all Perl modules or scripts underneath the current directory
Finds all *.p[ml]-files and runs a perl -c on them, checking whether Perl thinks they are syntactically correct

List all symbolic links in current directory
why go through the hard way? use find with -type l

Find usb device in realtime
Using this command you can track a moment when usb device was attached.

take execution time of several commands
The last ; is important. example: time { rm -rf /folder/bar && mkdir -p /folder/bar ; echo "done" ; } command is a bash builtin

Stay in the loop…

Follow the Tweets.

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.


Subscribe to the feeds.

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: