Shell Tools Page - Utilities for the Unix environment

Malcolm Carlock / http://malcolm.carlock.com


bd
Copy a file to the same name but with date/time stamp appended
brip

Bulk IP lookups
fff  ffl fffn
Quick file-find commands with unquoted wildcards
fromhost
Check which host or DISPLAY we're logged in from
myxkm
Apply custom X11 keymap for this user, if defined - requires fromhost
nss
Create a new shell script skeleton that already contains common structures and comment blocks
pc
Simple TCP port-checker for one or more ports and hosts - requires nc (netcat)
tzls  tzx
Quick Unix archive file content list and unpack
Portable .profile .kshrc .bashrc
Portable Unix dot-files that work on various platforms including Cygwin and MKS

bd
click to view/download

Backup with Date appended.  Copy the specified file(s) to the same name, but with a textual date/time appended down to the current second.  The filesystem date/time stamp for the original file is preserved.

Usage:  bd file [ file .. ]

Example:  bd foo.txt   results in   foo.txt.2004-02-11-202410

brip
click to view/download

Bulk / stream Resolution of IP addresses and hostnames
  • Resolve IP addresses and/or hostnames in bulk
  • Can read from STDIN, commandline or file
  • Can be used for quick commandline lookups, like host, dig and nslookup
  • Automatically detects which of the three is on your system, and uses whichever is available, in that order of preference
Usage:  brip [ options ] [ { hostname | ipaddress } ]

Detailed information regarding options can be viewed within
brip itself
fff, ffl and fffn
click to view/download

Quick, case-insensitive file-find with unquoted wildcards.  Options to find(1) can be appended if desired.

Usage:

fff *some*pattern* [ *some*pattern* .. ] [ -{find-options} ]
find matching files/directories etc that match *some*pattern*, displaying the full path, one match per line

ffl *some*pattern* [ *some*pattern* .. ] [ -{find-options} ]
same as above, but displaying relative paths

fffn *some*pattern* [ *some*pattern* .. ] [ -{find-options} ]
same as fff, but displaying SSH-formatted network paths, one per file or directory


For an fff command at a WinNT/XP/Win2K DOS/CMD prompt, run the following command to create an fff "alias".  Sorry, no ffl or fffn capability or find(1) options.
doskey fff=dir/s/b/on $*

fromhost
click to view/download

Display the client host or X11 display on which this command runs.  If DISPLAY is blank, or the command is running on the local host, nothing is displayed.

Usage:  fromhost

myxkm
click to view/download

Set a custom X11 keymap for this user, if one is defined, based on the host on which this script runs, OR the remote host if it is run under a remote shell.  Depends on the fromhost command.

Usage:  myxkm

nss
click to view/download

New (Bourne) Shell Script.  Creates a skeletal shell script containing:
  • Error-handling functions
  • Signal handling (trap settings)
  • Customisable commandline parsing
  • A comment-block at the top, reminding the programmer of various bits of useful documentary info that are nice to have in the script

Usage:  nss scriptname

pc
click to view/download

A simple TCP port checker that wraps nc (netcat) for simple operations.

Usage: 
pc portnum[,portnum[..]] [host[,host[..]]

Examples:

pc 22,80,443 localhost,luna,www.verizon.net             results in:

localhost       22      OK
localhost       80      OK
localhost       443     FAILED (no response)
luna            22      OK
luna            80      FAILED (no response)
luna            443     FAILED (no response)
www.verizon.net 22      FAILED (no response)
www.verizon.net 80      OK
www.verizon.net 443     OK

pc 22               results in:

localhost       22      OK

tzls and tzx
click to view/download

Quick extraction and content-listing for the following archive and compression types:
tar
bzip2 (bz2)
cpio
gnu zip (gz)
zip, rar, arj
compress (Z)
Usage:
tzls [ -v ] filename  list contents
tzx [ -v ] filename unpack into current directory
 
Portable .profile and .kshrc files, usable with ksh/bash, under Unix, Cygwin or MKS
click to view/download

Usage:
  1. Save the .profile and .kshrc files into your home directory (after backing up the ones you have, if any)  Also install this stub .bashrc.
  2. ln -s .bashrc .bash_profile
  3. Log in using bash or ksh


Powered by WebRing.