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.
dayago.tgz
dayago.zip
perl script
tgz:1236
zip:1270
2012-12-07
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:875
zip:1022
2009-06-09
Run command in prompted loop
Useful as a frontend to (for example) xterm, so when the command die 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.
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 sequential, but at the start and mid-point, ending at the mid-point and the end.
By default it is also in read-only mode, use the -w option to write over your disk, but without the -n option, it will read back the data written and compare it.
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:534
zip:547
2003-04-15
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 libaries (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.
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 or a VPN) will feel like (far better than ping can).
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!
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:4440
zip:4636
2013-06-18
Remove command - with secure option
There is also "srm" out there, but it has fewer options (and I wrote this one years ago).
Uses your choice of Gutmann Method of a 35 pass sequence of bit patterns, or 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 step ending with 00), an even shorter version with 25 passes, or just the zero file (ie 1 pass), before 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 more and more passes makes it slower and 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.
sleep.tgz
sleep.zip
C source
tgz:1679
zip:1676
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 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:427
zip:1592
2012-02-08
Display superlative value
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.
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.
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). It can even listen on 2 ports as a strange backwards port forwarder, for those times when you want to startup a TCP connection but from the remote end (eg through a firewall).
It can handle 3 (or more) way connections, but it's a bit hokey.
In loop mode, it's a one port inetd.
It is only TCP though.
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.
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:804
zip:806
2003-03-08
Securely erase disk freespace
A script using my "rm" code (above) and creates big files until the disk is full, and then erases them securely.
End result your disk freespace is securely erased.
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)