Check These Out
% selects every line in the file. 'd' deletes what's selected. It's a pretty simple combination.
Use GNU/screen as a terminal emulator for anything serial console related.
screen /dev/tty
eg.
screen /dev/ttyS0 9600
MacOSX: http://www.macosxhints.com/article.php?story=20061109133825654
Cheat Sheet: http://www.catonmat.net/blog/screen-terminal-emulator-cheat-sheet/
you could save the code between if and fi to a shell script named smiley.sh with the first argument as and then do a smiley.sh to see if the command succeeded. a bit needless but who cares ;)
With this command you can convert a tab separate file (TSV) into a JSON file with jq.
For example, this input.tsv
i-0b9adca882e5e6326 172.16.0.188
i-088dd69e5c3624888 172.16.0.102
i-0e70eac180537d4aa 172.16.0.85
will produce the showed output.
The coolest way I've found to backup a wordpress mysql database using encryption, and using local variables created directly from the wp-config.php file so that you don't have to type them- which would allow someone sniffing your terminal or viewing your shell history to see your info.
I use a variation of this for my servers that have hundreds of wordpress installs and databases by using a find command for the wp-config.php file and passing that through xargs to my function.
To learn more about Google Ngram Viewer: http://ngrams.googlelabs.com/info
-R, -r, --recursive
Read all files under each directory, recursively; this is equivalent to the -d recurse option.
Next time you are leaching off of someone else's wifi use this command before you start your bittorrent ...for legitimate files only of course.
It creates a hexidecimal string using md5sum from the first few lines of /dev/urandom and splices it into the proper MAC address format. Then it changes your MAC and resets your wireless (wlan0:0).
Converts any number of seconds into days, hours, minutes and seconds.
sec2dhms() {
declare -i SS="$1"
D=$(( SS / 86400 ))
H=$(( SS % 86400 / 3600 ))
M=$(( SS % 3600 / 60 ))
S=$(( SS % 60 ))
[ "$D" -gt 0 ] && echo -n "${D}:"
[ "$H" -gt 0 ] && printf "%02g:" "$H"
printf "%02g:%02g\n" "$M" "$S"
}