Check These Out
This will calculate a running standard deviation in one pass and should never have the possibility for overflow that can happen with other implementations. I suppose there is a potential for underflow in the corner case where the deltas are small or the values themselves are small.
du -m option to not go across mounts (you usually want to run that command to find what to destroy in that partition)
-a option to also list . files
-k to display in kilobytes
sort -n to sort in numerical order, biggest files last
tail -10 to only display biggest 10
Alternatively, print all the lines that are a certain length:
$awk 'length($0)==12 {print}' your_file_name
I added -S to du so that you don't include /foo/bar/baz.iso in /foo, and change sorts -n to -h so that it can properly sort the human readable sizes.
swap out "80" for your port of interest. Can use port number or named ports e.g. "http"
Queries the specified ethernet device for associated driver information
It's sometimes useful to strip the embedded fonts from a pdf, for importing into something like Inkscape. Be warned, this will increase the size of a pdf substantially.
I tried this with only gs writing with -sDEVICE=pdfwrite but it doesn't seem to work, so I just pipe postscript output to ps2pdf for the same effect.
Replace service --status-all 2>&1 by service --status-all 2>/dev/null to hide all services with the status [ ? ]
I was looking for the fastest way to create a bunch of ansi escapes for use in echo -e commands throughout a lot of my shell scripts. This is what I came up with, and I actually stick that loop command in a function and then just call that at the beginning of my scripts to not clutter the environment with these escape codes, which can wreck havok on my terminal when I'm dumping the environment. More of a cool way to store escape ansi codes in an array. You can echo them like:
$ echo -e "${CC[15]}This text is black on bright green background."
I usually just use with a function:
$ # setup_colors - Adds colors to array CC for global use
$ # 30 - Black, 31 - Red, 32 - Green, 33 - Yellow, 34 - Blue, 35 - Magenta, 36 - Blue/Green, 37 - White, 30/42 - Black on Green '30\;42'
$ function setup_colors(){ declare -ax CC; for i in `seq 0 7`;do ii=$(($i+7));CC[$i]="\033[1;3${i}m";CC[$ii]="\033[0;3${i}m";done;CC[15]="\033[30;42m"; export R='\033[0;00m';export X="\033[1;37m"; };
$ export -f setup_colors
CC[15] has a background of bright green which is why it is separate. R resets everything, and X is my default font of bright white.
$ CC[15]="\033[30;42m"; R=$'\033[0;00m'; X=$'\033[1;37m'
Those are just my favorite colors that I often use in my scripts. You can test which colors by running
$ for i in $(seq 0 $((${#CC[@]} - 1))); do echo -e "${CC[$i]}[$i]\n$R"; done
See: http://www.askapache.com/linux-unix/bash_profile-functions-advanced-shell.html for more usage.