This will drop you into vim to edit all files that contain your grep string.
saves one command. Needs GNU grep though :-(
Does not require input to function or complete. Number of iterations controlled by shell variable $NUM. Show Sample Output
From there, just pkg install the package you need. Show Sample Output
This is really fast :)
time find . -name \*.c | xargs wc -l | tail -1 | awk '{print $1}'
204753
real 0m0.191s
user 0m0.068s
sys 0m0.116s
Show Sample Output
draw `vmstat ` data using gnuplot
Calculating series with awk only, no need for seq: add numbers from 1 to 100
Variations:
1+3+...+(2n-1) = n^2
awk 'BEGIN {for(i=1;i<=19;i+=2)sum+=i}; END {print sum}' /dev/null # displays 100
1/2 + 1/4 + ... = 1
awk 'BEGIN {for(i=1;i<=10;i++)sum+=1/(2**i)}; END {print sum}' /dev/null # displays 0.999023
Show Sample Output
Adds up the total memory used by all Stainless processes: 1 Stainless, 1 StainlessManager and 1 StainlessClient per tab open. Show Sample Output
...or for a particular interface...
Simple MAC adrress, thanks to ifconfig.
I know this has been beaten to death but finding video files using mime types and printing the "hours of video" for each directory is (IMHO) easier to parse than just a single total. Output is in minutes. Among the other niceties is that it omits printing of non-video files/folders PS: Barely managed to fit it within the 255 character limit :D Show Sample Output
I wasn't sure how to display the image, so I thought I'd try xml for a different twist. Show Sample Output
Only need to install Image Magick package.
Display a xkcd comic with its title and save it in /tmp directory
If you prefer to view the newest xkcd, use this command:
wget -q http://xkcd.com/ -O-| sed -n '/<img src="http:\/\/imgs.xkcd.com\/comics/{s/.*\(http:.*\)" t.*/\1/;p}' | awk '{system ("wget -q " $1 " -O- | display -title $(basename " $1") -write /tmp/$(basename " $1")");}'
This command will show you amount of memory used by apache Show Sample Output
Can use lsof, but since it's not part of the base OS, it's not always available. Show Sample Output
Change the number 50 to whatever number of characters you want. Change the character inside the double quotes to whatever you want printed.
My old Solaris server does not have lsof, so I have to use pfiles.
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: