Below is my collection of highly-useful *ix scripts. All are hereby
placed in the public domain or GPL'd: enjoy, learn and share.
collapse — Collapse
a directory into a gzipped tar file. Requires: bash or ksh,
GNU tar, gzip.
collapse-zip —
Same as the above, except that it creates zip files. Requires:
bash or ksh, Info-Zip.
do-backup — A simple
wrapper around GNU tar to do a basic system backup. This makes
tar work a little more like a PC-type backup program instead of a
general data-archiving tool. Requires: recent GNU tar with bzip2
support. (You could hack the script to remove that requirement
if you wanted.)
firewall-enable and
firewall-disable —
The "enable" script sets up a fairly tight set of firewall rules
for a Linux 2.2 system, including masquerading support. Its
most important feature is that it's very well-commented,
so it's easy to change it to do what you want. The "disable"
script turns off these rules, for debugging purposes. Requires:
Linux 2.2, ipchains.
detab — A wrapper around
expand(1) that replaces the tabs in any set of files in-place
with a series of four spaces. (The number of spaces is, of
course, easy to change.) Useful for preparing a collection of
text files for use by others who may not use your particular tab
preferences. It was used on all these scripts, for example.
dos2unix —
Convert a set of text files in-place to have Unix-style line
endings. Yes, I know that there are a billion other versions of
this script floating around out there, but this one is here for
my convenience: so I can quickly find one that I know works the
way I like.
unix2dos.c — This
is similar to the previous script except it performs the reverse
conversion. It's a C program only because I couldn't think of
a convenient way to write it as a shell script.
is-dos — A small script
that takes a number of files on the command line and detects if
they are DOS text files. Requires: hexdump, below.
hexdump — A wrapper for
od(1) that does hex dumping instead of octal. Works with GNU od,
at least, and may depend on its unique features.
randomize —
This is a set of tools that run a command on a given set of files,
after shuffling the file list. I use these tools for building
random slide shows and playing music files back in random
order. The scripts deal correctly with difficult issues like
quoting filenames with spaces in them. There is no documentation
in the package, but there are four sample wrapper scripts that
show the ways that these tools can be used. Requires: Perl5.
showwait, showlist, and showest — The first script shows
"wait" states on your network connections. I find this useful
mainly for debugging network problems, particularly in programs
I've written. The second two scripts show listening sockets and
established TCP connections.
smash-case — Smashes
all-uppercase filenames to lowercase; this is useful for files
received from MS-DOS machines, and from some CD-ROMs. It can
also be asked to smash mixed-case names to all-lowercase. This
distinction is helpful because you can say "smash-case *" in
a directory and be sure it won't touch files in mixed case,
but it will smash the all-uppercase ones.
faqanntools
— This is a collection of tools for creating FAQ
announcements via Usenet and via mailing lists. It is fairly
rough, and may well not work the way you like. The plus side is
that they're open source and easy to change, so you can make them
work the way you like! Requires: a C++ compiler and Perl5. They
may only build on Linux, but it should be easy to make them work
on any Unix flavor with sockets.
ppp — This is an
archive of my Linux PPP configuration files and scripts. It's
just here for my convenience.