This of course assumes that lesspipe is installed. You can view the contents of many, many types of files in this way. Once lesspipe is installed, add to your .bashrc export LESSOPEN="| /usr/bin/lesspipe %s" less file.jar export LESSCLOSE="/usr/bin/lesspipe %s %s" or eval "$(lesspipe)"
Output made so that it will match initial suggestion for this task. Personally, I think that output of du -h is more readable.
6 characters counting whitespace!
Creates a directory and then cds into it directly Show Sample Output
Will run COMMAND with arguments from the previous command
cat /etc/resolv.conf
then you wanted to edit the file
vim !$
Avoids the nested 'find' commands but doesn't seem to run any faster than syssyphus's solution.
Updated to the new version of the MW webpage (seems MW does not use cougar anymore, so the other commands do not work nowadays), and using Xidel to parse the page with a html parser instead regex.
Example usage:
pronounce onomatopoetic
I'm not sure how well Xidel works with binary streams (although it seems to work great in tests), so using wget to download the actual wav file might be safer, i.e.:
pronounce(){ wget -qO- $(xidel "http://www.m-w.com/dictionary/$*" -f "replace(css('.au')[1]/@onclick,\".*'([^']+)', *'([^']+)'.*\", '/audio.php?file=\$1&word=\$2')" -e 'css("embed")[1]/@src') | aplay -q;}
Xidel is not a standard cli tool and has to be downloaded from xidel.sourceforge.net
clush (cluster sh) is a very powerful tool to perform this kind of tests. The [a-b] syntax is expanded by clush. You can also play with names: cn[001-010] expands to cn001, cn002, cn003 .. cn010. Note that does not expands to cn1, cn2, etc., which is very useful, cause normally servers are named cn001, cn002... cn100
You can create a backup of a directory which does not contain disturbing .svn and similar directories with that command.
perl version of "Wait for file to stop changing" When "FileName" has not been changed for last 10 seconds, then print "DONE" "10" in "(stat)[10]" means ctime. One have other options like atime, mtime and others. http://perldoc.perl.org/functions/stat.html
to kill, use `kill PID` Credit: user Craig Ringer on stackexchange.com, recommends to kill the process rather than deleting postmaster.pid when there is an orphan Postgresql server process. Show Sample Output
Might not work if your devices is older than Lollipop (5.0). Verified on macOS, and most likely work on Linux as well.
That one works on Linux. On BSD and Solaris, the ifconfig output is much easier to parse:
/sbin/ifconfig -a | awk '/inet/{print $2}'
Same thing, only "head" instead of grep/egrep.. Show Sample Output
// This is description for the old command:
Unfortunately we to encode the URL.
It can't be done with bash (without building it ourselves) so I used Perl?
Example with Perl:
curl -s http://is.gd/api.php?longurl=`perl -MURI::Escape -e "print uri_escape('http://www.google.com/search?hl=en&source=hp&q=commandlinefu&aq=0&oq=commandline');"`
Example without Perl:
curl http://is.gd/api.php?longurl=http://www.google.com
Most urls doesn't use & and ? anymore (SEO etc) so in most cases you can just use the simple version. :)
Show Sample Output
Changed out the for loop for an xargs. It's a tad shorter, and a tad cleaner.
Prints movie length in H:MM:SS format with appropriate leading zeros. Show Sample Output
commandlinefu.com 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.
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.
» http://twitter.com/commandlinefu
» http://twitter.com/commandlinefu3
» http://twitter.com/commandlinefu10
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: