Source Compatibility Guide

Commands

The commands below are described in alphabetical order. Following those descriptions, some common usage of related commands is discussed. These commands are located in /usr/ucb.

See the list below for the commands available with the Source Compatibility Package.

Two versions of some commands exist: one in the default SunOS 5.x command location, and the other in the compatibility package found in /usr/ucb. The descriptions in this guide pertain only to the /usr/ucb versions, although, where relevant, the differences between the two versions are discussed.

arch

Displays your machine architecture. arch uses the SunOS 5.x uname -m command. arch is not available in the default SunOS 5.x release.

basename

Strips the full path name off a file. If you follow the path name with a suffix, that suffix is stripped, too:

$ basename /usr/src/rundog.c .c
rundog
$ 

basename is useful for writing shell scripts. This version parses arguments differently than the SunOS 5.x version.

biff

Enables and disables immediate notification of the arrival of mail. When notification is enabled, biff displays the header and first few lines of mail messages when they are received. This command is not available in the default SunOS 5.x release.

cc

This command is identical to the unbundled C compiler in /usr/ccs/bin/acc, except that the following directories are included:

Compatibility package header files and libraries referenced by the compiler (cc) and linker (ld) are located in /usr/ucbinclude and /usr/ucblib.

chown

Changes the owner of a file. This version allows you to optionally change the group as well. The group may be either a decimal group ID (GID) or a group name found in the GID file.

df

Displays the free disk space of currently mounted file systems. This command differs from /usr/bin/df in several ways:

$ /usr/ucb/df
Filesystem	kbytes	used	avail	capacity	Mounted on
/dev/root	1750592	826496	749032	52%	/
$ df
/	(/dev/root	):	231024 blocks	105323 files
/proc	(/proc	):	     0 blocks	123 files

du

Displays the number of disk blocks used by files in a directory. It is useful for seeing how disk space is being used. This version reports disk usage in kilobytes, while the default du command reports disk usage in blocks.

echo

Echoes arguments to the standard output. This version and the default echo command recognize certain escape sequences differently.

expr

Evaluates an expression. This version supports the following additional operators and keywords: match, substr, index, length().

fastboot

Reboots your machine. This command is not available in the default SunOS 5.x release.

fasthalt

Halts your machine. This command is not available in the default SunOS 5.x release.

file

Determines the file type by examining the file's contents. This version supports symbolic links. When the -L option is specified for a file that is a symbolic link, file tests the file referenced by the link rather than the link itself.

from

Displays mail header information, including the sender and time the mail was received. This command is not available in the default SunOS 5.x release.

groups

Displays the groups to which a user belongs. Although the id command in the default SunOS 5.x release has been enhanced to perform this function, groups is also available for compatibility.

hostid

Prints the numeric identifier (in hexadecimal) of the current host. This command is not available in the SunOS 5.x release.

hostname

Displays the name of your machine and allows you to rename it. This command is not available in the base release. uname -n in the SunOS 5.x release displays the machine name, but does not allow the super-user to rename the machine.

install

Installs files into a destination directory. This version has different options and syntax than the SunOS 5.x one.

ld

This command is identical to the linker in /usr/ccs/bin/ld, except that it ensures that libraries in /usr/ucblib are linked in by ld, before the default SunOS 5.x libraries.

When unresolved symbols remain, the libraries in /usr/lib are referenced. Note that /usr/ucblib/libucb.so is always linked when this command is invoked.

lint

Checks C programs for bugs, argument type errors, and potential portability problems. This command uses the lint libraries under /usr/ucblib.

ln

Creates links to files or directories. The default ln removes an existing target if it has the requisite permissions. Because the SunOS 4.1 behavior is not obtained by default, the compatibility package contains a version of ln that does not remove an existing target.

logger

Adds entries to a system log. Priorities, tags, and files to write to may be specified.

lpc

lpc, the line printer control program, is the same as in SunOS 4.1, except that it does not make use of the file /etc/printcap. Use lpc to start and stop a printer, disable or enable a spooling queue, rearrange the order of printing jobs, or display the status of each printer. This command is not available in SunOS 5.x.

lpq

Returns information on all print jobs on the local printer; however, for remote printers, it provides the status only for jobs belonging to the user. lpq is the equivalent of the SunOS 5.x command lpstat.

The command lpq username provides the status of all files, on all machines (both local and remote), belonging to the named user. In these examples, user wesson sends files fileX and fileY to the local printer printerA, and fileZ to a remote printer:

$ lpr fileX
$ lpr fileY
$ lpq
Rank Owner Job Files
active smith printerA-111230 file1
1st wesson printerA-111231 fileX
2nd wesson printerA-111232 fileY
3rd jones printerA-111233 file9
$
$ lpr -Pfar_printer fileZ
$ lpq -Pfar_printer
Rank Owner Job Files
4th wesson far_printer-111332 fileZ
$
$ lpq wesson
printerA:
Rank Owner Job Files
1st wesson printerA-111231 FileX
2nd wesson printerA-111232 FileY
far_printer:
Rank Owner Job Files
4th wesson far_printer-111332 FileZ
$

lpr

Sends files to the printer. The compatibility package version of lpr does not support the -r option (which removes a file after spooling it). Nor does it allow for specific fonts to be mounted on font positions 1, 2, 3, or 4. lpr is the equivalent of the SunOS 5.x lp command.

lprm

Removes files from the print queue. This is the SunOS 4.1 equivalent of the SunOS 5.x cancel command.

lptest

Produces a ripple pattern for testing printers.

ls

Lists a file or the contents of a directory. The compatibility package version of ls differs from the default ls command in two ways:

$ ls -ls
total 24
8 -rw-r--r-- 1 chris staff 268 Nov 10 21:28 test1
8 -rw-r--r-- 1 chris staff 121 Nov 10 21:28 test2
8 -rw-r--r-- 1 chris staff 42 Nov 10 21:28 test3
$ /usr/ucb/ls -ls
total 12
4 -rw-r--r-- 1 chris 268 Nov 10 21:28 test1
4 -rw-r--r-- 1 chris 121 Nov 10 21:28 test2
4 -rw-r--r-- 1 chris 42 Nov 10 21:28 test3
$ 

mach

Reports the machine type. The SunOS 5.x uname -p command provides the same behavior. However, because many scripts and makefiles use mach, it has been placed in the compatibility package. This command is not available in default SunOS 5.x release.

Mail and mail

Reads and sends mail messages. This command is a version of mailx(1) with defaults set to behave like the BSD mail command. See mailx(1) in the Solaris 8 Reference Manual Collectionfor complete information on the BSD default settings.

mkstr

Creates a file of all error messages in a C program source file. This is useful for programs with a large number of diagnostic error messages. It reduces the size of the program, and the system overhead when running the program. This command is not available in the default SunOS 5.x release.

pagesize

Reports the size of a page of memory in bytes. This is useful for scripts. This command is not available in the default SunOS 5.x release.

plot

Graphics filters for various plotters. The following filters allow you to run plot on a variety of terminals: aedplot, atoplot, bgplot, crtplot, dumbplot, gigiplot, hp7221plot, hpplot, implot, plottoa, t300, t300s, t4013, t450, tek, and vplot.

printenv

Reports environment variables as currently set. It is similar to the env command. This command is not available in the default SunOS 5.x release.

ps

Displays the status of the current processes. This version displays more information, in a different format, than that of the SunOS 5.x version.

renice

Alters the nice value of running processes. This behavior is now present in the SunOS 5.x priocntl command; however, for SunOS 4.1 compatibility reasons, renice is included in the compatibility package. This command is not available in the default SunOS 5.x release.

reset and tset

SunOS 5.x These commands are similar to tput reset and tput init respectively; that is, they reset and set terminal-behavior characteristics. However they differ enough to be included here. reset and SunOS 5.x tset are not available in the default SunOS 5.x release.

rusage

Executes the given command and reports on the resource usage. rusage reports the total time elapsed (wall clock), the system CPU, the user CPU, plus 11 other fields in a one line summary following the commands output, if any. This command is not available in the default SunOS 5.x release.

sed

/usr/ucb/sed is similar to /usr/bin/sed except it strips initial SPACE and TAB characters from text lines.

shutdown

This version of shutdown allows you to specify a time and a warning message to be sent. It also sends shutdown messages to other systems if they have mounted filesystems from the machine being shut down. See the shutdown(1B) manual page for any limitations on SunOS 4.1 functionality.

stty 5.2

The SunOS 5.x version of stty incorporates many of the features of SunOS 4.1 stty. The compatibility package version is included for full SunOS 4.1 functionality.

sum

Calculates checksums in a machine-dependent way. Also, it displays the file in kilobytes instead of 512-byte blocks.

test

Evaluates conditional expressions. The SunOS 4.1 and SunOS 5.x versions of test differ with respect to the -f option. In the SunOS 4.1 release, this option means ``is the target not-a-directory?'' while in the SunOS 5.x release it means ``is the target a plain file?''.

touch

Updates the access and modification times of a file. The SunOS 5.x version of touch does not support the -f option, which attempts to force the touch in spite of read and write permissions on the file.

tr

Translates characters from the standard input to the standard output. There are two differences between /usr/bin/tr and this version:

tset

See reset.

ucblinks

Creates symbolic links in /dev for SunOS 4.1 devices whose names are different in the SunOS 5.x release. When these links are no longer needed, they must be removed manually.

users

Displays a short list of logged-in users. This command is not available in the default SunOS 5.x release. The SunOS 5.x equivalent is who -q.

vipw

Edits the /etc/passwd file, and sets the appropriate locks. vipw runs consistency checks on the password file when the edits are complete and the locks have been removed. If these checks fail, vipw does not allow the incorrect file to be installed. This command is not available in the default SunOS 5.x release.

whereis

Locates the binary, source, and manual page files for the given command. whereis searches a standard list of common locations for these files. This command is not available in the default SunOS 5.x release.

whoami

Displays your effective user ID; whoami works even if you have used su to change your current user ID. This command is not available in the default SunOS 5.x release, although it is equivalent to id.