The Command Line Utilities version 2.2 comprises a suite of native Pure 32-bit OS/2 commands that provide many useful abilities to the OS/2 user, as well as improved 32-bit versions of several of the 16-bit commands that are supplied with IBM OS/2 itself that allow one to remove more of the 16-bit vestiges that remain in OS/2 Warp.
They are "command line" utilities because they can all be driven from the command line, making them suitable for use in command scripts ("batch files"). However, the Command Line Utilities comprises a mixture of textual and graphical programs.
The Command Line Utilities have several features:
Pure 32-bit code. The utilities contain no 16-bit code whatsoever, and use no 16-bit OS/2 subsystems. They are designed to always use the native paradigms of 32-bit OS/2 whereever possible, and to operate in a way that takes best advantage of the way that 32-bit OS/2 works and 32-bit OS/2 features. For example, they make use of 32-bit OS/2's ability to scan directories efficiently, handling multiple directory entries in a single system call.
No Year 2000 problem, and no Year 2100 problem either. All of the utilities that deal with dates are fully capable of handling dates beyond the year 2000, beyond the year 2038 -- which is the "drop dead" date for much 32-bit C and C++ code --, and right up to the year 5879615, in fact.
Ironically, this ability in the touch
and
xdir
commands has revealed two Year 2100 bugs in OS/2's
own FAT and HPFS filesystem drivers!
No century bugs. All of the utilities that deal with dates and times can use the ISO 8601 standard date and time representation, which uses an unambiguous format with a 4-digit year, in order to avoid the inherent ambiguity in the "national" date formats for the first 31 years of the 21st century (e.g. 01/02/03).
Standard-conformant timezone support.
The saydate
, setdate
, anaclock
,
digclock
, touch
, and unstamp
commands understand the timezone information supplied in the TZ
environment variable, using the standard POSIX (ISO/IEC 9445-1:1990)
syntax, and can operate in any timezone, in either hemisphere, with
daylight savings time changes happening automatically without manual
user intervention.
Different commands can thus be run in different timezones. So one
could have, if one wanted, multiple instances of digclock
running on the desktop at the same time, all operating in different
timezones and with different daylight savings time rules. A fully
configurable and extensible "world clock"!
Enhanced wildcards. All of the utilities that deal with files support extended wildcards, which are a superset of the standard OS/2 wildcard syntax, similar to the wildcards that are available in most UNIX shells.
For example:
[c:\]attrib +r *.{zip,arj,rar,lzh,tar.gz}
and
[c:\]xdir [a-c]*
and
[c:\]dump /s *.{su,mo,tu,we,th,fr,sa}[0-9]
Elimination of 16-bit vestiges remaining in IBM OS/2 even today.
Several of the utilities are 32-bit program or REXX script
replacements for commands supplied with OS/2 itself that are
still, even in OS/2 Warp version 4, 16-bit programs or batch
files, such as attrib
, comp
,
find
, help
, sort
, and
tree
.
Needless to say, many of the uglier "features" of the OS/2-supplied commands have been removed.
sort
command can sort files
named on the command line as well as its standard input, and can sort
files that are greater than 64KiB in size.
comp
command can be used in a batch
file with ease, because it doesn't insist upon being interactive.
find
command supports regular
expressions and the ability to be used in a command pipeline.
help
command can be configured to
search different on-line books by default and won't destroy a
customised command prompt if one turns help on and off.
tree
command, unlike IBM's
tree
supplied with IBM OS/2, actually displays a
tree!
No more arbitrary 16-bit limits. All utilities are limited only by available virtual memory.
For example: Commands are not upset by very large directories.
The dir
command in IBM's cmd
, the
default command interpreter supplied with IBM OS/2, refuses to sort a
directory listing containing more than 2073 files. The
dir
command in JP Software's 4OS2 fails when the directory
size reaches a more respectable 20,000 files. But the
xdir
command was able, in testing, to sort a directory
listing of 100,000 files, and even that didn't reach its limit. (I
just ran out of enthusiasm to go any higher. (-:)
Standard options across many commands. For example: All of the utilities support the /? option for obtaining help; and the /S option means "operate recursively on an entire directory tree" in all commands that manipulate files.
Full on-line help in the standard OS/2 INF book file format.
Filter commands, usable in command pipelines.
The dump
, find
, grep
,
sort
, strings
, sum
,
tee
, textconv
, wc
,
what
, and y
commands can be used as filter
commands, for use in a command pipeline, acting upon what they receive
from their standard input, and producing results on their standard
output.
Coloured directory listings.
The arcdir
, attrib
, convcase
,
dellname
, delthumb
, ff,
finddups
, fitsize,
touch
,
tree
, which
, xdel
, and
xdir
commands can produce file and directory listings in
colour, taking the colouring rules from the DIR_COLOURS
environment
variable.
Localisation support.
All of the utilities can display the date and time in the format
appropriate to the current setting given for COUNTRY
in
CONFIG.SYS
. They also use OS/2's system message file for
the text of error messages, and so will display system error messages
in the local language.
No silly restrictions on filename syntax. All of the utilities that deal with files fully support long filenames, filenames with embedded spaces and multiple full stops, and deep directory trees. The utilities do not make the assumption that names contain drive letters, and so can deal perfectly happily with names in the Universal Naming Convention format.
(Indeed, the tree
command was added to the Command
Line Utilities in version 2.0 because one of the popular
tree
utilities for OS/2 couldn't handle the
C:\OS2\ARCHIVES
directory tree and would always crash
because it was too deep!)
For example:
[c:\]ff /s/e \\server\sharename\*.txt
and
[c:\]xdir \\server\sharename\*.{exe,com,cmd}
Support for booting into text mode. All of the text-mode utilities can be used when OS/2 is booted to text mode, such as when it is booted from floppy disc.
Handy REXX functions. Also included is a DLL containing a suite of REXX external functions, for use in REXX scripts, that are aware of the TZ environment variable and that handle it correctly, allowing one to
DATE()
and TIME()
function to obtain the date and time in the
local "short" form (which REXX provides no built-in mechanism for
doing).
Here are the individual utilities:
anaclock
is a simple Presentation Manager analogue
clock program, with full support for timezones and automatic (and
effortless) switching to and from daylight savings time.
arcstamp
modifies the timestamp of archive files
to match the latest modification date of the files in the archive. It
performs the same function as the -o
option to
zip
or the /ZIPDATE
option to
pkzip
, except that it supports multiple archive types with
one uniform command syntax, can restrict the timestamp processing to
particular files within the archive that match given wildcards, and can
stamp multiple archive files that match a particular wildcard, optionally
recursing into subdirectories to find them.
arcdir
displays the contents of archives. It
performs much the same function as the l
or
-view
option to many archiving tools, except that one tool
supports multiple archive types with one uniform command syntax, can list
files within the archive matching particular wildcards, can sort the
listing, and can even produce a single (sorted) list of the contents of
multiple archive files that match a particular wildcard, optionally
recursing into subdirectories to find them.
attrib
is an enhanced, 32-bit, replacement for
IBM's 16-bit attrib
command. It includes, amongst other enhancements,
extended wildcards, the ability to include and exclude files by attribute,
and the ability to modify the attributes of subdirectories as well as
files.
bcomp
is a simple binary byte-for-byte comparison of two files.
calctz
is a Presentation Manager utility to help calculate the
TZ environment variable string for any given timezone and daylight savings
time rules. Unlike other TZ calculators, this command calculates a TZ
string that is in the standard POSIX 1003.1 (ISO/IEC 9445-1:1990) format.
comp
is an enhanced, 32-bit, replacement for OS/2's 16-bit
COMP command. It doesn't prompt the user, so can be used in command
scripts, and has a more compact output format so that differences are
easier to spot. It can also recurse into subdirectories to compare entire
directory trees; and it supports extended wildcards.
convcase
renames filenames to upper, lower, or mixed case,
which is handy in those situations where other programs insist upon
creating all-uppercase or all-lowercase filenames. It supports the
standard CLU features of recursing into subdirectories,
including/excluding files by attribute, and extended wildcards.
cpuidg
is a Presentation Manager program to display the
information obtained about the CPU by the CPUID instruction, including the
various AMD and Cyrix extensions.
cpuidt
is a text-mode program to display the information
obtained about the CPU by the CPUID instruction, including the various AMD
and Cyrix extensions.
cyclog
is a daemon that logs whatever it receives on its
input to a set of log files, keeping a cap on the space that they consume by
recycling the oldest logs.
deltree
is a REXX wrapper script for the
xdel
command that behaves much like the deltree
command in MS-DOS and DR-DOS does.
dellname
removes the long names that are stored in the
extended attributes of files and directories by Workplace Shell programs.
It supports the standard CLU features of recursing into subdirectories,
including/excluding files by attribute, and extended wildcards.
delthumb
removes the thubmnail icon images that are stored
in the extended attributes of files and directories by some programs. It
supports the standard CLU features of recursing into subdirectories,
including/excluding files by attribute, and extended wildcards.
descedit
is a Presentation Manager program to display the
descriptions for files and directories store in extended attributes, and
to allow them to be easily modified. It supports the standard CLU
features of recursing into subdirectories, including/excluding files by
attribute, and extended wildcards.
digclock
is a simple Presentation Manager digital clock
program, with a fully configurable display format and full support for
timezones and automatic (and effortless) switching to and from daylight
savings time.
dirsize
displays the sizes of directories, much like the GNU
`du' command does, but with the standard CLU features such as enhanced
wildcards and the ability to include/exclude files by attribute, and with
the same simple, consistent, PC-style, interface of the other utilities
that should be familiar to OS/2 users. It also displays the actual true
"allocated space" figures when used on large FAT volumes.
dump
dumps the contents of many types of file, including the
popular ARC, ARJ, LZH, RAR, ZIP, and ZOO archive file formats, PKT files
(used for mail transfer on Fidonet), executable and DLL files, and Intel
object module files (OBJ and LIB files).
dupdir
brings a target directory into synchronisation with a
source directory by copying new or newer files and deleting files that no
longer exist. Supports recursing into subdirectories, so that entire
directory trees can be synchronised, and the standard CLU features such
as enhanced wildcards and the ability to include/exclude files by
attribute.
enstamp
is a filter that prepends encoded
timestamps, of the form used in log files and suitable for decoding with
unstamp
, to each line of its input.
It supports the standard CLU features of extended wildcards, inclusion and
exclusion of files by attributes, and recursion into subdirectories.
ff
is a versatile yet simple and fast file finder, that is also
capable of locating files that are contained within ARC, ARJ, LZH, RAR,
ZIP, and ZOO archives. It supports the standard CLU features of
recursing into subdirectories, including/excluding files by attribute, and
extended wildcards.
find
is a REXX wrapper for the
grep
command that can replace
OS/2's 16-bit find
command, searching for lines in text files that contain
a given string. It has the standard CLU features of being able to
operate recursively on files in subdirectories and include/exclude files
by attribute. It can also has a "brief" display format, and the ability
to display counts of the number of lines found.
finddups
locates files that are exact duplicates of one
another, even if they have different names and timestamps. It supports
the standard CLU features of recursing into subdirectories,
including/excluding files by attribute, and extended wildcards.
fitsize
groups files into bundles that don't exceed a given
total size. It is useful for burning CD-ROMs, or collecting files onto
LS-120 super-floppy discs.
grep
finds lines that match a given pattern in text
files, much like the GNU egrep
command, but with the standard
CLU features. It implements almost the entire POSIX "extended" regular
expression syntax -- far more than most other grep utilities, which
usually only provide the POSIX "basic" syntax.
head
outputs the first few lines of its input, which can
either be a number of files specified on its command line or its standard
input. It supports the standard CLU features of recursing into
subdirectories, including/excluding files by attribute, and extended
wildcards.
help
is an enhanced, REXX, replacement for OS/2's
HELP command (which is a "batch file"). It won't upset customised
PROMPT
strings, and doesn't require the 16-bit
HELPMSG
program in order to function. It also allows the
command reference on-line book that is used by default to be configured
via the CMDREF
environment variable.
It is also useful as a replacement for the help command that is built in to JP Software's Take Command for OS/2, which doesn't work too well.
mem
displays various memory usage statistics
maintained by the operating system, along with the size of the current
environment area.
newmbr
writes a new Master Boot Record, enabling
enhanced features in one boot manager, to a partitionable disc.
partlist
displays the entire, unmodified, contents
of the partition table on one or all of the available partitionable disc
devices, including the partition names. Unlike FDISK /QUERY
,
the partition table is displayed in raw uninterpreted form, with the
partition sizes displayed in numbers of sectors, rather than being
converted to KiB.
The /FIXCHS
option will fix some of the more common errors
caused by disc geometry changes (which can occur when a disc is moved from one
machine to another or when a different make of SCSI host adapter is used, for
example).
The /FIXTYPES
option will turn type 0F extended partitions,
which IBM OS/2 cannot understand, into type 05 extended partitions, which it
can.
playmorse
plays Morse code through the PC speaker. The dot
speed and beep frequency are configurable, and the code can optionally be
displayed as it is played.
playtune
plays a tune through the PC speaker. No
more messing around converting a tune to a series of numbers for
BEEP
s! And no more need to run QBASIC
in a VDM,
which eats CPU time, just to play a tune! The tune is given in a format
compatible with the "PLAY" statement in the BASIC language and with
so-called "ANSI music" as used by several BBS and offline mail and comms
utilities.
pmlock
programmatically invokes the Presentation
Manager descktop lockup.
resetini
removes the read-only attribute from the user and
system INI files, and then instructs Workplace Shell to reload them. It
is useful as an aid to recovery if an incomplete shutdown has left the INI
files read-only by accident. It also has the side-effect of closing and
re-opening the WPS Desktop folder without restarting the system.
runsvc
is a service manager, to control services. The
Service Manager spawns and terminates the service process under remote control
from the service control utility. The environment, working directory,
arguments, and name of the service program are read from a configuration file
and may all be modified on the fly, allowing a service to be taken down,
reconfigured, and restarted without restarting the system as a whole.
runwhen
is a scheduler, suitable for being invoked
as a service under the aegis of runsvc
,
that provides the capability for invoking programs, with individually
specified environments and command tails, according to individual
scheduling rules. Commands can be scheduled according to matching
criteria including the date, time, week number, and day of the week.
saydate
displays the current, or any given, date and time,
with a fully configurable display format and full support for timezones
and automatic (and effortless) switching to and from daylight savings
time. The date
and time
commands built in to
IBM's 16-bit cmd
cannot be used in command scripts to display
the date and time without some ugliness, because they prompt for input.
This command can be!
service
controls services by sending commands to their
service managers.
setbootg
is a Presentation Manager configuration utility
for IBM's and other compatiable boot managers.
setdate
allows the hardware real-time clock to be set from a
date or time expressed as local time in any arbitrary timezone. It also
sets the date and time simultaneously, avoiding race conditions in command
scripts when used near midnight.
signal
sends OS/2 signals to processes.
sort
is an enhanced, 32-bit, replacement for OS/2's
16-bit sort
command. It can sort up to the size of available
virtual memory and has no 64KiB limit, can also sort files named on the
command line, and supports extended wildcards and the other standard CLU
features. It's also quicker!
strings
displays embedded strings of characters in files,
which is particularly useful for searching binary files for text strings.
It supports the standard CLU features of recursing into subdirectories,
including and excluding files by attribute, and extended wildcards.
sum
calculates CRC-16, CRC-32, two different types of
checksum (UNIX BSD and System V), and the MD5 fingerprint for files. It
supports the standard CLU features of recursing into subdirectories,
including/excluding files by attribute, and extended wildcards.
tail
outputs the last few lines of its input, which can
either be a number of files specified on its command line or its standard
input. It supports the standard CLU features of recursing into
subdirectories, including/excluding files by attribute, and extended
wildcards.
tasklist
lists the contents of the PM Window List in text
form, suitable for parsing, or use from text-mode programs.
tee
is a "T-shaped" pipe fitting, that sends its
standard input to its standard output, writing or appending a copy of it to
one or more files named as its arguments.
textconv
converts text files from one code page and
newline convention to another. It makes it easy to interchange text files
between OS/2 and Usenet, the Macintosh, and UNIX/linux, or between OS/2 users
in different countries with different code pages. It supports code page 1004
in particular, in order that one can convert text files from other code pages
to ISO 8859 Latin-1.
tomorse
converts text files to Morse code suitable
for piping into the playmorse
command. It can be used as
part of a command pipeline, and supports the standard CLU features of
being able to recurse into subdirectories and include/exclude files by
attribute, and extended wildcards.
touch
changes the last modification, last access, or
creation timestamp of files and directories. It can override read-only
protection, and it supports the standard CLU features of being able to
recurse into subdirectories and include/exclude files by attribute, and
extended wildcards.
tree
is an enhanced 32-bit replacement for OS/2's
16-bit tree
command. Unlike the latter, this command
actually displays a tree! It can also display size information, and be
limited to using only ASCII characters instead of character graphics. It
also supports extended wildcards.
uniq
displays files, eliminating multiple occurrences of
the same line. It can operate either locally, only eliminating consecutive
duplicate lines, or globally, eliminating all duplicate lines; and supports
the standard CLU features of recursing into subdirectories,
including/excluding files by attribute, and extended wildcards.
unstamp
displays files, converting encoded timestamps of
the form used in log files, to human-readable form in the current - or an
arbitrary - timezone. It supports the standard CLU features of extended
wildcards, inclusion and exclusion of files by attributes, and recursion into
subdirectories.
w2kfix
alters IBM's Boot Managers in situ in such a way that
Microsoft's Windows NT 2000 no longer recognises and overwrites them each
time it is booted.
watchlog
monitors one or a suite of log files generated
by CYCLOG, writing all logged data to its standard output, suitable for
passing through a pipe to other commands (such as UNSTAMP).
wc
counts the number of lines, words, letters, characters,
and bytes in files. It supports the standard CLU features of recursing
into subdirectories, including/excluding files by attribute, and extended
wildcards.
weavesvc
weaves a tapestry of services, managed by
service managers, interconnecting them via pipes. The tapestry is
configurable. The Service Weaver allows services to be easily connected to
instances of CYCLOG to log their output to log files.
what
finds any embedded SCCS identifying strings in files.
which
finds out what would be executed if a given
command name were used. It knows about commands that are built into the
16-bit CMD
, 32-bit CMD
, and 4OS2
command interpreters, and obeys the PATHEXT
environment
variable.
winsight
displays the hierarchy of Presentation Manager
windows as a tree structure, showing window handles, parents, owners,
process and thread IDs, styles, IDs, types, and text.
xdel
deletes files. It supports the standard CLU
features of recursing into subdirectories, including/excluding files by
attribute, and extended wildcards. It can also remove empty
subdirectories, override read-only protection, and wipe the contents of
files before deleting them in order to prevent them from being
successfully undeleted.
xdir
displays directory listings. It supports the standard
CLU features of recursing into subdirectories, including/excluding
files by attribute, and extended wildcards. It can also sort files from
multiple subdirectories into one big list, allowing one to see all files
in multiple subdirectories sorted together by size for example, and has no
arbitrary limits on the number of files that it can process.
y
is a "Y-shaped" pipe fitting, that concatenates
its standard input with one or more files and sends the result to its
standard output. It can also be used as a more powerful replacement for
the type
command built into IBM's 16-bit CMD
command interpreter, since it supports the standard CLU features of
extended wildcards, inclusion and exclusion of files by attributes, and
recursion into subdirectories.
Commands new in version 2.2 of the Command Line Utilities that weren't in version 2.1:
arcstamp
,enstamp
,mem
,pmlock
, andrunwhen
.
Commands new in version 2.1 of the Command Line Utilities that weren't in version 2.0:
cyclog
,dellname
,delthumb
,descedit
,dupdir
,head
,tomorse
,newmbr
,playmorse
,runsvc
,service
,setbootg
,signal
,tail
,uniq
,unstamp
,w2kfix
,watchlog
, andweavesvc
.
Commands new in version 2.0 of the Command Line Utilities that weren't in version 1.0:
anaclock
,arcdir
,bcomp
,calctz
,comp
,convcase
,cpuidg
,cpuidt
,deltree
,digclock
,dirsize
,find
,finddups
,fitsize
,help
,partlist
,playtune
,resetini
,saydate
,setdate
,sort
,strings
,sum
,tasklist
,tee
,textconv
,tree
,winsight
, andy
.
Commands in version 2.0 of the Command Line Utilities that were brought over from version 1.0:
attrib
,dump
,ff
,grep
,mem
,touch
,wc
,what
,which
,xdel
, andxdir