These are Bash script “snippets” that are useful or interesting, and that we felt should be made freely available rather than being locked up in our proprietary scripts. A quick and easy way to add ANSI colors to shell scripts. Make an HP LaserJet network printer say arbitrary things on the front LCD. Used occasionally on our HP LaserJet 4000 to make the status screen read “FEED ME A CAT” We keep a big archive of source code files for all the programs needed to build a complete Linux system. That requires lots of gigabytes of disk space, and programs are often distributed in space-inefficient formats like gzip. This script, when run in the root directory of such an archive, recursively converts all .tar.{lzo,gz,bz2,lzma} files to .tar.xz format with maximum compression for more efficient storage. A Bash function that enables multiprocessing in limited scenarios. We use this to unpack one archive per CPU core at a time and to process a couple of text files per core in a huge directory of text files. Add this function to the start of your script, then call “dispatch [command] [arguments] and this function will handle the forking for you. If you need the dispatched commands to complete at any point later in your script, run “wait $(jobs -p)” and the forked processes will complete before the script continues. and If you create a chroot environment under a directory, you can run these scripts while in that chroot directory to perform the proper mount and unmount commands needed to make that system work better. A quick and ugly hack to convert Pidgin HTML-formatted log files to Pidgin text log files. Run inside a software source code archive (see convert_all_to_xz above) to see probable duplicated programs, even if the version numbers differ. Before we knew the ‘pv’ progress viewer utility existed, this is how we would test a hard drive and get a progress meter for the process. We haven’t used it in years, and it is presented here in the hopes that someone will find it to be useful.