Bryan Dongray's
UNIX & DOS tools
C, shell, perl

(all free to download)
 
Source Download size
Last update
Description
blksync.tgz
blksync.zip
perl script
tgz:1313
zip:1346
2013-04-12
Block compare or sync two files
Only really useful to sync a BIG file where read is significantly faster than write (such as on USB device), as the only changed blocks are overwritten. Not generally useful for copying files with a very large number of differences, as it reads both files, compares, and writes when necessary.
Default is read-only mode (just reporting number of blocks different), this is useful (like a block level "cmp").
However, some people have said that:
•   rsync --inplace --no-whole-file <SRC> <DST>
should do the same optimized writing only what changed (see the rsync delta-transmission algorithm), but it turns out the rsync algorithm runs about 50% slower than what might be considered a brute-force compare and copy (as blksync does). But rsync is definitely faster than a copy of the entire file.
Also, users on Windows machines probably don't have rsync, but may have perl.
byte.tgz
byte.zip
C source
tgz:2368
zip:2542
1995-10-18
Binary edit/view file
Opens a file to edit bytes in place (although can be used to append bytes).
Useful for modifying/viewing a binary file.
colsort.tgz
colsort.zip
C source
tgz:1394
zip:1431
1988-03-11
colsort
Each input line has its columns sorted.
Separator can be specified, also numeric and reverse sort options, and output to a file (which can be the same as an input file)
dayago.tgz
dayago.zip
perl script
tgz:1245
zip:1280
2014-01-10
Find out how long ago a date was (or will be)
Converts date YYYY-MM-DD (or YYYY/MM/DD, and can handle obvious DD/MM/YY or MM/DD/YY) into how many days ago (or "will be" as a negative number).
Also given a number of days ago returns when was date was (or "will be" - if a negative number).
dexit.tgz
dexit.zip
sh script & C program
tgz:888
zip:1035
2013-06-28
Run command in prompted loop
Useful as a frontend to (for example) xterm, so when the command dies that is running in an xterm window, you can still see the error - and optionally re-run it just by pressing return, or change the command via CTRL+C. I use it for my ssh sessions.
Requires C program (provided) which runs subprocess giving back default interrupts, without interrups affecting current process.
diskseek.tgz
diskseek.zip
C source
tgz:1862
zip:1868
2010-07-13
Disk seeking/testing
Has a few different options to sequentually go from one end of a disk (or file) to the other, or it can start at both ends moving the offset closer to the middle, or it can randomly skip around the disk.
The default is to go "dual sequential", alternating writes at starting and the mid-point, ending at the mid-point and the end.
By default is in read-only mode, use the -w option to write over your disk, add -n option to not verify data written.
It does its best to be synchronous, but sometimes you need the -o option to close and open the disk after each write, especially when using raw devices.
easter.tgz
easter.zip
C source
tgz:873
zip:860
1995-12-15
Work out Easter day
It's been accurate every year so far.
I found the algorithm in the mid 1970's, coded it in Basic on an ancient home computer, and it worked. Since then it got coded into C - as seen here.
fakeftp.tgz
fakeftp.zip
sh source
tgz:472
zip:507
2009-02-19
Fake FTP server
Does what you expect from an FTP server, except never logs anyone in.
Useful when you need to appear like you have a working FTP server, but don't want one really!
Add a xinetd.d ftp file, eg:
service ftp
{
  socket_type = stream
  wait = no
  user = nobody
  server = /usr/local/etc/fakeftp
}

and restart (or signal a HUP to) your xinetd.
fields.tgz
fields.zip
perl source
tgz:1266
zip:1292
2005-01-27
parse fields in input
An input stream of the format:
Identifier na=va nb=vb nc=vc ...
can be trimmed down to just view named fields requested.
Handles quotation on input, and provides as necessary on output.
gethost.tgz
gethost.zip
perl source
tgz:620
zip:657
2013-12-04
Lookup hostname or IP
A bit like "nslookup" or "dig", although much much simpler, without any extra features, but importantly it does not use any DNS backdoors to get its results, it just uses standard libraries (most code does) to lookup hostnames or IPs.
Output looks like a normal hosts file.
Handles multiple results returned in an expected way.
hdr.tgz
hdr.zip
perl source
tgz:326
zip:331
2003-04-23
Show/remove email/web headers
Very simple, but useful as a pipe command to only see headers, or to strip off headers of messages or HTML protocol conversations.
killtree.tgz
killtree.zip
perl source
tgz:922
zip:956
2009-01-22
kill process and children
Kill PID, but also any children, and any children's children, etc.
latency.tgz
latency.zip
C source
tgz:3254
zip:3400
2002-09-14
Test network latency
Uses the "echo" port (port 7) to send (and time) a byte going to a remote host... and back. It gives a real sense of how long an interactive session (eg over ssh, including port forwarders, or a VPN) will feel like (far better than ping can).
If port 7 is off, use thru (on this page) as a looped listener (on a high port number), eg:
  remote% thru -p :9007 /bin/cat
local% latency remote:9007
(or other port numbers or hosts, if you're testing over a ssh tunnel)
mkpass.tgz
mkpass.zip
perl source
tgz:556
zip:554
2003-07-11
make crypt'd password
(for UNIX and webservers)
Useful to make htpasswd files for Apache.
parallel.tgz
parallel.zip
perl source
tgz:1866
zip:2040
2008-12-16
Run command in parallel
Like xargs, but runs one command with each stdin line (as arg to command), but (unlike xargs) runs those commands in parallel (as parallel as requested). As one finishes it will start another, keeping up the parallelism.
Useful for pushing files out in parallel, or running remote commands (or ping) to many remote systems (if input is list of hostnames).
Useful on multi-cpu machines to run parallel compute intensive commands, on given input values.
There is the -a option to allow a given number of stdin lines per parallel command.
Hint: Use $PARALLELID for unique ID (eg tmp file identifier to stop parallel writing to the same output file, then cat/sort those tmp files into one)
Included is a "pingall" script showing how to quickly ping all systems on your local network.
Be careful with this code, you can flood your own system!
Update: xargs now has the ability to run commands in parallel (but no PARALLELID environment variable given, use $$):
xargs -Pparallelism -r -n1 -d'\n' CMD ARGS...
pos.tgz
pos.zip
C source
tgz:1020
zip:1175
2002-08-22
Find position of text in binary file
Simple text searching in any file (or raw disk), but missing "backtracking" - sorry.
rand.tgz
rand.zip
perl source
tgz:477
zip:955
2003-04-15
Random number
As every high school student gets to write.
rm.tgz
rm.zip
C source
tgz:4550
zip:4748
2014-01-12
Remove command - with secure option
There is also "srm" out there, but it has fewer options (and I wrote this one years before "srm" existed). Also there is "shred", but it's not a good replacement for "rm".
This version your choice of either the Gutmann Method of a 35 pass sequence of bit patterns (which can takes hours, and is considered overkill), a slightly shorter version with 30 passes (without repeated random passes, and the sequence 00 to ff is reordered so that as many bits change as possible on each overwrite step, ending with 00), and a shorter version with 25 passes, or just to zero the file (ie 1 pass), before the actual (optional) remove.
Use very verbose mode to see each sequence being written. The passes are there to really erase a file and hide the magnetic pattern on various types of disk, but be warned that more overwrite passes will make deletion much slower.
Note: With secure options, the files and directories are renamed, file times, permissions, and owner (if possible) are all changed multiple times to random values, which REALLY hides all details of the file you want to "shred" securely.
The "-o" option is just to overwrite the file (useful for devices - ie to not delete the device).
sleep.tgz
sleep.zip
C source
tgz:1654
zip:1687
2002-11-10
Fully featured sleep command
Allows the use of subsecond values, the ability to give time in hours and minutes (and days), or combinations, and allows to sleep to a specific time of day.
So you can sleep for 1h 30m, or until 01:23:45 (without having to calculate number of seconds).
It can also be told to sleep forever (without putting lots of 9's).
Is compatible with normal sleep command.
Update: Linux default sleep can now do most of this.
sparse.tgz
sparse.zip
perl source
tgz:1019
zip:1015
2005-04-21
Format columns into a table
Convert a column of pairs of values, into a CSV (or table).
eg
INPUT:
A,1
B,2
A,3
B,3
OUTPUT:
,1,2,3
A,Y,,Y
B,,Y,Y
When formatted:
123
AYY
BYY
There is an optional 3rd column as the value to show in the output, instead of "Y".
superlative.tgz
superlative.zip
sh script
tgz:746
zip:2728
2014-01-09
Display superlative values
Script to search given files and/or folders (recursively) for the oldest, newest, smallest or biggest.
syncup.tgz
syncup.zip
perl source
tgz:3147
zip:3142
2012-06-22
directory synchronization
Sync two directories by creating, copying, deleting, setting times, owner and attributes of any files, directories, and symbolic links in the destination that were added, changed, or deleted in the source tree.
Perl enables the code to work for UNIX and DOS, but under UNIX and cygwin rsync does the same job.
tai64ntools.tgz
tai64ntools.zip
C source
tgz:7030
zip:15434
2012-07-11
TAI64n timestamps
Based on daemontools v0.7.6 from D. J. Bernstein but with other UNIX specific tools removed to only have:
• tai64n prepend every line with TAI64N timestamp
• tai64nlocal convert TAI64N timestamp on each line into human readable form (local timezone)
• tai64ngmt convert TAI64N timestamp on each line into human readable form (GMT aka UTC)
Tested under various Linux systems and cygwin.
tcpviawebproxy.tgz
tcpviawebproxy.zip
perl source
tgz:2682
zip:2690
2014-03-10
Port forwarding via webproxy
Needed for a TCP connection but only had a webproxy to go through. It listens on any given port, connects to the given webproxy, sending necessary startup sequence (giving authentication if necessary), and eats returned header from the webproxy, leaving a two-way TCP traffic with the remote host/port but via the webproxy.
It can be set in "loop mode", where multiple sessions can happen.
thru.tgz
thru.zip
C source
tgz:5421
zip:5417
2003-02-04
Network forwarding/listening
Written years ago, and is sort of similar to the more recent popular program "netcat", and the very recent "socat" code, although this code only handles TCP connections.
This program can listen on a port as well as send to remote port, to/from a local file or program, but can do both at the same time (a port forwarder). However, it can listen on 2 ports (if necessary) as a backwards port forwarder, for those times when you want to initiate a TCP connection from an external site, through a firewall, but the process inside the firewall ACTUALLY has to do the initiated TCP session, eg:
  external% thru :9999 :9022 &
internal% thru external:9999 localhost:22
external% ssh -p9022 user@localhost
will allow external host to ssh to internal host as long as the internal host can initiate a TCP connection to port 9999 (in this example), eg through a firewall.
Hint: If you only have a webproxy through a firewall then use tcpviawebproxy found at this site.
It can handle 3 (or more) way connections, but it's a bit hokey.
In loop (or parallel) mode, it's a one port inetd.
timeout.tgz
timeout.zip
C & perl source
tgz:2065
zip:2457
2003-03-08
Timeout command
A way to run a command and have it stop after a specified time. I found it useful for scripted "rsh" (or ssh) commands.
unsort.tgz
unsort.zip
perl source
tgz:298
zip:336
2013-09-18
unsort
Unsorts (aka randomizes) its input.
Takes STDIN or files, no options.
Your system may be able to use "sort -R"
up.tgz
up.zip
sh script
tgz:2540
zip:2565
2014-03-05
Check remote is host up
Uses ping (although optional) and optionally by connecting to a given port (or list of ports).
Can check remote hosts concurrently, and optionally loop (eg when waiting for remote hosts to reboot).
Tested on cygwin and Linux.
Recommended you download parallel and gethost (both available on this page).
uu.tgz
uu.zip
perl source
tgz:688
zip:1016
2003-07-12
Decode UUencoded
uuencode still exists and needs a manual way to read (or write) such a format.
Also useful to encode/decode "basic encryption" of web authenication.
wipefree.tgz
wipefree.zip
sh script
tgz:744
zip:764
2014-03-17
Securely erase disk freespace
A script creates big files until the disk is full, and then erases them securely via "shred".
End result your disk freespace is securely erased.
Use srm if you prefer, but edit the wipefree script to use that deletion method instead of "shred".
x10cmd.tgz
x10cmd.zip
C source
sh script
tgz:2195
zip:2381
2009-12-13
Control X10 firecracker
Linux program (set SUID root) to control the x10 firecracker, an RS232 serial device which can control upto 256 power outlets.
Also a simple queueing system so no x10cmd commands conflict (eg if via cron, etc).

DongraysBryan Dongray → UNIX/C/Shell/Perl/DOS tools Powered by Linux Validated by HTML Validator (based on Tidy)