Here are some utilities that I've written out of need. Several of them depend on each other or other common software; dependencies are noted below. Brief descriptions follow; precise documentation, where it exists, is in the programs themselves.
See the individual programs for their licenses; most of them are GPLed, while a couple of trivial ones are placed in the public domain.
The Lua scripts need the stdlib Lua libraries. In general, a POSIX system is assumed; there are likely to be unwitting dependencies on GNU extensions.
repeat (Perl)
Repeat a command a certain number of times.
retcode (sh)
Run a command and print its return code.
rerun (bash)
Run a command with a modified environment. Works with commands found on the PATH
, and with session managers (when your session is restarted, the command will be run again with its modified environment). Useful for running programs with LD_PRELOAD
.
retouch (Perl)
Perform a command, preserving the timestamp of a file.
my (Perl, sh)
Needs mlocate
and GNU grep
Find a file in the user’s home directory. GNU grep is used for colour output when standard output is a terminal. Uses a database created by myupdatedb
.
countdir (Perl)
Counts the number of non-dot files and directories in a directory.
greptype (sh)
Needs find
Grep files of a particular type.
dicgrep (Perl)
Greps the default system dictionary, or that for the given language.
zcat (Perl)
Needs atool
Cat a possibly-compressed file (zcat
only works on compressed files). Does not currently accept any of cat
’s command-line options.
prepend (Perl)
Prepends standard input to the given files.
Soft and hard wrap text.
reverse (sh)
Reverse a file byte-by-byte, using tac
.
random-line (Perl)
Copies a random line from standard input to standard output.
sig (Perl)
A signature-with-random-tagline generator: it appends a random line from ~/.taglines
to ~/.signature
, formats the result nicely and prints it on standard output.
pdf2grayscale (sh)
Needs ImageMagick
Convert a PDF file to grayscale, to avoid wasting colour ink or toner when printing.
lp2 (Perl)
Print files two-sided on a one sided printer by printing the even and then the odd pages. It's set up to work sensibly on my printer (straight paper path, pages come out face down). It works with any file type that CUPS can print.
thumbify (Perl)
Needs Image::ExifTool
Add EXIF thumbnails to images. In practice, this seems to mean JPEGs and PNGs.
counter (Perl)
Maintains a counter in a file: each time counter
is invoked the counter in the file is incremented and the new value output to standard output.
ctime2date and date2ctime (sh)
date2ctime
is by Steve Kinzler
Convert between ctime and date strings.
check-pairs (Python)
Checks that pairs of characters, such as curly quotes, are correctly matched in a text file.