Check These Out
This will remove all blank lines and lines that start with # to use for commented ines (irrespective of where the # starts in the line).
Shows all block devices in a tree with descruptions of what they are.
Now put more interesting stuff on the script in replacement of hostname, even entire functions, etc, and stuff.
hosta> cat myScript.sh
#!/bin/sh
[ $1 == "client" ] && hostname || cat $0 | ssh $1 /bin/sh -s client
hosta> myScript.sh hostb
hostb
hosta>
tstouch takes two arguments: a filename containing a timestamp, and an extended regular expression with the parenthesized section matching a timestamp of the form YYYYMMDDhhmm or YYYYMMDDhhmm.ss.
It then touches the file with that timestamp.
capture 2000 packets and print the top 10 talkers
Rotates log files with "gz"-extension in a directory for 7 days and enumerates the number in file name.
i.e.: logfile.1.gz > logfile.2.gz
I needed this line due to the limitations on AIX Unix systems which do not ship with the rename command.
Add this to .vimrc to automatically give scripts with a shebang (e.g., #!/usr/bin/perl) executable permissions when saving.
Found @ http://stackoverflow.com/questions/817060/creating-executable-files-in-linux/817522#817522
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"
}
Convert some SVG files into PNG using ImageMagick's convert command.
Run the conversions in parallel to save time.
This is safer than robinro's forkbomb approach :-)
xargs runs four processes at a time -P4
This is the setup I'm using for my largest project. It gives 357 lines per page (per side), which makes it fairly easy to carry around a significant amount of code on a few sheets of paper. Try it.
(I stick to the 80 column convention in my coding. For wider code, you'll have to adjust this.)