addbib | addbib [options] database
Part of the refer suite of programs.
See Chapter 17.
|
admin | /usr/ccs/bin/admin [options] files
An SCCS command. See Chapter 18.
|
appletviewer |
/usr/java/bin/appletviewer [options] urls
Solaris only.
Connect to the specified urls and run any
Java applets they specify in their own windows, outside the
context of a web browser.
Options- -debug
- Run the applet viewer from within the Java debugger, jdb.
- -encoding name
- Specify the input HTML file encoding.
- -J opt
- Pass opt on to the java
command. opt should not contain spaces; use
multiple -J options if necessary.
|
apropos | apropos keywords
Look up one or more keywords in the online manpages.
Same as man -k. See also whatis.
|
ar | /usr/ccs/bin/ar [-V] key [args] [posname] archive [files]
Maintain a group of files that are combined into
a file archive.
Used most commonly to create and update library files as used by the
loader (ld). Only one key letter may be used, but each
can be combined with additional args (with no separations between).
posname is the name of a file in archive. When moving or
replacing files, you can specify that they be placed
before or after posname.
See lorder
in Appendix B,
for another example.
-V prints the version number of ar on standard error.
On Solaris, key and args can be preceded
with a -, as though they were regular options.
Key
d | Delete files from archive.
|
m | Move files to end of archive.
|
p | Print files in archive.
|
q | Append files to archive.
|
r | Replace files in archive.
|
t | List the contents of archive or list the named files.
|
x | Extract contents from archive or only the named files.
|
Args
a | Use with r or m to place files
in the archive after posname.
|
b | Same as a but before posname.
|
c | Create archive silently.
|
C | Don't replace existing files of the same name with the one
extracted from the archive. Useful with T.
Solaris only.
|
i | Same as b.
|
s | Force regeneration of archive symbol table
(useful after running strip or mcs).
|
T | Truncate long filenames when extracting onto filesystems that don't
support long filenames.
Without this operation, extracting files with long filenames is an error.
Solaris only.
|
u | Use with r to replace
only files that have changed since being put in archive.
|
v | Verbose; print a description.
|
ExampleUpdate the versions of object files in
mylib.a
with the ones in the current directory.
Any files in mylib.a that are not in the
current directory are not replaced.
ar r mylib.a *.o
|
as | /usr/ccs/bin/as [options] files
Generate an object file from each specified assembly language
source file. Object files have the same root name as
source files but replace the .s suffix with .o.
There may be additional system-specific options.
See also dis.
Options- -m
- Run m4 on file.
- -n
- Turn off optimization of long/short addresses.
- -o objfile
- Place output in object file objfile
(default is file.o).
- -Qc
- Put the assembler's version number in the object file (when c = y);
default is not to put it (c = n).
- -R
- Remove file upon completion.
- -T
- Force obsolete assembler directives to be obeyed.
- -V
- Display the version number of the assembler.
- -Y [key,] dir
- Search directory dir for the m4 preprocessor
(if key is m),
for the file containing predefined macros (if key is d), or
for both (if key is omitted).
|
at |
at options1 time [date] [+ increment] at options2 [jobs]
Execute commands entered on standard input at a specified
time and optional date.
(See also batch
and crontab.)
End input with EOF. time can be formed either
as a numeric hour (with optional minutes and modifiers)
or as a keyword. date can be formed either
as a month and date, as a day of the week, or as a special keyword.
increment is a positive integer followed by a keyword.
See the following lists for details.
Options1- -c
- Use the C shell to execute the job.
Solaris only.
- -f file
- Execute commands listed in file.
- -k
- Use the Korn shell to execute the job.
Solaris only.
- -m
- Send mail to user after job is completed.
- -q queuename
- Schedule the job in queuename.
Values for queuename are the lowercase letters
a through z.
Queue a is the default queue for at jobs.
Queue b is the queue for batch jobs.
Queue c is the queue for cron jobs.
Solaris only.
- -s
- Use the Bourne shell to execute the job.
Solaris only.
- -t time
- Run the job at time, which is in the same format as
allowed by touch.
Solaris only.
Options2- -l
- Report all jobs that are scheduled for the invoking user or,
if jobs are specified, report only for those.
See also atq.
- -r
- Remove specified jobs that were previously scheduled. To remove a job,
you must be a privileged user or the owner of the job. Use -l first
to see the list of scheduled jobs. See also atrm.
Time- hh:mm [modifiers]
- Hours can have one or two digits (a 24-hour clock is assumed by default);
optional minutes can be given as one or two digits;
the colon can be omitted if the format is h, hh, or hhmm;
e.g., valid times are 5, 5:30, 0530, 19:45.
If modifier am or pm is added, time is based on
a 12-hour clock. If the keyword zulu
is added, times correspond to Greenwich Mean Time (UTC).
- midnight | noon | now
- Use any one of these keywords in place of a numeric time.
now must be followed by an increment.
Date- month num[, year]
- month is one of the 12 months, spelled out or abbreviated to
their first three letters; num is the calendar day of the month;
year is the four-digit year. If the given month occurs before
the current month, at schedules that month next year.
- day
- One of the seven days of the week, spelled out or abbreviated to their
first three letters.
- today | tomorrow
- Indicate the current day or the next day. If date is omitted,
at schedules today when the specified time occurs
later than the current time; otherwise, at schedules tomorrow.
IncrementSupply a numeric increment if you want to specify an execution time or day
relative to the current time. The number should precede any of
the keywords minute, hour, day,
week, month, or
year (or their plural forms).
The keyword next can be used
as a synonym of + 1.
ExamplesNote that the first two commands are equivalent:
at 1945 pm December 9
at 7:45pm Dec 9
at 3 am Saturday
at now + 5 hours
at noon next day
|
atq | atq [options] [users]
List jobs created by the at command that are still in the queue.
Normally, jobs are sorted by the order in which they execute.
Specify the users whose jobs you want to check.
If no users are specified, the default is to display all jobs
if you're a privileged user; otherwise, only your jobs are displayed.
Options- -c
- Sort the queue according to the time the at command was given.
- -n
- Print only the total number of jobs in queue.
|
atrm | atrm [options] [users | jobIDs]
Remove jobs queued with at that match the specified jobIDs.
A privileged user may also specify the users whose jobs are to be
removed.
Options- -a
- Remove all jobs belonging to the current user.
(A privileged user can remove all jobs.)
- -f
- Remove jobs unconditionally,
suppressing all information regarding removal.
- -i
- Prompt for y (remove the job) or n (do not remove).
|
awk | awk [options] [program] [var=value ...] [files]
Use the pattern-matching program to process the specified files.
awk has been replaced by nawk (there's also a GNU version called
gawk).
program instructions have the general form:
pattern { procedure }
pattern and procedure are optional.
When specified on the command line, program must be
enclosed in single quotes to prevent the shell from interpreting
its special symbols.
Any variables specified in program can be assigned an
initial value by using command-line arguments of the form var=value.
See Chapter 11,
for more information (including examples) on awk.
Options- -f file
- Use program instructions contained in file, instead
of specifying program on the command line.
- -Fc
- Treat input file as fields separated by character
c.
By default, input fields are separated by runs of spaces and/or tabs.
|
banner | banner characters
Print characters as a poster on the standard output.
Each word supplied must contain ten characters or less.
|
basename | basename pathname [suffix]
Given a pathname, strip the path prefix and
leave just the filename, which is printed on standard output.
If specified, a filename suffix (e.g., .c)
is removed also. basename is typically invoked via
command substitution (‘...‘) to
generate a filename. See also dirname.
The Solaris version of basename allows the suffix to be
a pattern of the form accepted by expr.
See the entry for expr for more details.
ExampleGiven the following fragment from a Bourne shell script:
ofile=output_file
myname="`basename $0`"
echo "$myname: QUITTING: can't open $ofile" 1>&2
exit 1
If the script is called do_it, the following message would
be printed on standard error:
do_it: QUITTING: can't open output_file
|
batch | batch
Execute commands entered on standard input. End with EOF.
Unlike at, which executes commands at a specific time,
batch executes commands one after another (waiting for each one
to complete). This avoids the potentially high system load caused by running
several background jobs at once. See also at.
batch is equivalent to at -q b -m now.
Example$ batch
sort in > out
troff -ms bigfile > bigfile.ps
EOF
|
bc | bc [options] [files]
Interactively perform arbitrary-precision arithmetic or convert numbers
from one base to another. Input can be taken from
files or read from the standard input. To exit, type
quit or EOF.
Options- -c
- Do not invoke dc; compile only.
(Since bc is a preprocessor for dc,
bc normally invokes dc.)
- -l
- Make available functions from the math library.
bc is a language (and compiler) whose syntax resembles that of C.
bc consists of identifiers, keywords, and symbols, which
are briefly described here. Examples follow at the end.
IdentifiersAn identifier is a single character, consisting of the lowercase
letters a–z.
Identifiers are used as names for variables, arrays, and functions.
Within the same program you may name a variable, an array,
and a function using the same letter. The following identifiers would
not conflict:
x | Variable x.
|
x[i] | Element i of array x.
i can range from 0 to 2047
and can also be an expression.
|
x(y,z) | Call function x with parameters y and z.
|
Input/Output Keywordsibase, obase,
and scale each store a value.
Typing them on a line by themselves
displays their current value. More commonly, you
would change their values
through assignment. Letters A–F are treated
as digits whose values are 10–15.
- ibase = n
- Numbers that are input (e.g., typed) are read as base n
(default is 10).
- obase = n
- Numbers displayed are in base n (default is 10).
Note: once ibase has been changed from 10, use digit “A”
to restore ibase or obase to decimal.
- scale = n
- Display computations using n decimal places (default is 0,
meaning that results are truncated to integers).
scale is normally used only for base-10 computations.
Statement KeywordsA semicolon or a newline separates one statement from another.
Curly braces are needed only when grouping multiple statements.
- if (rel-expr) {statements}
- Do one or more statements if relational expression
rel-expr is true; for example:
if (x == y) i = i + 1
- while (rel-expr) {statements}
- Repeat one or more statements while rel-expr is true;
for example:
while (i > 0) {p = p*n; q = a/b; i = i-1}
- for (expr1; rel-expr; expr2) {statements}
- Similar to while; for example, to print the first 10 multiples of
5, you could type:
for (i = 1; i <= 10; i++) i*5
- break
- Terminate a while or for statement.
- quit
- Exit bc.
Function Keywords- define j(k) {
- Begin the definition of function j having a single argument k.
Additional arguments are allowed, separated by commas.
Statements follow on successive lines. End with a }.
- auto x, y
- Set up x and y as variables local to a function definition,
initialized to 0 and meaningless outside the function. Must appear first.
- return(expr)
- Pass the value of expression expr back to the program.
Return 0 if (expr) is left off.
Used in function definitions.
- sqrt(expr)
- Compute the square root of expression expr.
- length(expr)
- Compute how many digits are in expr.
- scale(expr)
- Same, but count only digits to the right of the decimal point.
Math Library FunctionsThese are available when bc is invoked with -l.
Library functions set scale to 20.
- s(angle)
- Compute the sine of angle, a constant or expression
in radians.
- c(angle)
- Compute the cosine of angle, a constant or expression
in radians.
- a(n)
- Compute the arctangent of n, returning an angle in radians.
- e(expr)
- Compute e to the power of expr.
- l(expr)
- Compute natural log of expr.
- j(n, x)
- Compute Bessel function of integer order n.
OperatorsThese consist of operators and other symbols.
Operators can be arithmetic, unary, assignment, or relational.
Arithmetic | + - * / % ^
|
Unary | - ++ --
|
Assignment | =+ =- =* =/ =% =^ =
|
Relational | < <= > >= == !=
|
Other Symbols- /* */
- Enclose comments.
- ( )
- Control the evaluation of expressions (change precedence).
Can also be used around assignment statements to force the
result to print.
- { }
- Used to group statements.
- [ ]
- Array index.
- "text"
- Use as a statement to print text.
ExamplesNote that when you type some quantity (a number or expression),
it is evaluated and printed, but assignment statements produce no display:
ibase = 8 Octal input
20 Evaluate this octal number
16 Terminal displays decimal value
obase = 2 Display output in base 2 instead of base 10
20 Octal input
10000 Terminal now displays binary value
ibase = A Restore base 10 input
scale = 3 Truncate results to three places
8/7 Evaluate a division
1.001001000 Oops! Forgot to reset output base to 10
obase = 10 Input is decimal now, so "A" isn't needed
8/7
1.142 Terminal displays result (truncated)
The following lines show the use of functions:
define p(r,n){ Function p uses two arguments
auto v v is a local variable
v = r^n r raised to the n power
return(v)} Value returned
scale = 5
x = p(2.5,2) x = 2.5 ^ 2
x Print value of x
6.25
length(x) Number of digits
3
scale(x) Number of places to right of decimal point
2
|
bdiff | bdiff file1 file2 [options]
Compare file1 with file2 and report the differing
lines. bdiff splits the files and then runs diff,
allowing it to act on files that would normally be
too large to handle. bdiff
reads standard input if one of
the files is –. See also diff.
Options- n
- Split each file into n-line segments (default is 3500). This option must be listed first.
- -s
- Suppress error messages from bdiff (but not from diff).
|
biff | /usr/ucb/biff [y | n]
Turn mail notification on or off. With no arguments,
biff indicates the current status.
When mail notification is turned on, each time you get incoming mail,
the bell rings, and the first few lines of each message are displayed.
|
cal | cal [[month] year]
With no arguments, print a calendar for the current month.
Otherwise, print either a 12-month calendar (beginning with January)
for the given year or a one-month calendar of the given
month and year.
month ranges from 1 to 12;
year ranges from 1 to 9999.
Examplescal 12 1999
cal 1999 > year_file
|
calendar | calendar [option]
Read your calendar file and display all lines that contain the
current date. The calendar file is like a memo board. You
create the file and add entries like the following:
5/4 meeting with design group at 2 pm
may 6 pick up anniversary card on way home
When you run calendar on May 4, the first line is displayed.
calendar can be automated by using crontab or at,
or by including it in your startup files .profile or .login.
Option- –
- Allow a privileged user to invoke calendar for all users,
searching each user's login directory for a file named calendar.
Entries that match are sent to a user via mail.
This feature is intended for use via cron.
It is not recommended in networked environments with
large user bases.
|
cancel | cancel [options] [printer]
Cancel print requests made with lp.
The request can be specified by its ID, by the printer
on which it is currently printing, or by the username
associated with the request (only privileged users can cancel
another user's print requests).
Use lpstat to determine either the id or
the printer to cancel.
Options- id
- Cancel print request id.
- -u user
- Cancel request associated with user.
|
cat | cat [options] [files]
Read one or more files and print them on standard output.
Read standard input if no files are specified or if –
is specified
as one of the files; end input with EOF.
Use the > shell operator to combine several files into
a new file; >> appends files to an existing file.
Options- -b
- Like -n, but don't number blank lines. Solaris only.
- -e
- Print a $ to mark the end of each line. Must be used with -v.
- -n
- Number lines. Solaris only.
- -s
- Suppress messages about nonexistent files. (Note: On some systems,
-s squeezes out extra blank lines.)
- -t
- Print each tab as ^I and each form feed as ^L.
Must be used with -v.
- -u
- Print output as unbuffered (default is buffered in blocks or
screen lines).
- -v
- Display control characters and other nonprinting characters.
Examples
cat ch1 Display a file
cat ch1 ch2 ch3 > all Combine files
cat note5 >> notes Append to a file
cat > temp1 Create file at terminal; end with EOF
cat > temp2 << STOP Create file at terminal; end with STOP
|
cb | cb [options] [files]
C program “beautifier” that formats files using proper C programming
structure.
Options- -j
- Join split lines.
- -l length
- Split lines longer than length.
- -s
- Standardize code to style of Kernighan and Ritchie in The C
Programming Language.
- -V
- Print the version of cb on standard error.
Examplecb -l 70 calc.c > calc_new.c
|
cc | /usr/ccs/bin/cc [options] files
Compile one or more C source files (file.c),
assembler source files (file.s),
or preprocessed C source files (file.i).
cc automatically invokes the loader ld
(unless -c is supplied).
In some cases, cc generates an object file
having a .o suffix and a corresponding root name.
By default, output is placed in a.out.
cc accepts additional system-specific options.
NotesAdd /usr/ccs/bin to your PATH
to use the C compiler and other C Compilation System tools.
This command runs the ANSI C compiler;
use /usr/bin/cc if you want to run the compiler for
pre-ANSI
C.
Solaris 7 does not come with a C compiler.
You must purchase one separately from Sun, or download the GNU
C Compiler (GCC) from
http://www.sunfreeware.com.
Options for cc vary wildly across Unix systems.
We have chosen here to document only those options that are
commonly available.
You will need to check your local documentation
for complete information.
Usually, cc passes any
unrecognized options to the loader, ld.
Options
- -c
- Suppress loading and keep any object files that were produced.
- -Dname[=def]
- Supply a #define directive, defining name to be def
or, if no def is given, the value 1.
- -E
- Run only the macro preprocessor, sending results to standard output.
- -g
- Generate more symbol-table information needed for debuggers.
- -Idir
- Search for include files in directory dir (in addition
to standard locations). Supply a -I for each new dir
to be searched.
- -lname
- Link source file with library files
libname.so
or libname.a.
- -Ldir
- Like -I, but search dir for library archives.
- -o file
- Send object output to file instead of to a.out.
- -O
- Optimize object code (produced from .c or .i files).
- -p
-
Generate benchmark code to count the times each routine is called.
File mon.out is created, so
prof can be used later to produce an execution profile.
- -P
- Run only the preprocessor and place the result in file.i.
- -S
- Compile (and optimize, if -O is supplied),
but don't assemble or load;
assembler output is placed in file.s.
- -Uname
- Remove definition of name, as if through an #undef directive.
ExampleCompile xpop.c and load it with the X libraries:
cc -o xpop xpop.c -lXaw -lXmu -lXt -lX11
|
cd | cd [dir]
Change directory. cd is a built-in shell command. See
Chapter 4, and
Chapter 5.
|
cdc | /usr/ccs/bin/cdc -rsid [option] files
An SCCS command. See Chapter 18.
|
cde |
Common Desktop Environment
Solaris only.
The Common Desktop Environment (CDE) is the default
graphical user interface (GUI) on Solaris systems.
Solaris 7 users may choose between CDE and OpenWindows,
but OpenWindows is marked as obsolete and not supported
past Solaris 7.
Documenting CDE would require its own book and is beyond the
scope of this one.
Instead, listed here are some of the more useful individual
CDE commands, which are kept in /usr/dt/bin.
(Commands for the desktop.)
In addition, a number of OpenWindows commands are still useful.
See the listing under openwin
in Appendix B.
Useful CDE ProgramsThe following CDE and Sun Desktop commands may be of interest.
Check the manpages for more information.
answerbook2 | Sun hypertext documentation viewer.
|
dtaction | Invoke CDE actions from within shell scripts.
|
dtbuilder | CDE applications builder.
|
dtcalc | Onscreen scientific, logical, and financial calculator.
|
dtcm | Calendar manager.
|
dterror.ds | dtksh script for error notices and dialogues.
|
dtfile_error | dtksh script for error dialogues.
|
dticon | Icon editor.
|
dtksh | The “Desktop Korn shell,” a version of ksh93.
|
dtmail | Mail reader.
|
dtpad | Simple text editor.
|
dtprintinfo | Print job manager.
|
dtscreen | Screen savers.
|
dtterm | Terminal emulator.
|
fdl | Font downloader utility for PostScript printers.
|
hotjava | Java-based web browser.
|
sdtconvtool | GUI for iconv.
|
sdtfind | File finder.
|
sdtimage | Image viewer (PostScript, GIF, JPEG, etc.).
|
sdtperfmeter | System performance meter.
|
sdtprocess | Process manager.
|
|
cflow | cflow [options] files
Produce an outline (or flowchart)
of external function calls for the
C, lex, yacc, assembler, or object files.
cflow also accepts the cc options
-D, -I, and -U.
Options- -dn
- Stop outlining when nesting level n is reached.
- -i_
- Include functions whose names begin with _.
- -ix
- Include external and static data symbols.
- -r
- Invert the listing; show the callers of each function
and sort in lexicographical order by callee.
|
checkeq | checkeq [files]
Solaris only.
Check nroff/troff input files for
missing or unbalanced eqn delimiters.
checkeq checks both .EQ/.EN
pairs and inline delimiters as indicated by the delim
statement.
|
checknr | checknr [options] [files]
Solaris only.
Check nroff/troff source
files for mismatched delimiters and unknown commands.
It also checks for macros that come in open/close pairs,
such as .TS and .TE.
With no files, checks the standard input.
checknr works best when input is designed for its
conventions: \fP always ends a font change,
and \s0 always restores a point-size change.
checknr knows about the me
and ms macros.
Options- -amacros
- Add new pairs of macros that come in open/close pairs. The six
characters representing the new macros must immediately follow the
-a, e.g., -a.PS.PE for the
pic macros.
- -ccommands
- Don't complain that the given commands
are undefined.
String the command names together, as in -a. Useful if you have your own macro package.
- -f
- Ignore inline font changes (\f).
- -s
- Ignore inline point-size changes (\s).
|
chgrp | chgrp [options] newgroup files
Change the ownership of one or more files to newgroup.
newgroup is either a group ID number or a group name located in
/etc/group. You must own the file or be a privileged user
to succeed with this command.
Options- -f
- Force error messages to be suppressed.
- -h
- Change the group on symbolic links.
Normally, chgrp acts on the
file referenced by a symbolic link, not on the link
itself. (This option is not necessarily available on all Unix systems.)
- -R
- Recursively descend through the directory, including subdirectories
and symbolic links, setting the specified group ID as it proceeds.
|
chkey | chkey [options]
Solaris only.
Prompt for login password and use it to encrypt a new key.
See also keylogin
and keylogout.
Options- -p
- Reencrypt the existing secret key with the user's
login password.
- -m mechanism
- Change or reencrypt the secret key for the
specified mechanism.
(Mechanisms are those allowed by nisauthconf(1).)
- -s database
- Update the given database, which is one of
files,
nis,
or
nisplus.
|
chmod | chmod [option] mode files
Change the access mode of one or more files. Only the owner of a
file or a privileged user may change its mode.
Create mode by concatenating the
characters from who, opcode, and permission.
who is optional (if omitted, default is a); choose only one opcode.
Options- -f
- Suppress error message upon failure to change a file's mode.
- -R
- Recursively descend directory arguments while setting modes.
Who
u | User
|
g | Group
|
o | Other
|
a | All (default)
|
Opcode
+ | Add permission
|
- | Remove permission
|
= | Assign permission (and remove permission of the unspecified fields)
|
Permission
r | Read
|
w | Write
|
x | Execute
|
s | Set user (or group) ID
|
t | Sticky bit; save text mode (file) or prevent removal of files by nonowners
(directory)
|
u | User's present permission
|
g | Group's present permission
|
o | Other's present permission
|
l | Mandatory locking
|
Alternatively, specify permissions by a three-digit sequence. The first
digit designates owner permission; the second, group permission; and the
third, others permission. Permissions are calculated by adding
the following octal values:
Note: a fourth digit may precede this sequence. This digit assigns the
following modes:
4 | Set user ID on execution
|
2 | Set group ID on execution or set mandatory locking
|
1 | Sticky bit
|
ExamplesAdd execute-by-user permission to file:
chmod u+x file
Either of the following assigns read-write-execute permission by owner (7),
read-execute permission by group (5), and execute-only permission
by others (1) to file:
chmod 751 file
chmod u=rwx,g=rx,o=x file
Any one of the following assigns read-only permission to
file for everyone:
chmod =r file
chmod 444 file
chmod a-wx,a+r file
Set the user ID, assign
read-write-execute permission by owner, and assign read-execute
permission by group and others:
chmod 4755 file
|
chown | chown [options] newowner[:newgroup] files
Change the ownership of one or more files to newowner.
newowner is either a user ID number or a login name located in
/etc/passwd.
The optional
newgroup is either a group ID number (GID) or a group name
located in the /etc/group file.
When newgroup is supplied,
the behavior is to
change the ownership of one or more files to newowner
and make it belong to newgroup.
Note: some systems accept a period as well as the colon for separating
newowner and newgroup.
The colon is mandated by POSIX; the period is accepted for
compatibility with older BSD systems.
Options- -f
- Force error messages to be suppressed.
- -h
- Change the owner on symbolic links. Normally, chown acts on the
file referenced by a symbolic link, not on the link
itself. (This option is not necessarily available on all Unix systems.)
- -R
- Recursively descend through the directory, including subdirectories and
symbolic links, resetting the ownership ID.
|
cksum | cksum [files]
Solaris only.
Calculate and print a cyclic redundancy check (CRC) for each file.
The CRC algorithm is based on the polynomial used for Ethernet packets.
For each file, cksum prints a line of the form:
sum count filename
Here, sum is the CRC,
count is the number of bytes in the file,
and filename is the file's name.
The name is omitted if standard input is used.
|
clear | clear
Clear the terminal display.
|
cmp | cmp [options] file1 file2
Compare file1 with file2. Use standard input if
file1
or file2
is -. See also comm
and diff.
The exit codes are as follows:
0 | Files are identical.
|
1 | Files are different.
|
2 | Files are inaccessible.
|
Options- -l
- For each difference, print the byte number in decimal and the
differing bytes in octal.
- -s
- Work silently; print nothing, but return exit codes.
ExamplePrint a message if two files are the same (exit code is 0):
cmp -s old new && echo 'no changes'
|
col | col [options]
A postprocessing filter that handles reverse linefeeds and escape characters,
allowing output from tbl (or nroff,
occasionally) to appear
in reasonable form on a terminal.
Options- -b
- Ignore backspace characters; helpful when printing manpages.
- -f
- Process half-line vertical motions, but not reverse line motion.
(Normally, half-line input motion is displayed on the next full line.)
- -p
- Print unknown escape sequences (normally ignored) as regular
characters. This option can garble output, so its use is not recommended.
- -x
- Normally, col saves printing time by converting sequences of
spaces to tabs. Use -x to suppress this conversion.
ExamplesRun file through tbl and
nroff, then capture
output on screen by filtering through col and more:
tbl file | nroff | col | more
Save manpage output in file.print,
stripping out backspaces
(which would otherwise appear as ^H):
man file | col -b > file.print
|
comb | /usr/ccs/bin/comb [options] files
An SCCS command. See Chapter 18.
|
comm | comm [options] file1 file2
Compare lines common to the sorted files file1 and file2.
Three-column output is produced: lines unique to
file1, lines unique to file2,
and lines common to both files.
comm is similar to diff in that both commands
compare two files.
In addition, comm can be used like uniq;
that is, comm selects duplicate or unique lines between
two sorted files, whereas uniq selects duplicate or unique lines
within the same sorted file.
Options- –
- Read the standard input.
- -1
- Suppress printing of Column 1.
- -2
- Suppress printing of Column 2.
- -3
- Suppress printing of Column 3.
- -12
- Print only lines in Column 3 (lines common to file1 and file2).
- -13
- Print only lines in Column 2 (lines unique to file2).
- -23
- Print only lines in Column 1 (lines unique to file1).
ExampleCompare two lists of top-10 movies and display items that appear
in both lists:
comm -12 shalit_top10 maltin_top10
|
compress | compress [options] [files]
Reduce the size of one or more files using adaptive Lempel-Ziv coding
and move to file.Z. Restore with uncompress
or zcat.
With a filename of –, or with no files,
compress reads standard input.
Note: Unisys claims a patent on the algorithm used
by compress.
Today, gzip is generally preferred
for file compression.
Options- -bn
- Limit the number of bits in coding to n; n is 9–16,
and 16 is the default. A lower n produces a larger,
less densely compressed file.
- -c
- Write to the standard output (do not change files).
- -f
- Compress unconditionally; i.e., do not prompt before overwriting files.
Also, compress files even if the resulting file would actually be larger.
- -v
- Print the resulting percentage of reduction for files.
|
cp | cp [options] file1 file2 cp [options] files directory
Copy file1 to file2,
or copy one or more files
to the same names under directory.
If the destination is an existing file, the file is overwritten;
if the destination is an existing directory, the file is copied
into the directory (the directory is not overwritten).
If one of the inputs is a directory, use the -r option.
Options- -i
- Prompt for confirmation (y for yes) before overwriting an existing file.
- -p
- Preserve the modification time and permission modes for the copied
file. (Normally cp supplies the permissions of the invoking user.)
- -r
- Recursively copy a directory, its files, and its subdirectories to a
destination directory, duplicating the tree
structure. (This option is used with the second command-line format
when at least one of the source file arguments is a
directory.) Bear in mind that both symbolic and hard links are copied
as real files; the linking structure of the original tree is
not preserved.
ExampleCopy two files to their parent directory (keep the same names):
cp outline memo ..
|
cpio | cpio control_options [options]
Copy file archives in from, or out to, tape or disk, or to another
location on the local machine.
Each of the three control options, -i, -o,
or -p
accepts different options.
(See also tar">pax and tar.)
- cpio -i [options] [patterns]
- Copy in (extract) files whose names match selected patterns.
Each pattern can include filename metacharacters from the Bourne shell.
(Patterns should be quoted or escaped so they are interpreted by
cpio, not by the shell.) If no pattern is used, all files are
copied in.
During extraction, existing files are not overwritten by older versions
in the archive (unless -u is specified).
- cpio -o [options]
- Copy out a list of files whose names are given on the standard input.
- cpio -p [options] directory
- Copy files to another directory on the same system. Destination pathnames
are interpreted relative to the named directory.
Comparison of Valid OptionsOptions available to the -i,
-o, and -p options
are shown respectively in the first, second, and third row below.
(The - is omitted for clarity.)
i: 6 b B c C d E f H I k m M r R s S t u v V
o: a A B c C H L M O v V
p: a d l L m P R u v V
Options- -a
- Reset access times of input files.
- -A
- Append files to an archive (must use with -O).
- -b
- Swap bytes and half-words. Words are 4 bytes.
- -B
- Block input or output using 5120 bytes per record
(default is 512 bytes per record).
- -c
- Read or write header information as ASCII characters;
useful when source and destination machines are different types.
- -C n
- Like -B, but block size can be any positive integer n.
- -d
- Create directories as needed.
- -E file
- Extract filenames listed in file from the archive.
- -f
- Reverse the sense of copying; copy all files except those that
match patterns.
- -H format
- Read or write header information according to format.
Values for format are
bar (bar format header and file, read-only,
Solaris only),
crc
(ASCII header containing expanded
device numbers), odc (ASCII header containing small device numbers),
ustar (IEEE/P1003 Data Interchange Standard header), or
tar (tar header).
Solaris also allows
CRC,
TAR,
and
USTAR.
- -I file
- Read file as an input archive.
- -k
- Skip corrupted file headers and I/O errors.
- -l
- Link files instead of copying.
Can be used only with -p.
- -L
- Follow symbolic links.
- -m
- Retain previous file-modification time.
- -M msg
- Print msg when switching media.
Use variable %d in the message as a numeric ID for the next medium.
-M is valid only with -I or -O.
- -O file
- Direct the output to file.
- -P
- Preserve ACLs.
Can be used only with -p.
Solaris only.
- -r
- Rename files interactively.
- -R ID
- Reassign file ownership and group information
of extracted files
to the user whose login ID is ID
(privileged users only).
- -s
- Swap bytes.
- -S
- Swap half-words.
- -t
- Print a table of contents of the input (create no files).
When used with the -v option,
resembles output of ls -l.
- -u
- Unconditional copy; old files can overwrite new ones.
- -v
- Print a list of filenames.
- -V
- Print a dot for each file read or written
(this shows cpio at work without
cluttering the screen).
- -6
- Process a PWB Unix 6th Edition archive format file.
Useful only with the -i option,
mutually exclusive with -c and -H.
ExamplesGenerate a list of old files using find; use list
as input to cpio:
find . -name "*.old" -print | cpio -ocBv > /dev/rmt/0
Restore from a tape drive all files whose name contains “save” (subdirectories
are created if needed):
cpio -icdv "*save*" < /dev/rmt/0
To move a directory tree:
find . -depth -print | cpio -padml /mydir
|
crontab | crontab [file] crontab options [user]
Run crontab on your current crontab file,
or specify a crontab file to add to the crontab directory.
A privileged user can run crontab for another user by
supplying a user after any of the options.
A crontab file is a list of commands, one per line, that will execute
automatically at a given time. Numbers are supplied before each command
to specify the execution time. The numbers appear in five fields,
as follows:
Minute 0-59
Hour 0-23
Day of month 1-31
Month 1-12
Day of week 0-6, with 0 = Sunday
Use a comma between multiple values, a hyphen to indicate a range, and an asterisk to
indicate all possible values. For example, assuming the crontab entries below:
59 3 * * 5 find / -print | backup_program
0 0 1,15 * * echo "Timesheets due" | mail user
The first command backs up the system files every Friday at 3:59 a.m.,
and the second command mails a reminder on the 1st and 15th of each month.
Options- -e
- Edit the user's current crontab file (or create one).
- -l
- List the user's file in the crontab directory.
- -r
- Delete the user's file in the crontab directory.
|
cscope | cscope [options] files
Interactive utility for finding code fragments in one or more
C, lex, or yacc source files.
cscope builds a symbol cross reference
(named cscope.out by default) and then calls up a menu. The
menu prompts the user to search for functions, macros, variables, preprocessor
directives, etc. Type ? to list interactive commands.
Subsequent calls to cscope rebuild the cross reference
if needed (i.e., if filenames or file contents have changed).
Source filenames can be stored in a file cscope.files.
This file can then be specified instead of files.
Options -I, -p, and -T
are also recognized when placed in cscope.files.
Options- -b
- Build the symbol cross reference only.
- -c
- Create output in ASCII (don't compress data).
- -C
- Ignore uppercase/lowercase differences in searches.
- -d
- Don't update the cross reference.
- -e
- Don't show the ^E prompt between files.
- -f out
- Name the cross-reference file out instead of cscope.out.
- -i in
- Check source files whose names are listed in in
rather than in cscope.files.
- -I dir
- Search for include files in dir before searching the default
(/usr/include). cscope searches the current directory, then
dir, then the default.
- -l
- Run in line mode; useful from within a screen editor.
- -L
- Use with -n pat to do a single search.
- -p n
- Show the last n parts of the filename path.
Default is 1 (filename); use 0 to suppress the filename.
- -P path
- Use with -d to prepend path to filenames in
existing cross reference. This lets you run cscope without
changing to the directory where the cross reference was built.
- -s dir
- Look for source files in directory dir
instead of in current directory.
- -T
- Match only the first eight characters of C symbols.
- -u
- Build cross reference unconditionally (assume all files changed).
- -U
- Ignore file timestamps (assume no files changed).
- -V
- Print the cscope version on first line of screen.
- -n pat
- Go to field n of input (starting at 0),
then find pat.
|
csh | csh [options] [arguments]
Command interpreter that uses syntax resembling C.
csh (the C shell) executes commands from a
terminal or a file.
See Chapter 5 for information
on the C shell, including command-line options.
|
csplit | csplit [options] file arguments
Separate file into sections and place sections in files
named xx00 through xxn (n < 100),
breaking file at each pattern specified in arguments.
See also split.
Options- -f file
- Name new files file00 through
fileN (default is xx00 through
xxn).
- -k
- Keep newly created files, even when an error occurs (which would
normally remove these files).
This is useful when you need to specify an arbitrarily large repeat
argument, {n},
and you don't want the “out of range” error to remove
the new files.
- -s
- Suppress all character counts.
ArgumentsAny one or a combination of the following expressions.
Arguments containing blanks or other special characters should be
surrounded by single quotes.
- /expr/
- Create file from the current line up to the line
containing the regular expression expr. This argument
takes an optional suffix of the form +n
or -n,
where n is the number of lines below or above expr.
- %expr%
- Same as /expr/,
except no file is created for lines previous to line containing
expr.
- num
- Create file from current line up to line number num.
- {n}
- Repeat argument n times. May follow any of the above arguments.
Files will split at instances of expr or in blocks of
num lines.
ExamplesCreate up to 20 chapter files from the file novel:
csplit -k -f chap. novel '%CHAPTER%' '{20}'
Create up to 100 address files
(xx00 through xx99),
each four lines long, from a database named address_list:
csplit -k address_list 4 {99}
|
ctags | ctags [options] files
Create a list of function and macro names that are defined in
the specified C, Pascal, FORTRAN, yacc,
or lex source
files.
Solaris ctags can also process C++ source files.
The output list (named tags by default)
contains lines of the form:
name file context
where name is the function or macro name, file is the
source file in which name is defined, and context is a
search pattern that shows the line of code containing name.
After the list of tags is created, you can invoke vi
on any file and type:
:set tags=tagsfile
:tag name
This switches the vi editor to the source file associated
with the name listed in tagsfile
(which you specify with -f).
Options- -a
- Append tag output to existing list of tags.
- -B
- context uses backward search patterns.
- -ftagsfile
- Place output in tagsfile (default is tags).
- -F
- context uses forward search patterns (default).
- -t
- Include C typedef s as tags.
- -u
- Update tags file to reflect new locations of functions (e.g.,
when functions are moved to a different source file).
Old tags are deleted; new tags are appended.
- -v
- Produce a listing (index) of each function, source file,
and page number (1 page = 64 lines).
-v is intended to create a file for use
with vgrind.
- -w
- Suppress warning messages.
- -x
- Produce a listing of each function, its line number,
source file, and context.
ExamplesStore tags in Taglist for all C programs:
ctags -f Taglist *.c
Update tags and store in Newlist:
ctags -u -f Newlist *.c
|
ctrace | ctrace [options] [file]
Debug a C program.
ctrace reads the C source file
and writes a modified version to standard output.
Common options are -f and -v.
ctrace also accepts the cc options
-D, -I, and -U.
Options
- -e
- Print variables as floating point.
- -f functions
- Trace only the specified functions.
- -l n
- Follow a statement loop n times (default is 20).
- -o
- Print variables in octal.
- -p s
- Print trace output via function s (default is printf).
- -P
- Run the C preprocessor before tracing.
- -Qc
- Print information about ctrace in output (if c = y)
or suppress information (if c = n, the default).
- -rfile
- Change the trace function package to file
(default is runtime.c).
- -s
- Suppress certain redundant code.
- -tn
- Trace n variables per statement (default is 10; maximum is 20).
- -u
- Print variables as unsigned.
- -v functions
- Do not trace the specified functions.
- -V
- Print version information on standard error.
- -x
- Print variables as floating point.
|
cut | cut options [files]
Select a list of columns or fields from one or more files.
Either -c or -f must be specified.
list is a sequence of integers.
Use a comma between separate values
and a hyphen to specify a range
(e.g., 1-10,15,20 or 50-).
See also paste
and join.
Options- -b list
- This list specifies byte positions, not character
positions.
This is important when multibyte characters are used.
With this option, lines should be 1023 bytes or less in size.
Solaris only.
- -clist
- Cut the character positions identified in list.
- -dc
- Use with -f to specify field delimiter as character c
(default is tab); special characters (e.g., a space) must be quoted.
- -flist
- Cut the fields identified in list.
- -n
- Do not split characters.
When used with -b, cut doesn't split multibyte characters.
Solaris only.
- -s
- Use with -f to suppress lines without delimiters.
ExamplesExtract usernames and real names from /etc/passwd:
cut -d: -f1,5 /etc/passwd
Find out who is logged on, but list only login names:
who | cut -d" " -f1
Cut characters in the fourth column of file, and paste them
back as the first column in the same file.
Send the results to standard output:
cut -c4 file | paste - file
|
cxref | cxref [options] files
Build a cross-reference table for each of the C source files.
The table lists all symbols, providing columns for the name and the
associated function, file, and line. In the table, symbols are marked by = if
assigned, - if declared, or * if defined.
cxref also accepts the cc options
-D, -I, and -U.
Options- -c
- Report on all files in a single table.
- -C
- Don't execute the second pass of cxref;
save output from first pass in .cx files.
(Like -c in lint and cc.)
- -d
- Simplify report by omitting print declarations.
- -F
- Print files using full pathname, not just the filename.
- -l
- Don't print local variables.
- -L[n]
- Limit the LINE field to n columns (default is 5).
- -o file
- Send output to file.
- -s
- Silent mode; don't print input filenames.
- -t
- Format for 80-column listing.
- -V
- Print version information on standard error.
- -w[n]
- Format for maximum width of n columns (default is 80; n must
be more than 50).
- -Wn1,n2,n3,n4
- Set the width of each (or any) column to
n1, n2, n3, or n4 (respective defaults
are 15, 13, 15, and 20). Column headings are NAME, FILE, FUNCTION, and
LINE, respectively.
|
date | date [option] [+format] date [options] [string]
In the first form, print the current date and time,
specifying an optional display format.
In the second form, a privileged user can set the current date by supplying
a numeric string.
format can consist of literal text strings (blanks must be quoted)
as well as field descriptors, whose values will appear as described below.
Format
%n | Insert a newline.
|
%t | Insert a tab.
|
%m | Month of year (01–12).
|
%d | Day of month (01–31).
|
%y | Last two digits of year (00–99).
|
%D | Date in %m/%d/%y format.
|
%b | Abbreviated month name.
|
%e | Day of month (1–31); pad single digits with a space.
|
%Y | Four-digit year (e.g., 1996).
|
%g | Week-based year within century (00–99).
Solaris only.
|
%G | Week-based year, including the century (0000–9999).
Solaris only.
|
%h | Same as %b.
|
%B | Full month name.
|
%H | Hour in 24-hour format (00–23).
|
%M | Minute (00–59).
|
%S | Second (00–61); 61 permits leap seconds and double leap seconds.
|
%R | Time in %H:%M format.
|
%T | Time in %H:%M:%S format.
|
%k | Hour (24-hour clock, 0–23);
single digits are preceded by a space.
Solaris only.
|
%l | Hour (12-hour clock, 1–12);
single digits are preceded by a space.
Solaris only.
|
%I | Hour in 12-hour format (01–12).
|
%p | String to indicate a.m. or p.m. (default is AM or PM).
|
%r | Time in %I:%M:%S %p format.
|
%a | Abbreviated weekday.
|
%A | Full weekday.
|
%w | Day of week (Sunday = 0).
|
%u | Weekday as a decimal number (1–7),
Sunday = 1.
Solaris only.
|
%U | Week number in year (00–53); start week on Sunday.
|
%W | Week number in year (00–53); start week on Monday.
|
%V | The ISO-8601 week number (01–53).
In ISO-8601, weeks begin on a Monday, and week 1 of the year is the
one that includes both January 4th and the first Thursday of the year.
If the first Monday of January is the 2nd, 3rd, or 4th, the preceding
days are part of the last week of the previous year.
Solaris only.
|
%j | Julian day of year (001–366).
|
%Z | Time-zone name.
|
%x | Country-specific date format.
|
%X | Country-specific time format.
|
%c | Country-specific date and time format
(default is %a %b %e %T %Z %Y;
e.g., Mon Feb 1 14:30:59 EST 1993).
|
The actual formatting is done by the strftime(3)
library routine.
On Solaris,
the country-specific formats depend on the setting of the
LC_CTYPE,
LC_TIME,
LC_MESSAGES,
and
NLSPATH
environment variables.
Options- -a s.f
- (Privileged user only.) Gradually adjust the system clock until
it drifts s seconds away from
what it thinks is the “current” time.
(This allows continuous micro-adjustment of the clock while the
system is running.)
f is the fraction of seconds by which time drifts.
By default, the clock speeds up; precede s by a -- to slow down.
- -u
- Display or set the time using Greenwich Mean Time (UTC) .
Strings for Setting the DateA privileged user can set the date by supplying a numeric string.
string consists of time, day, and year
concatenated in one of three ways: time or
[day]time or [day]time[year].
Note: don't type the brackets.
- time
- A two-digit hour and two-digit minute (HHMM); HH uses 24-hour format.
- day
- A two-digit month and two-digit day of month (mmdd);
default is current day and month.
- year
- The year specified as either the full four digits or
just the last two digits; default is current year.
ExamplesSet the date to July 1 (0701), 4 a.m. (0400), 1999 (99):
date 0701040099
The command:
date +"Hello%t Date is %D %n%t Time is %T"
produces a formatted
date as follows:
Hello Date is 05/09/93
Time is 17:53:39
|
dc | dc [file]
An interactive desk calculator program that performs arbitrary-precision
integer arithmetic (input may be taken from a file).
Normally you don't
run dc directly, since it's invoked by bc
(see bc).
dc provides a variety of one-character commands and operators
that perform arithmetic; dc works like a Reverse Polish calculator;
therefore, operators and commands follow the numbers they affect.
Operators include + - / * % ^ (as in C, although ^ means exponentiation); some simple commands include:
p | Print current result.
|
q | Quit dc.
|
c | Clear all values on the stack.
|
v | Take square root.
|
i | Change input base; similar to bc's ibase.
|
o | Change output base; similar to bc's obase.
|
k | Set scale factor (number of digits after decimal); similar to
bc's scale.
|
! | Remainder of line is a Unix command.
|
Examples
3 2 ^ p Evaluate 3 squared, then print result
9
8 * p Current value (9) times 8, then print result
72
47 - p Subtract 47 from 72, then print result
25
v p Square root of 25, then print result
5
2 o p Display current result in base 2
101
Note: spaces are not needed except between numbers.
|
dd | dd [option=value]
Make a copy of an input file (if=), or standard
input if no named input file, using the specified conditions,
and send the results to the output file (or standard output if
of is not specified). Any number of options can be supplied,
although if and of are the most common and are usually
specified first. Because dd can handle arbitrary block sizes,
it is useful when converting between raw physical devices.
Options- bs=n
- Set input and output block size to n bytes;
this option supersedes ibs and obs.
- cbs=n
- Set the size of the conversion buffer (logical record length)
to n bytes. Use only if the conversion flag
is
ascii,
asciib,
ebcdic,
ebcdicb,
ibm,
ibmb,
block, or unblock.
- conv=flags
- Convert the input according to one or more (comma-separated)
flags listed below.
The first six flags are mutually
exclusive.
The next two are mutually exclusive with each other,
as are the following two.
ascii | EBCDIC to ASCII.
|
asciib | EBCDIC to ASCII, using BSD-compatible conversions.
Solaris only.
|
ebcdic | ASCII to EBCDIC.
|
ebcdicb | ASCII to EBCDIC, using BSD-compatible conversions.
Solaris only.
|
ibm | ASCII to EBCDIC with IBM conventions.
|
ibmb | ASCII to EBCDIC with IBM conventions, using BSD-compatible conversions.
Solaris only.
|
block | Variable-length records (i.e., those terminated by a newline) to fixed-length records.
|
unblock | Fixed-length records to variable-length.
|
lcase | Uppercase to lowercase.
|
ucase | Lowercase to uppercase.
|
noerror | Continue processing when errors occur (up to five in a row).
|
notrunc | Do not truncate the output file.
This preserves blocks in the output file that this
invocation of dd did not write.
Solaris only.
|
swab | Swap all pairs of bytes.
|
sync | Pad input blocks to ibs.
|
- count=n
- Copy only n input blocks.
- files=n
- Copy n input files (e.g., from magnetic tape), then quit.
- ibs=n
- Set input block size to n bytes (default is 512).
- if=file
- Read input from file (default is standard input).
- obs=n
- Set output block size to n bytes (default is 512).
- of=file
- Write output to file (default is standard output).
- iseek=n
- Seek n blocks from start of input file
(like skip but more efficient for disk file input).
- oseek=n
- Seek n blocks from start of output file.
- seek=n
- Same as oseek (retained for compatibility).
- skip=n
- Skip n input blocks; useful with magnetic tape.
You can multiply size values (n) by a factor of 1024, 512, or 2 by
appending the letters k, b, or w, respectively.
You can use the letter x as a multiplication operator between two numbers.
ExamplesConvert an input file to all lowercase:
dd if=caps_file of=small_file conv=lcase
Retrieve variable-length data;
write it as fixed-length to out:
data_retrieval_cmd | dd of=out conv=sync,block
|
delta | /usr/ccs/bin/delta [options] files
An SCCS command. See Chapter 18.
|
deroff | deroff [options] [files]
Remove all nroff/troff requests and macros,
backslash escape sequences, and tbl and eqn constructs
from the named files.
Options- -i
- Ignore .so and .nx requests.
Solaris only.
- -mm
- Suppress text that appears on mm macro lines (i.e., paragraphs
print but headings might be stripped).
- -ml
- Same as -mm, but also deletes lists created by mm macros;
e.g., .BL/.LE,
.VL/.LE constructs.
(Nested lists are handled poorly.)
- -ms
- Suppress text that appears on ms macro lines (i.e., paragraphs
print but headings might be stripped).
Solaris only.
- -w
- Output the text as a list, one word per line.
See also the example under xargs.
|
df | df [options] [name]
Report the number of free disk blocks and inodes available on all
mounted filesystems or on the given name. (Unmounted filesystems are checked with -F.)
name can be a device name (e.g.,
/dev/dsk/0s9), the directory name of a mount point (e.g.,
/usr), a directory name, or a remote filesystem name (e.g., an
NFS filesystem). Besides the options listed, there are
additional options specific to different filesystem types or
df modules.
Options- -a
- Provide information about all filesystems, even ones usually
marked in /etc/mnttab to be ignored.
Solaris only.
- -b
- Print only the number of free kilobytes.
- -e
- Print only the number of free files.
- -F type
- Report on an unmounted filesystem specified by type.
Available types can be seen in the file /etc/vfstab.
- -g
- Print the whole statvfs structure (overriding other print options).
- -i
- /usr/ucb/df only.
Show the number of used and available inodes in a format
similar to df -k.
- -k
- Print allocation in kilobytes (typically used without other options).
This option produces output in the format traditionally used by the
BSD version of df.
- -l
- Report only on local filesystems.
- -n
- Print only the filesystem type name; with no other arguments,
-n lists the types for all mounted filesystems.
- -o suboptions
- Supply a comma-separated list of type-specific suboptions.
- -t
- Report total allocated space as well as free space.
- -V
- Echo command line but do not execute command.
|
diff | diff [options] [diroptions] file1 file2
diff reports lines that differ between file1
and file2. Output consists of lines of context from
each file, with file1 text flagged by a <
symbol and file2 text by a > symbol.
Context lines are preceded by the ed command
(a, c, or d) that converts file1 to file2. If one of the
files is –, standard input is read. If one of the
files is a directory, diff locates the filename
in that directory corresponding to the other argument (e.g.,
diff my_dir junk is the same as
diff my_dir/junk junk).
If both arguments are directories, diff
reports lines that differ between all pairs of files
having equivalent names (e.g., olddir/program
and newdir/program); in addition, diff
lists filenames unique to one directory, as well as
subdirectories common to both.
See also
bdiff,
cmp,
comm,
diff3,
dircmp,
and
sdiff.
OptionsOptions -c,
-C,
-D, -e, -f,
-h, and -n
cannot be combined with each other (they are mutually exclusive).
- -b
- Ignore repeating blanks and end-of-line blanks; treat successive blanks
as one.
- -c
- Produce output in alternate format, with three lines of context.
(This is called a “context diff.”)
- -Cn
- Like -c, but produce n lines of context.
- -D def
- Merge file1 and file2 into a single file containing
conditional C preprocessor directives (#ifdef). Defining
def and then compiling yields file2;
compiling without
defining def yields file1.
- -e
- Produce a script of commands (a, c, d) to
recreate file2 from file1
using the ed editor.
- -f
- Produce a script to recreate file1 from file2;
the script
is in the opposite order, so it isn't useful to ed.
- -h
- Do a half-hearted (but hopefully faster) comparison;
complex differences (e.g., long stretches of many
changes) may not show up;
-e and -f are disabled.
- -i
- Ignore uppercase and lowercase distinctions.
- -n
- Like -f, but counts changed lines.
rcsdiff works this way.
- -t
- Expand tabs in output lines; useful for preserving indentation changed
by -c format.
- -w
- Like -b, but ignores all spaces and tabs;
e.g., a + b is
the same as a+b.
The following
diroptions are valid only when both file arguments are
directories.
Diroptions- -l
- Long format; output is paginated by pr so that diff
listings for each file begin on a new page; other comparisons are
listed afterward.
- -r
- Run diff recursively for files in common subdirectories.
- -s
- Report files that are identical.
- -Sfile
- Begin directory comparisons with file, skipping files whose names alphabetically precede file.
|
diff3 | diff3
[options] file1 file2 file3
Compare three files and report the differences with
the following codes:
==== | All three files differ.
|
====1 | file1 is different.
|
====2 | file2 is different.
|
====3 | file3 is different.
|
Options- -e
- Create an ed script to incorporate into file1
all differences between file2 and file3.
- -E
- Same as -e, but
mark with angle brackets any lines that differ between all three files.
- -x
- Create an ed script to incorporate into file1 all
differences between all three files.
- -X
- Same as -x, but
mark with angle brackets any lines that differ between all three files.
- -3
- Create an ed script to incorporate into file1
differences between file1 and file3.
|
diffmk | diffmk oldfile newfile markedfile
A useful program for reviewing changes between drafts of a document.
diffmk compares two versions of a file (oldfile and newfile)
and creates a third file (markedfile)
that contains troff “change mark” requests.
When markedfile is formatted with nroff or troff,
the differences between the two files are marked in the margin
(via the .mc request). diffmk uses a |
to mark changed lines and a * to mark deleted lines.
Note that change marks are produced even if the changes
are inconsequential (e.g., extra blanks, different input line lengths).
ExampleTo run diffmk on multiple files, it's convenient to set up
directories in which to keep the old and new versions of your files,
and to create a directory in which to store the marked files:
$ mkdir OLD NEW CHANGED
Move your old files to OLD and your new files to NEW.
Then use this rudimentary Bourne shell script:
$ cat do.mark
for file
do
echo "Running diffmk on $file ..."
diffmk ../OLD/$file $file ../CHANGED/$file
done
You must run the script in the directory of new files:
$ cd NEW
$ do.mark Ch*
|
dircmp | dircmp [options] dir1 dir2
Compare the contents of dir1 and dir2.
See also diff and
cmp.
Options- -d
- Execute diff on files that differ.
- -s
- Don't report files that are identical.
- -wn
- Change the output
line length to n (default is 72).
|
dirname | dirname pathname
Print pathname, excluding last level.
Useful for stripping the actual filename from a pathname.
See also basename.
|
dis | /usr/ccs/bin/dis [options] files
Disassemble the object or archive files.
See also as.
Options- -C
- Display demangled C++ symbol names.
Solaris only.
- -d section
- Disassemble only the specified section of data, printing its offset.
- -D section
- Same as -d, but print the data's actual address.
- -F func
- Disassemble only the specified function; reuse -F
for additional functions.
- -l string
- Disassemble only the library file string (e.g., string
would be malloc for libmalloc.a).
- -L
- Look for C source labels in files containing debug information
(e.g., files compiled with cc -g).
- -o
- Print octal output (default is hexadecimal).
- -t section
- Same as -d, but print text output.
- -V
- Print version information on standard error.
|
dos2unix | dos2unix [options] dosfile unixfile
Solaris only.
Convert files using the DOS extended character set to their
ISO standard counterparts.
If dosfile and unixfile
are the same, the file is overwritten after the conversion is done.
See also unix2dos.
Options- -ascii
- Remove extra carriage returns and convert (remove) DOS end-of-file
characters for use under Unix.
- -iso
- Same as the default action.
- -7
- Convert 8-bit DOS graphics characters to space characters.
|
download | /usr/lib/lp/postscript/download [options] [files]
Add a font to the beginning of one or more PostScript files.
By adding a font name directly to a PostScript specification, this command can
make additional fonts available when printing a PostScript file.
download determines which fonts to add by processing
PostScript comments that begin with
%%DocumentFonts:, followed by a list of PostScript font names.
download loads the fonts whose names are listed in a map table.
This table links PostScript names with the system file that contains the
font definition. A map table for the Times font family might look like:
Times-Bold times/bold
Times-Italic times/italic
Times-Roman times/roman
Filenames that begin with a slash are used verbatim.
Otherwise, they are taken to be relative to the host font directory.
Options- -
- Read the standard input.
- -f
- Search the entire PostScript file instead of just the header comments.
Header comments such as %%DocumentFonts: (atend) redirect
download to the end of the file. Use this option when such comments
aren't present.
- -H fontdir
- Use fontdir as the directory in which font-definition files
are searched (default is /usr/lib/lp/postscript).
- -m table
- Use map table specified by file table.
A leading / in table
indicates an absolute pathname; otherwise (as in the previous option), the filename
is appended to the fontdir specified by -H.
Without -H, the default is /usr/lib/lp/postscript.
- -p printer
- Normally, download loads fonts that reside on the host machine.
With this option, download first checks for fonts that
reside on printer (by looking at
/etc/lp/printers/printer/residentfonts).
|
dpost | /usr/lib/lp/postscript/dpost [options] [files]
A postprocessor that translates troff-formatted files
into PostScript for printing.
Options- -
- Read the standard input.
- -c n
- Print n copies of each page (default is 1).
- -e 0 | 1 | 2
- Set text encoding to 0 (default), 1, or 2. Higher encoding reduces
the output size and speeds printing, but may be less reliable.
- -F dir
- Set the font directory to dir (default is /usr/lib/font).
- -H dir
- Set the host-resident font directory to dir. Files there must describe
PostScript fonts and have filenames corresponding to a
two-character troff font.
- -L file
- Set the PostScript prologue to file (default is
/usr/lib/postscript/dpost.ps,
/usr/lib/lp/postscript/dpost.ps on Solaris).
- -m scale
- Increase (multiply) the size of logical pages by factor scale (default is 1.0).
- -n n
- Print n logical pages on each sheet of output (default is 1).
- -o list
- Print only pages contained in comma-separated list.
A page range is
specified by n-m.
- -O
- Omit PostScript pictures from output. Useful when running in a networked
environment.
- -p layout
- Specify layout to be either portrait
(long side is vertical; also the default)
or landscape (long side is horizontal). layout can be
abbreviated to p or l.
- -T device
- Use device to best describe available PostScript fonts.
Default is
post, with dpost reading binary files in
/usr/lib/font/devpost.
Use of -T is discouraged;
usually the system PostScript fonts are best, if they are available.
- -w n
- Draw troff graphics (e.g., pic,
tbl) using lines that are
n points thick (default is 0.3).
- -x n
- Offset the x-coordinate of the origin n inches to the right
(if n is positive).
- -y n
- Offset the y-coordinate of the origin n inches down
(if n is positive).
Default origin is the upper-left corner of the page.
Examplepic file | tbl | eqn | troff -ms -Tpost | dpost -c2 | lp
|
du | du [options] [directories]
Print disk usage, i.e., the number of 512-byte blocks used
by each named directory and its subdirectories (default is current directory).
Options- -a
- Print usage for all files, not just subdirectories.
- -d
- Do not cross filesystem boundaries.
Solaris only.
- -k
- Print information in units of kilobytes.
- -L
- For symbolic links, process the file or directory to which the link
refers, not the link itself.
Solaris only.
- -o
- Do not add child-directory statistics to the parent directory's total.
No effect if -s is also used.
Solaris only.
- -r
- Print a “cannot open” message if a file
or directory is inaccessible.
- -s
- Print only the grand total for each named directory.
|
echo | echo [-n] [string]
Echo arguments to standard output.
Often used for producing prompts from shell scripts.
This is the /bin/echo command.
echo also exists
in /usr/ucb, and
as a command built into the Bourne, C, and Korn shells
(see Chapter 4 and Chapter 5).
Although echo is conceptually the simplest of all
Unix commands, using it in practice is complicated, because of
portability and version differences.
(Consider using printf instead.)
The following sections summarize the differences.
Version Differences- /bin/echo
- Does not accept the -n option.
Interprets the escape sequences described next.
- /usr/ucb/echo
- Accepts the -n option if it's first.
Does not interpret escape sequences.
- Bourne shell echo
- Does not accept the -n option.
Interprets the escape sequences described next, except \a.
- C shell echo
- Accepts the -n option if it's first.
Does not interpret escape sequences.
- Korn shell echo
- Searches $PATH and behaves like the first version of
echo that it finds.
Escape Sequences
\a | Alert (ASCII BEL).
(Not in /bin/sh's echo.)
|
\b | Backspace.
|
\c | Suppress the terminating newline (same as -n).
|
\f | Formfeed.
|
\n | Newline.
|
\r | Carriage return.
|
\t | Tab character.
|
\v | Vertical-tab character.
|
\\ | Backslash.
|
\0nnn | ASCII character represented by octal number nnn, where nnn
is 1, 2, or 3 digits and is preceded by a 0.
|
Examplesecho "testing printer" | lp
echo "TITLE\nTITLE" > file ; cat doc1 doc2 >> file
echo "Warning: ringing bell \07"
|
ed | ed [options] [file]
The standard text editor.
If the named file does not exist, ed creates it;
otherwise, the existing file is opened for editing.
As a line editor, ed is generally
no longer used because vi and ex
have superseded it.
Some utilities, such as diff,
continue to make use of ed command syntax.
Encryption (with -x)
can be used only in the United States.
Options- -C
- Same as -x, but assume file began in encrypted form.
- -p string
- Set string as the prompt for commands (default is *).
The P command turns the prompt display on and off.
- -s
- Suppress character counts, diagnostics, and the !
prompt for shell commands. Earlier versions of ed used plain -;
this is still accepted.
- -x
- Supply a key to encrypt or decrypt file using crypt.
|
edit | edit [options] [files]
A line-oriented text editor that runs a simplified version of ex
for novice users. The set variables report,
showmode, and magic are preset to report editing changes,
to display edit modes (when in :vi mode), and to require literal
search patterns (no metacharacters allowed), respectively.
(Encryption is not supported outside the United States.)
edit accepts the same options as ex;
see ex for a listing.
See
Chapter 8, and
Chapter 9,
for more information.
|
egrep | egrep [options] [regexp] [files]
Search one or more files for lines that match a
regular expression regexp.
egrep doesn't support the metacharacters
\(,
\),
\n,
\<,
\>,
\{,
or
\}, but does support the other metacharacters, as well as
the extended set +, ?, |,
and ( ).
Remember to enclose these characters in quotes.
Regular expressions are described in Chapter 6.
Exit status is 0 if any lines match, 1 if not, and 2 for errors.
See also grep and
fgrep.
Options- -b
- Precede each line with its block number.
(Not terribly useful.)
- -c
- Print only a count of matched lines.
- -e regexp
- Use this if regexp begins with -.
- -f file
- Take expression from file.
- -h
- List matched lines but not filenames (inverse of -l).
- -i
- Ignore uppercase and lowercase distinctions.
- -l
- List filenames but not matched lines.
- -n
- Print lines and their line numbers.
- -s
- Silent mode: print only error messages, and return the exit status.
Not on SVR4, but common on most commercial Unix systems.
- -v
- Print all lines that don't match regexp.
ExamplesSearch for occurrences of Victor or
Victoria in file:
egrep 'Victor(ia)?' file
egrep '(Victor|Victoria)' file
Find and print strings such as old.doc1 or new.doc2 in files,
and include their line numbers:
egrep -n '(old|new)\.doc?' files
|
eject | eject [options] [media]
Solaris only.
Eject removable media, such as a floppy disk or CD-ROM.
Necessary for media being managed by vold,
or for media without an eject button, such as the floppy drives on
Sun SPARC systems.
media is either a device name or a nickname,
such as floppy or cdrom.
With volume management available, eject
unmounts any filesystems mounted on the named media.
In this case, it also displays a pop-up dialog if
a window system is running.
Without volume management, it simply sends an “eject”
command to the given device.
Options- -d
- Print the name of the default device to be ejected.
- -f
- When volume management is not in effect,
force the eject, even if the device is busy.
- -n
- Display the list of nicknames and their corresponding real devices.
- -p
- Do not use a windowing pop-up dialog.
- -q
- Query to see if the device has media.
Use the exit status to determine the answer.
|
elfdump | elfdump [options] filename ...
Solaris only.
Symbolically dump parts of an object file.
files may be individual files, or
ar archives (libraries) of object files.
Options- -c
- Print section headers.
- -d
- Print the .dynamic section.
- -e
- Print the ELF header.
- -i
- Print the .interp section.
- -G
- Print the .got section.
- -h
- Print the .hash section.
- -n
- Print the .note section.
- -N name
- Qualify an option with the specific name name
(e.g., to choose a specific symbol table with -s).
- -p
- Print program headers.
- -r
- Print the relocation sections.
- -s
- Print the symbol table sections.
- -v
- Print the version sections.
- -w file
- Write the specified section to file.
|
env | env [options] [variable=value ... ] [command]
Display the current environment or, if environment variables are
specified, set them to a new value and display the modified environment. If command is specified,
execute it under the modified environment.
Options- -
- Ignore current environment entirely.
- -i
- Same as -.
Solaris only.
|
eqn | eqn [options] [files]
Equation preprocessor for troff.
See Chapter 17.
|
error | /usr/ccs/bin/error [options] [files]
Read compiler error messages, and insert them into the source files
that generated them.
This makes it easier to work during the typical
edit-compile-debug cycle.
Typical usage would be:
cc -O -c files 2>&1 | error
Options- -n
- Do not edit any files; print errors on standard output.
- -q
- Query. error prompts for a y
or n response before inserting error messages
into a file.
- -s
- Print statistics about the different kinds of errors.
- -v
- After inserting error messages into the source files,
run vi on the files.
- -t list
- Only process files whose suffixes appear in list.
Suffixes are dot-separated, and wildcards are allowed, but should be
quoted to prevent interpretation by the shell.
|
ex | ex [options] files
A line-oriented text editor; a superset of ed and the root of
vi.
See Chapter 8 and Chapter 9 for more information.
Options- -c command
- Begin edit session by executing the given ex command
(usually a search pattern or line address). If command contains
spaces or special characters, enclose it in single quotes to protect
it from the shell. For example, command could
be ':set list' (show
tabs and newlines) or /word
(search for word) or '$'
(show last line).
(Note: -c command was formerly +command.
The old version still works.)
- -l
- Run in LISP mode for editing LISP programs.
- -L
- List filenames saved due to an editor or system crash.
- -r file
- Recover and edit file after an editor or system crash.
- -R
- Edit in read-only mode to prevent accidental changing of files.
- -s
- Suppress status messages (e.g., errors, prompts);
useful when running an
ex script.
(-s was formerly
the - option;
the old version still works.)
- -t tag
- Edit the file containing tag and position the editor at its
definition (see ctags for more information).
- -v
- Invoke vi.
Running vi directly is simpler.
- -V
- Verbose; print nonterminal input on standard error. Useful
for tracking shell scripts running ex.
- -wn
- Set the window size to n.
Useful over slow dial-up (or slow Internet) connections.
- -x
- Supply a key to encrypt or decrypt file using crypt.
- -C
- Same as -x, but assume that file began in encrypted form.
ExamplesEither of the following examples applies the ex
commands in
exscript to text file doc:
ex -s doc < exscript
cat exscript | ex -s doc
|
expand | expand [options] [files]
Expand tab characters into appropriate number of spaces.
expand reads the named files
or standard input if no files are provided.
See also unexpand.
Options- -t tablist
- Interpret tabs according to tablist, a space- or
comma-separated list of numbers in ascending order, that describe
the “tabstops” for the input data.
- -n
- Set the tabstops every n characters.
The default is 8.
- -tablist
- Interpret tabs according to tablist, a space- or
comma-separated list of numbers in ascending order, that describe
the “tabstops” for the input data.
ExampleCut columns 10–12 of the input data, even when tabs are used:
expand data | cut -c 10-12 > data.col2
|
expr | expr arg1 operator arg2 [ operator arg3 ... ]
Evaluate arguments as expressions and print the result.
Strings can be compared and searched.
Arguments and operators must be separated by spaces.
In most cases, an argument is an integer, typed literally or
represented by a shell variable.
There are three types of operators: arithmetic, relational, and logical.
Exit status for expr is 0 (expression is nonzero and nonnull),
1 (expression is 0 or null), or 2 (expression is invalid).
expr is typically used in shell scripts to perform
simple mathematics, such as addition or subtraction.
It is made obsolete in the Korn shell by that program's built-in
arithmetic capabilities.
Arithmetic OperatorsUse the following operators to produce mathematical expressions whose results are printed:
+ | Add arg2 to arg1.
|
- | Subtract arg2 from arg1.
|
* | Multiply the arguments.
|
/ | Divide arg1 by arg2.
|
% | Take the remainder when arg1 is divided by arg2.
|
Addition and subtraction are evaluated last, unless they are grouped inside
parentheses. The symbols *, (, and )
have meaning to the shell,
so they must be escaped (preceded by a backslash or enclosed in single
or double
quotes).
Relational OperatorsUse relational operators to compare two arguments. Arguments can also be words, in which
case comparisons assume a < z and A < Z.
If the comparison statement is true, the result is 1; if false,
the result is 0. Symbols < and > must be escaped.
= | Are the arguments equal?
|
!= | Are the arguments different?
|
> | Is arg1 greater than arg2?
|
>= | Is arg1 greater than or equal to arg2?
|
< | Is arg1 less than arg2?
|
<= | Is arg1 less than or equal to arg2?
|
Logical OperatorsUse logical operators to compare two arguments. Depending on the values,
the result can be arg1 (or some portion of it), arg2, or 0.
Symbols | and & must be escaped.
- |
- Logical OR; if arg1 has a nonzero (and nonnull) value,
the result is arg1; otherwise, the result is arg2.
- &
- Logical AND; if both arg1 and arg2 have a nonzero
(and nonnull) value, the result is arg1; otherwise,
the result is 0.
- :
- Similar to grep;
arg2 is a pattern to search for in arg1.
arg2 must be a regular expression in this case.
If the arg2 pattern
is enclosed in \( \), the result is the portion of arg1 that matches;
otherwise, the result is simply the number of characters that match.
By default, a
pattern match always applies to the beginning of the first argument (the search
string implicitly begins with a ^).
To match other parts of the string,
start the search string with .*.
ExamplesDivision happens first; result is 10:
expr 5 + 10 / 2
Addition happens first; result is 7 (truncated from 7.5):
expr \( 5 + 10 \) / 2
Add 1 to variable i;
this is how variables are incremented in
shell scripts:
i=`expr $i + 1`
Print 1 (true) if variable a is the string “hello”:
expr $a = hello
Print 1 (true) if variable b plus 5 equals 10 or more:
expr $b + 5 \>= 10
In the following examples, variable p is the string
"version.100".
This command prints the number of characters in p:
expr $p : '.*' Result is 11
Match all characters and print them:
expr $p : '\(.*\)' Result is "version.100"
Print the number of lowercase letters at the beginning of p:
expr $p : '[a-z]*' Result is 7
Match the lowercase letters at the beginning of p:
expr $p : '\([a-z]*\)' Result is "version"
Truncate $x if it contains five or more characters;
if not, just print $x. (Logical OR uses the second argument when
the first one is 0 or null; i.e., when the match fails.)
Double-quoting is a good idea, in case $x contains
whitespace characters.
expr "$x" : '\(.....\)' \| "$x"
In a shell script, rename files to their first five letters:
mv "$x" `expr "$x" : '\(.....\)' \| "$x"`
(To avoid overwriting files with similar names, use mv -i.)
|
exstr | exstr [options] file
Extract strings from C source files, so that they can be stored in a
database and retrieved at application runtime using the gettxt
library function.
With no options, exstr produces a grep-type
list showing only filename and strings. exstr is one of several
commands to use when customizing applications for international use.
Typical use involves three steps:
Specify -e
and the C source file, and redirect the output to a file.
This creates a database of text strings and identifying information.
Edit this database by adding information that was previously returned
by the mkmsgs command.
Specify -r and the C source file,
using the edited database as input. This replaces hardcoded text strings
with calls to gettxt. gettxt lets you access translated
versions of text strings. (The strings reside in a directory specified
by environment variable LC_MESSAGES.)
Options- -d
- Use with -r to give the gettxt
call a second argument,
the original text string. This string is printed as the fallback
in case the gettxt call fails.
- -e
- Extract text strings from file. (-e is not used with other
options.) The information appears in this format:
file:line:field:msg_file:msg_num:string
file | C source file from the command line.
|
line | Line number on which the string is found in file.
|
field | Inline numerical position of the string's beginning.
|
msg_file | Initially null, but later filled in when you edit the
database. msg_file is the name of the list of message strings
you create by running the mkmsgs command.
|
msg_num | Initially null but filled in later. It corresponds to the order of
the strings in msg_file.
|
- -r
- Replace strings in the source file with calls to gettxt.
ExampleAssume a C source file named proverbs.c:
main() {
printf("Haste makes waste\n");
printf("A stitch in time\n");
}
First issue the command:
exstr -e proverbs.c > proverb.list
proverb.list might look something like this:
proverbs.c:3:8:::Haste makes waste\n
proverbs.c:4:8:::A stitch in time\n
Run mkmsgs to create a
message file (e.g., prov.US) that can be read by the gettxt call. If the two previous
proverb strings are listed ninth and tenth in prov.US, you would
edit proverb.list as follows:
proverbs.c:3:8:prov.US:9:Haste makes waste\n
proverbs.c:4:8:prov.US:10:A stitch in time\n
Finally, specify -r to insert gettxt calls:
exstr -rd proverbs.c < proverb.list > Prov.c
The internationalized version of your program,
Prov.c, now looks like
this:
extern char *gettxt();
main() {
printf(gettxt("prov.US:9",
"Haste makes waste\n"));
printf(gettxt("prov.US:10",
"A stitch in time\n"));
}
|
factor | factor [num]
Produce the prime factors of num or
read numbers from input.
|
false | false
A do-nothing command that returns an unsuccessful (nonzero) exit status.
Normally used in Bourne shell scripts. See also true.
Examples # This loop never executes
while false
do
commands
done
# This loop executes forever
until false
do
commands
done
|
fdformat | fdformat [options] [device]
Solaris only.
Format floppy disks and PCMCIA memory cards.
device is the name of the appropriate device
to format, and varies considerably based on the density of the
media, the capability of the disk drive, and whether or not
volume management is in effect.
Options- -b label
- Apply the label to the media.
SunOS labels may be up to eight characters;
DOS labels may be up to eleven uppercase characters.
- -B file
- Install bootloader in file on an
MS-DOS diskette.
Can only be used with -d
or -t dos.
- -D
- Format a 720KB (3.5 inch) or 360KB (5.25 inch)
double-density diskette
(same as -l or -L).
Use on high- or extended-density drives.
- -e
- Eject floppy disk when done.
- -E
- Format a 2.88MB (3.5 inch) extended-density diskette.
- -f
- Force. Do not prompt for confirmation before formatting.
- -H
- Format a 1.44MB (3.5 inch) or 1.2MB (5.25 inch)
high-density diskette.
Use on extended-density drive.
- -M
- Use a 1.2MB (3.5 inch) medium-density format
on a high-density diskette.
Use only with the -t nec option.
Identical to -m.
- -U
- Unmount any filesystems on the media, and then format.
- -q
- Quiet mode.
Don't print status messages.
- -v
- Verify each block on the media after formatting.
- -x
- Don't format, just write a SunOS label or MS-DOS filesystem.
- -t dos
- Install an MS-DOS filesystem and boot sector formatting.
Same as DOS format or -d.
- -t nec
- Install an NEC-DOS filesystem and boot sector after formatting.
Use only with -M.
Compatibility OptionsThese options are for compatibility with previous versions of
fdformat.
Their use is discouraged.
- -d
- Same as -t dos.
- -l
- Same as -D or -L.
- -L
- Same as -l or -D.
- -m
- Same as -M.
|
fgrep | fgrep [options] [pattern] [files]
Search one or more files for lines that match a literal, text-string
pattern. Because fgrep does not support regular expressions,
it is faster than grep
(hence fgrep, for fast grep).
Exit status is 0 if any lines match, 1 if not, and 2 for errors.
See also egrep
and grep.
Options- -b
- Precede each line with its block number.
(Not terribly useful.)
- -c
- Print only a count of matched lines.
- -e pat
- Use this if pat begins with –.
- -ffile
- Take a list of patterns from file.
- -h
- Print matched lines but not filenames
(inverse of -l).
- -i
- Ignore uppercase and lowercase distinctions.
- -l
- List filenames but not matched lines.
- -n
- Print lines and their line numbers.
- -s
- Silent mode: print only error messages, and return the exit status.
Not on SVR4, but common on most commercial Unix systems.
- -v
- Print all lines that don't match pattern.
- -x
- Print lines only if pattern matches the entire line.
ExamplesPrint lines in file that don't contain any spaces:
fgrep -v ' ' file
Print lines in file that contain the words in spell_list:
fgrep -f spell_list file
|
file | file [options] files
Classify the named files according to the type of data they contain.
file checks the magic file (usually /etc/magic)
to identify many common file types.
Options- -c
- Check the format of the magic file
(files argument is invalid with -c).
- -flist
- Run file on the filenames in list.
- -h
- Do not follow symbolic links.
- -mfile
- Use file as the magic file instead of /etc/magic.
Many file types are understood. Output lists each filename,
followed by a brief classification such as:
ascii text
c program text
c-shell commands
data
empty
iAPX 386 executable
directory
[nt]roff, tbl, or eqn input text
shell commands
symbolic link to ../usr/etc/arp
ExampleList all files that are deemed to be nroff/troff input:
file * | grep roff
|
find | find pathname(s) condition(s)
An extremely useful command for finding particular groups of files
(numerous examples follow this description).
find descends the directory tree beginning at each pathname
and locates files that meet the specified conditions. At least
one pathname and one condition must be specified.
The most useful conditions include -print (which must be explicitly
given to display any output),
-name and -type (for general use), -exec and
-size (for advanced users), and -mtime and -user
(for administrators).
On Solaris (and other recent Unix systems),
-print is the default condition if none are
provided.
Conditions may be grouped by enclosing them in \( \)
(escaped
parentheses), negated with ! (use \! in the
C shell), given as
alternatives by separating them with -o, or repeated (adding
restrictions to the match; usually only for -name,
-type, and
-perm).
The find command can often be combined with the
xargs command when there are too many files for
naming on the command line. (See xargs.)
Conditions- -atime +n | -n | n
- Find files that were last accessed more than n (+n), less
than n (-n), or exactly n days ago. Note that
find will change the access time of directories supplied as
pathnames.
- -cpio dev
- Take matching files and write them on device dev, using cpio.
Obsolete.
- -ctime +n | -n | n
- Find files that were changed more than n (+n), less than
n (-n), or exactly n days ago.
Change refers to
modification, permission or ownership changes, etc.; therefore,
-ctime is more inclusive than -atime or -mtime.
- -depth
- Descend the directory tree, skipping directories and working on actual
files first (and then the parent directories). Useful when files
reside in unwritable directories (e.g., when using find
with cpio).
- -exec command {} \;
- Run the Unix command on each file matched by find,
provided command executes successfully on that file;
i.e., returns a 0 exit status. When command runs,
the argument {} substitutes the current file.
Follow the entire sequence with an escaped semicolon (\;).
- -follow
- Follow symbolic links and track the directories visited
(don't use this with -type l).
- -fstype type
- Find files that reside on filesystems of type type.
- -group gname
- Find files belonging to group gname. gname can be a group
name or a group ID number.
- -inum n
- Find files whose inode number is n.
- -links n
- Find files having n links.
- -local
- Find files that physically reside on the local system.
- -ls
- Display matching files with associated statistics (as if run through
ls -lids).
- -mount
- Search for files that reside only on the same filesystem as pathname.
- -mtime +n | -n | n
- Find files that were last modified more than n (+n), less
than n (-n), or exactly n days ago.
- -name pattern
- Find files whose names match pattern. Filename metacharacters
may be used, but should be escaped or quoted.
- -ncpio dev
- Take matching files and write them on device dev, using cpio -c.
Obsolete.
- -newer file
- Find files that have been modified more recently than file;
similar to -mtime.
- -nogroup
- Find files belonging to a group not in /etc/group.
- -nouser
- Find files owned by a user not in /etc/passwd.
- -ok command {} \;
- Same as -exec, but user must respond (with a y)
before command is executed.
- -perm nnn
- Find files whose permission settings (e.g., rwx) match octal number
nnn exactly (e.g., 664 matches -rw-rw-r--).
Use a minus
sign to make a wildcard match of any specified bit (e.g.,
-perm -600 matches -rw******,
where * can be any mode).
Some systems also allow +nnn
for this purpose.
Solaris allows nnn to be a symbolic mode in the
same form as allowed by chmod.
- -print
- Print the matching files and directories, using their full pathnames.
On Solaris, this is the default.
- -prune
- “Prune” the directory tree of unwanted directory searches; that is,
skip the directory most recently matched.
- -size n[c]
- Find files containing n blocks, or, if c is
specified, files that are n characters (bytes) long.
(One block = 512 bytes).
- -type c
- Find files whose type is c.
c can be:
b | Block special file |
c | Character special file |
d | Directory |
D | Door special file, Solaris only |
f | Plain file |
l | Symbolic link |
p | Fifo or named pipe |
s | Socket |
- -user user
- Find files belonging to a user name or ID.
- -xdev
- Same as -mount.
Solaris (and some BSD systems) only.
ExamplesList all files (and subdirectories) in your home directory:
find $HOME -print
List all files named chapter1 underneath
the /work directory:
find /work -name chapter1 -print
List “memo” files owned by ann
(note the use of multiple starting paths):
find /work /usr -name 'memo*' -user ann -print
Search the filesystem (begin at root) for manpage directories:
find / -type d -name 'man*' -print
Search the current directory, look for filenames that don't
begin with a capital letter, and send them to the printer:
find . \! -name '[A-Z]*' -exec lp {} \;
Find and compress files whose names don't
end with .Z:
compress `find . -type f \! -name '*.Z' -print`
Remove all empty files on the system (prompting first):
find / -size 0 -ok rm {} \;
Skip RCS directories, but list remaining read-only files:
find . -name RCS -prune -o -perm 444 -print
Search the system for files that were modified within the last
two days (good candidates for backing up):
find / -mtime -2 -print
Recursively grep for a pattern down a directory tree:
find /book -print | xargs grep '[Nn]utshell'
|
finger | finger [options] users
Display data about one or more users, including information
listed in the files .plan and .project in user's
home directory. You can specify each user either as a login name
(exact match) or as a first or last name (display information on all
matching names). Networked environments recognize arguments of the form
user@host and @host.
(Today, many systems on the Internet disallow
connections from finger requests.)
Options- -b
- Omit user's home directory and shell from display.
- -f
- Used with -s to omit heading that normally displays in short
format.
- -h
- Omit .project file from display.
- -i
- Show “idle” format, a terse format (like -s).
- -l
- Force long format (default).
- -m
- users must match usernames exactly, instead of also searching
for a match of first or last names.
- -p
- Omit .plan file from display.
- -q
- Show “quick” format, the tersest of all (requires an exact match of
username).
- -s
- Show short format.
- -w
- Used with -s to omit user's full name that normally displays in
short format.
|
fmt | fmt [options] [files]
Fill and join text, producing lines of roughly the same length.
(Unlike nroff, the lines are not justified.)
fmt ignores
blank lines and lines beginning with a dot (.) or
with “From:”.
The emacs editor uses ESC-q to join paragraphs,
so fmt is
useful for other editors, such as vi.
The
following vi command
fills and joins the remainder of the current paragraph:
!}fmt
Options- -c
- Don't adjust the first two lines; align subsequent lines with the
second line. Useful for paragraphs that begin with a hanging tag.
- -s
- Split long lines but leave short lines alone. Useful for preserving
partial lines of code.
- -w n
- Create lines no longer than n columns wide. Default is 72.
(Can also be invoked as -n for compatibility with BSD.)
|
ftp | ftp [options] [hostname]
Transfer files to and from remote network site hostname.
ftp prompts the user for a command.
Type help to see a list of known commands.
Options- -d
- Enable debugging.
- -g
- Disable filename expansion (globbing).
- -i
- Turn off interactive prompting.
- -n
- No auto-login upon initial connection.
- -v
- Verbose on. Show all responses from remote server.
|
gcore | gcore [option] process_ids
Create (“get”) a core image of each running process specified.
The core image can be used with a debugger.
You must own the running process or be a privileged user to use this command.
Option- -o file
- Create core
file named file.process_id
(default is
core.process_id).
|
gencat | gencat [option] database msgfiles
Append (or merge) messages contained in one or more msgfiles
with the formatted message database file.
If database doesn't exist,
it is created. Each message in msgfile is preceded by a numerical
identifier. Comment lines can be added by using a dollar sign at the
beginning of a line, followed by a space or tab.
See also genmsg
and mkmsgs.
Option- -m
- Build a single database that is backward-compatible with databases
created by earlier versions of gencat. SVR4 only.
|
genmsg | genmsg [options] files ...
Solaris only.
Extract messages strings from source code that uses
catgets(3C) for further processing
with gencat.
The purpose of this command is to create the initial data
for use by a translator when internationalizing an application.
See also gencat
and mkmsgs.
Options- -a
- Append (merge) the output into the file specified by -o.
- -b
- Place extracted comments after the corresponding message,
instead of before it.
- -c tag
- Extract messages containing tag and
write them, prefixed by $, in a comment in the
output file.
- -d
- Also add the original messages as comments in the output file.
- -f
- With -r, overwrite the original input files.
With -l, also overwrite the project files.
- -g file
- Create file as a project file,
listing set numbers and their maximum message numbers.
- -l file
- Use information in file as a project file
to calculate new message numbers.
- -m prefix
- Fill in the message with prefix.
Intended for testing.
- -M suffix
- Fill in the message with suffix.
Intended for testing.
- -n
- Add comments in the output indicating the original file's
name and line number for the message.
- -o msgfile
- Put the output in msgfile.
- -p preprocessor
- Run the source files through preprocessor
before extracting messages.
- -r
- Replace message numbers with -1 (negative one).
Reverse action of -l.
- -s tag
- Extract comments of the form
/* SET tag */
from the source files.
Write them to the output as comments, prefixed with $.
Only the first matching comment for tag is extracted.
- -t
- Triple the lengths of extracted messages.
Intended for testing.
- -x
- Don't warn about message and set number range checks
and conflicts.
|
get | /usr/ccs/bin/get [options] files
An SCCS command. See Chapter 18.
|
getconf | getconf [-v spec] system_var getconf [-v spec] path_var path getconf -a
Solaris only.
This command is specified by POSIX as a portable way of
determining system limits.
In the first form,
print the value of system configuration variables.
In the second, print the value of filesystem-related parameters.
In the third, print the values of all system configuration variables.
Options- -a
- Print the names and values of all system configuration variables.
- -v spec
- Use spec to govern the selection
of values for configuration variables.
|
getopts | getopts string name [arg]
Same as built-in Bourne shell command getopts.
See Chapter 4.
|
gettext | gettext [domain] string
Solaris only.
Retrieve and print the translated version of string.
This provides shell-level access to the facilities
of gettext(3C).
Translations are looked up in
/usr/lib/locale/lang/LC_MESSAGES/domain.mo.
lang is the current locale (e.g., en_US).
If domain is not supplied, the value of
$TEXTDOMAIN is used instead.
Without a domain, or if no translation can be found,
gettext simply prints string.
If $TEXTDOMAINDR exists, its value is used instead of
/usr/lib/locale/.
|
gettxt | gettxt msgfile:msgnum [default_message]
Obtain the message that resides in file msgfile and whose
message ID is msgnum.
msgnum is a number from 1 to n,
where n is the number of messages in msgfile.
gettxt searches for msgfile in directory
/usr/lib/locale/locale/LC_MESSAGES,
where locale
is the language in which the message strings have been written.
The value of locale is set by the environment variable LC_MESSAGES,
or failing that, the LANG environment variable. If neither is set,
locale defaults to a directory named C.
If gettxt fails,
it displays default_message or (if none is specified) the string,
“Message not found!!”
|
gprof | /usr/ccs/bin/gprof [options] [objfile [pfile]]
Solaris only.
(Many other modern Unix systems also have it.)
Display call-graph profile data of C programs.
Programs compiled with the -xpg option of cc
(-pg on other
compilers) produce a call-graph profile file pfile, whose default
name is gmon.out. The specified object file objfile
(a.out by default) contains a symbol table that is read and
correlated with pfile.
See also prof and lprof.
Options- -a
- Don't print statically declared functions.
- -b
- Brief; don't print field descriptions in the profile.
- -c
- Find the program's static call-graph. Call counts of 0 indicate
static-only parents or children.
- -C
- Demangle C++ symbol names before printing them out.
- -D
- With this option, you supply one or more existing pfiles.
Process the information in all specified profile files and produce
profile file called gmon.sum that shows the difference
between the runs.
See also the -s option below.
- -e name
- Don't print the graph profile entry for the routine
name. -e may be repeated.
- -E name
- Like -e above. In addition, during time computations,
omit the time spent in name.
- -f name
- Print the graph profile entry only for routine name.
-f may be repeated.
- -F name
- Like -f above. In addition, during time computations,
use only the times of the printed routines.
-F may be repeated, and it overrides -E.
- -l
- Don't print entries for local symbols.
- -s
- With this option, you supply one or more existing pfiles.
Sum the information in all specified profile files and send it to a
profile file called gmon.sum.
Useful for accumulating data across several runs.
- -z
- Show routines that have zero usage. Useful with -c
to find out which routines were never called.
- -n
- Only print the top n functions.
|
grep | grep [options] regexp [files]
Search one or more files for lines that match a
regular expression regexp. Regular expressions are described
in Chapter 6.
Exit status is 0 if any lines match, 1 if not, and 2 for errors.
See also egrep and fgrep.
Options- -b
- Precede each line with its block number.
(Not terribly useful.)
- -c
- Print only a count of matched lines.
- -e pat
- Use this if pat begins with –.
Solaris: this option is only available
in /usr/xpg4/bin/grep,
not /usr/bin/grep.
It is common, though, on many modern Unix systems.
- -h
- Print matched lines but not filenames
(inverse of -l).
- -i
- Ignore uppercase and lowercase distinctions.
- -l
- List filenames but not matched lines.
- -n
- Print lines and their line numbers.
- -s
- Suppress error messages for nonexistent or unreadable files.
- -v
- Print all lines that don't match regexp.
- -w
- Restrict regexp to matching a whole word
(like using \< and \> in vi).
Not on SVR4, but common on many commercial Unix systems.
ExamplesList the number of users who use the C shell:
grep -c /bin/csh /etc/passwd
List header files that have at least one #include directive:
grep -l '^#include' /usr/include/*
List files that don't contain pattern:
grep -c pattern files | grep :0
|
groups | groups [user]
Show the groups that user belongs to (default is your groups).
Groups are listed in /etc/passwd and /etc/group.
|
gunzip | gunzip [gzip options] [files]
Identical to gzip -d.
Typically provided as a hard link to gzip.
The -1 ... -9
and corresponding long-form
options are not available with gunzip; all other
gzip options are accepted.
See gzip for more information.
|
gzcat | gzcat [gzip options] [files]
A link to gzip instead of using the name zcat,
which preserves zcat's original link to compress.
Its action is identical to gunzip -c.
May be installed
as zcat on some systems.
See gzip
for more information.
|
gzip | gzip [options] [files]
GNU Zip.
Reduce the size of one or more files using
Lempel-Ziv (LZ77) coding,
and move to file.gz.
Restore with gunzip.
With a filename of -, or with no files,
gzip reads standard input.
Usually, compression is considerably better than that
provided by compress.
Furthermore, the algorithm is patent-free.
gzip ignores symbolic links.
The original file's name, permissions, and modification time are
stored in the compressed file, and restored when the file is uncompressed.
gzip is capable of uncompressing files that were compressed
with
compress,
pack,
or the BSD
compact.
Default options may be placed in the environment variable GZIP.
gunzip is equivalent to gzip -d.
It is typically a hard link to the gzip command.
gzcat and zcat are equivalent to
gunzip -c, and are also often hard links to gzip.
Note: while not distributed with SVR4 or Solaris, gzip is the
de facto standard file compression program for files available over
the Internet.
Source code can be obtained from the Free Software Foundation
(http://www.gnu.org).
Precompiled binaries for Solaris can be obtained from
http://www.sunfreeware.com.
gzip also has its own web site: see
http://www.gzip.org.
OptionsLike most GNU programs, gzip has both short and long
versions of its command-line options:
- -a, --ascii
- ASCII text mode: convert end-of-lines using local conventions.
Not supported on all systems.
- -c, --stdout, --to-stdout
- Write output on standard output; keep original files unchanged.
Individual input files are compressed separately; for better compression,
concatenate all the input files first.
- -d, --decompress, --uncompress
- Decompress.
- -f, --force
- Force. The file is compressed or decompressed, even if the target
file exists or if the file has multiple links.
- -h, --help
- Display a help screen and exit.
- -l, --list
- List the compressed and uncompressed sizes, the compression ratio,
and the original name of the file for each compressed file.
With --verbose, also list the compression method, the
32-bit CRC, and the original file's last-modification time.
With --quiet, the title and totals lines are not displayed.
- -L, --license
- Display the gzip license and quit.
- -n, --no-name
- For gzip, do not save the original filename and
modification time in the compressed file.
For gunzip, do not restore the original name and
modification time; use those of the compressed file
(this is the default).
- -N, --name
- For gzip, save the original filename and modification time
in the compressed file (this is the default).
For gunzip, restore the original filename and
modification time based on the information in the compressed file.
- -q, --quiet
- Suppress all warnings.
- -r, --recursive
- Recursively walk the current directory tree and compress
(for gunzip, uncompress) all files found.
- -S .suf, --suffix .suf
- Use .suf as the suffix instead of .gz.
A null suffix makes gunzip attempt decompression
on all named files, no matter what their suffix.
- -t, --test
- Check the compressed file integrity.
- -v, --verbose
- Display the name and percentage reduction for
each file compressed or decompressed.
- -V, --version
- Display the version number and compilation options, and then quit.
- -n, --fast, --best
- Control the compression method.
n is a number between 1 and 9.
-1 (same as --fast) gives the fastest, but least
compressed method.
-9 (same as --best) gives the best compression,
but is slower.
Values between 1 and 9 vary the tradeoff in compression method.
The default compression level is -6, which gives better
compression at some expense in speed.
In practice, the default is excellent, and you should not need to
use these options.
|
head | head [options] [files]
Print the first few lines of one or more files
(default is 10).
Options- -n
- Print the first n lines of the file.
- -n n
- Print the first n lines of the file.
Solaris only.
ExamplesDisplay the first 20 lines of phone_list:
head -20 phone_list
Display the first 10 phone numbers having a 202 area code:
grep '(202)' phone_list | head
|
help | /usr/ccs/bin/help [commands | error_codes]
An SCCS command. See Chapter 18.
|
hostid | hostid
Print the hexadecimal ID number of the host machine.
|
hostname | hostname [newhost]
Print the name of the host machine. Often the same as uname.
A privileged user can change the hostname to newhost.
|
iconv | iconv -f from_encoding -t to_encoding [file]
Convert the contents of file from one character set (from_encoding)
to another (to_encoding). If the destination character set provides
no equivalent for a character, it is converted to an underscore
(_).
Supported conversion sets are listed in the directory /usr/lib/iconv.
|
id | id [-a]
List user and group IDs; list all groups with -a.
When you're running an su session as another
user, id displays this user's information.
|
indxbib | indxbib files
Part of the refer suite of programs.
See Chapter 17.
|
ipcrm | ipcrm [options]
Remove a message queue, semaphore set, or shared memory identifier as
specified by the options. ipcrm is useful for freeing shared
memory left behind by programs that failed to deallocate the space.
Use ipcs first to list items to remove.
Options- -m shmid
- Remove shared memory identifier shmid.
- -M shmkey
- Remove shmid created with key shmkey.
- -q msqid
- Remove message queue identifier msqid.
- -Q msgkey
- Remove msqid created with key msgkey.
- -s semid
- Remove semaphore identifier semid.
- -S semkey
- Remove semid created with key semkey.
|
ipcs | ipcs [options]
Print data about active interprocess communication
facilities.
Options- -m
- Report on active shared memory segments.
- -q
- Report on active message queues.
- -s
- Report on active semaphores.
With the -m, -q, or -s options, only the specified
interprocess facility is reported on. Otherwise, information about
all three is printed.
- -a
- Use almost all the print options (short for -bcopt).
- -A
- Use all of the print options (short for -bciopt).
Solaris only.
- -b
- Report maximum allowed number of message bytes, segment sizes, and number of
semaphores.
- -c
- Report the creator's login name and group.
- -Cfile
- Read status from file instead of from /dev/kmem.
- -i
- Report the number of shared-memory attaches to the segment.
Solaris only.
- -Nlist
- Use the argument for the kernel “name list”
(the list of functions and variables in the kernel)
instead of /stand/unix (Solaris: /dev/ksyms).
- -o
- Report outstanding usage.
- -p
- Report process numbers.
- -t
- Report time information.
|
jar | /usr/java/bin/jar [options] [manifest] dest files
Solaris only.
Java archive tool.
All the named objects and directory trees (if directories are
given) are combined into a single Java archive,
presumably
for downloading.
jar is based on the ZIP and ZLIB
compression formats; zip and unzip can
process .jar files with no trouble.
If a manifest is not provided,
jar creates one automatically.
The manifest becomes the first entry in the archive, and it
contains any needed metainformation about the archive.
Usage is similar to tar, in that the leading
– may be omitted from the options.
Options- -c
- Create a new or empty archive to standard output.
- -f
- The second argument, dest, is the
archive to process.
- -M
- Use specified manifest instead of
creating a manifest file.
- -m
- Don't create a manifest file.
- -o
- Don't compress the files with ZIP compression.
- -t
- Print a table of contents for the archive on standard output.
- -v
- Produce verbose output to standard error.
- -x[file]
- Extract named file, or all files
if no file given.
|
java | /usr/java/bin/java [options] classname [args]
Solaris only.
Compile and then run Java bytecode class files.
By default, the compiler uses the JIT (“Just In Time”)
compiler for the current system.
args are passed on to the Java program's
main method.
See also java_g.
Options- -cs, -checksource
- Compare the source code file's modification time to that of
the compiled class file, and recompile if it is newer.
- -classpath path
- Use path as the search path for class
files, overriding $CLASSPATH.
path is a colon-separated list of directories.
- -debug
- Print a password that must be used for debugging and allow
jdb to attach itself to the session.
(See jdb.)
- -Dprop=val
- Redefine the value of prop to be
val.
This option may be used any number of times.
- -fullversion
- Print full version information.
- -help
- Print a usage message.
- -ms size
- Set the initial size of the heap to size,
which is in bytes.
Append k or m to
specify kilobytes or megabytes, respectively.
The default heap size is 4MB.
- -mx size
- Set the maximum size of the heap to size,
which is in bytes.
Append k or m to
specify kilobytes or megabytes, respectively.
The default maximum size is 16MB.
The value must be greater than 1000 bytes and greater than
or equal to the initial heap size.
- -noasyncgc
- Disable asynchronous garbage collection.
- -noclassgc
- Disable garbage collection of Java classes.
- -noverify
- Disable verification.
- -oss size
- Set the maximum stack size of Java code in a Java thread.
Append k or m to
specify kilobytes or megabytes, respectively.
The default maximum size is 400KB.
- -prof[:file]
- java_g only.
Enable Java runtime profiling.
Place the trace in the named file, if supplied.
Otherwise, use ./java.prof.
- -ss size
- Set the maximum stack size of C code in a Java thread.
Append k or m to
specify kilobytes or megabytes, respectively.
The default maximum size is 128KB.
- -t
- java_g only.
Trace the executed instructions.
- -v, -verbose
- Print a message to standard output each time a class
file is loaded.
- -verbosegc
- Print a message every time the garbage collector frees memory.
- -verify
- Run the byte-code verifier on all code.
- -verifyremote
- Run the verifier on all code loaded via a classloader.
This is the default when interpreting.
- -version
- Display version
information for java.
|
java_g | /usr/java/bin/java_g [options] classname [args]
Solaris only.
java_g is the nonoptimizing version of the Java
interpreter.
It is intended for use with a Java debugger, such as jdb.
Otherwise, it accepts the same options and works the same as java.
See the entry for java for more information.
|
javac | javac [options] files
Solaris only.
Compile Java source code into Java bytecode,
for execution with java.
Java source files must have a .java suffix and
must be named for the class whose code they contain.
The generated bytecode files have a .class suffix.
By default, class files are created in the same directory as the
corresponding source files.
Use the CLASSPATH variable to list directories and/or ZIP files
that javac will search to find your classes.
Options- -classpath path
- Use the colon-separated list of directories in path
instead of CLASSPATH to find class files.
It is usually a good idea to have the current directory (“.”)
on the search path.
- -d dir
- Specify where to create generated class files.
- -depend
- Recompile missing or out-of-date class files referenced from other
class files, not just from source code.
- -deprecation
- Warn about every use or override of a deprecated member or class,
instead of warning at the end.
- -encoding encoding
- The source file is encoded using encoding.
Without this option, the system's default converter is used.
- -g
- Generate debugging tables with line numbers.
With -O, also generate information about
local variables.
- -Joption
- Pass option to java.
option should not contain spaces; use multiple
-J options if necessary.
- -nowarn
- Disable all warnings.
- -O
- Perform optimizations that may produce faster but larger class files.
It may also slow down compilation.
This option should be used with discretion.
- -verbose
- Print messages as files are compiled and loaded.
|
javadoc | /usr/java/bin/javadoc [options] files | classes
Solaris only.
Process declaration and documentation comments in Java source
files and produce HTML pages describing the public and protected
classes, interfaces, constructors, methods, and fields.
javadoc also produces a class hierarchy
in tree.html
and an index of members in Allnames.html.
Options- -author
- Include @author tags.
- -classpath path
- Use path as the search path for class
files, overriding $CLASSPATH.
path is a colon-separated list of directories.
It is better to use -sourcepath instead
of -classpath.
- -d dir
- Create the generated HTML files in dir.
- -docencoding encoding
- Use encoding for the generated HTML file.
- -encoding encoding
- The Java source file is encoded using encoding.
- -J opt
- Pass opt to the runtime system.
See java for more information.
- -nodeprecated
- Exclude paragraphs marked with @deprecated.
- -noindex
- Don't generate the package index.
- -notree
- Don't generate the class and interface hierarchy.
- -package
- Include only package, protected and public classes and members.
- -private
- Include all classes and members.
- -protected
- Include only protected and public classes and members.
This is the default.
- -public
- Include only public classes and members.
- -sourcepath path
- Use path as the search path for class
source files.
path is a colon-separated list of directories.
If not specified, it defaults to the current -classpath
directory.
Running javadoc in the directory with the sources
allows you to omit this option.
- -verbose
- Print additional messages about time spent parsing source files.
- -version
- Include @version tags.
The -doctype option is no longer available.
Only HTML documentation may be produced.
|
javah | /usr/java/bin/javah [options] classes | files
Solaris only.
Generate C header and/or source files for implementing native
methods.
The generated .h file defines a structure whose
members parallel those of the corresponding Java class.
The header filename is derived from the corresponding Java class.
If the class is inside a package, the package name is prepended to the
filename and the structure name, separated by an underscore.
Note: the Java Native Interface (JNI) does not require header or stub
files. Use the -jni option to
create function prototypes for JNI native methods.
Options- -classpath path
- Use path as the search path for class
files, overriding $CLASSPATH.
path is a colon-separated list of directories.
- -d dir
- Place generated files in dir.
- -help
- Print a help message.
- -jni
- Produce JNI native method function prototypes.
- -o file
- Concatenate all generated header or source files for all the
classes and write them to file.
- -stubs
- Generate C declarations, not headers.
- -td dir
- Use dir as the directory for temporary files,
instead of /tmp.
- -trace
- Add tracing information to the generated stubs.
- -v
- Verbose.
- -version
- Print the version of javah.
|
javakey | /usr/java/bin/javakey [options]
Solaris only.
Java security tool.
Use javakey to generate digital signatures for
archive files, and to build and manage a database of entities, their
keys and certificates, and indications of their “trusted”
(or nontrusted) status.
The leading – on options may be omitted.
Only one option may be specified per javakey invocation.
OptionsIn the option arguments below, an id_or_signer
is either a secure ID or a secure signer already in the database.
- -c identity [true | false]
- Create a new database identity named identity.
The optional true or false is
an indication as to whether the identity can be
trusted.
The default is false.
- -cs signer [true | false]
- Create a new signer in the database named signer.
The optional true or false is
an indication of whether the signer can be
trusted.
The default is false.
- -dc file
- Display the certificate in file.
- -ec id_or_signer cnum cfile
- Export certificate cnum from id
or signer to cfile.
The number must be one previously created by javakey.
- -ek id_or_signer public [private]
- Export the public key for id or signer
to file public.
Optionally, export the private key to file private.
The keys must be in X.509 format.
- -g signer algorithm ksize [public] [private]
- Shortcut for -gk to generate
a key pair for signer.
- -gc file
- Generate a certificate according to the directives in file.
- -gk signer algorithm ksize [public] [private]
- Generate a key pair for signer using standard
algorithm algorithm, with a key-size
of ksize bits.
The public key is placed in the file public,
and the private key in file private.
Exporting private keys should be done with caution.
- -gs dfile jarfile
- Sign the Java Archive file jarfile
according to directives in dfile.
- -ic id_or_signer csrcfile
- Associate the public key certificate in csrcfile
with the named id or signer.
This certificate must match a preexisting one, if there is one.
Otherwise, this certificate is assigned to the id
or signer.
- -ii id_or_signer
- Supply information about the id or
signer.
javakey reads information typed interactively.
End the information with a line containing a single dot.
- -ik identity ksrcfile
- Associate the public key in ksrcfile
with identity.
The key must be in X.509 format.
- -ikp signer public private
- Import the key pair from files public and
private and associate them with signer.
The keys must be in X.509 format.
- -l
- List the usernames of all identities and signers in the database.
- -ld
- Like -l, but provide detailed information.
- -li id_or_signer
- Provide detailed information just about the named id
or signer.
- -r id_or_signer
- Remove the id or signer
from the database.
- -t id_or_signer [true | false]
- Set or reset the trust level for id or signer.
ExamplesCreate a new identity, arnold, who is to be trusted:
javakey -c arnold true
List detailed information about arnold:
javakey -li arnold
|
javald | /usr/java/bin/javald [options] class
Solaris only.
Create a wrapper for Java applications.
javald creates a program that, when executed,
runs the specified Java program in the proper environment.
This hides knowledge of the proper CLASSPATH environment variable,
and so on, from the user who just wishes to run the application.
Options- -C path
- Add path to the CLASSPATH that runs
the application. This option may be provided multiple times.
- -H dir
- Set the JAVA_HOME environment variable to dir.
- -j list
- Pass list on to java.
Multiple options should be quoted.
- -o wrapper
- Place the generated wrapper in file wrapper.
- -R path
- Add path to the LD_LIBRARY_PATH
environment variable that is used when the application runs.
This allows java to find native
methods.
|
javap | /usr/java/bin/javap [options] classfiles
Solaris only.
Disassemble Java class files and print the results.
By default, javap prints the public fields and
methods of the named classes.
Options- -b
- Ignored.
For backward compatibility with the JDK 1.1 javap.
- -c
- Print out the disassembled byte-codes for each method in the given classes.
- -classpath path
- Use path as the search path for class
files, overriding $CLASSPATH.
path is a colon-separated list of directories.
- -h
- Generate code that can be used in a C header file.
- -J option
- Pass option directly to java.
- -l
- Display line number and local variable information.
- -package
- Only disassemble package, protected and public classes and members.
This is the default.
- -private
- Disassemble all classes and members.
- -protected
- Only disassemble protected and public classes and members.
- -public
- Only disassemble public classes and members.
- -s
- Display the internal type signatures.
- -verbose
- For each method, print the stack size, number of arguments, and
number of local variables.
- -verify
- Run the Java verifier.
- -version
- Print the version of javap.
|
jdb | /usr/java/bin/jdb [options] [class]
Solaris only.
jdb is the
Java Debugger.
It is a line-oriented debugger, similar to traditional Unix debuggers,
providing inspection and debugging of local or remote Java interpreters.
jdb can be used in place of java,
in which case the program to be run is already started in the debugger.
Or, it may be used to attach to an already running java
session.
In the latter case, java must have been started
with the -debug option.
This option generates a password you then supply on the
jdb command line.
Options- -host host
- Attach to the running Java interpreter on host.
- -password password
- Use password to connect to the already
running Java interpreter.
This password is supplied by java -debug.
|
join | join [options] file1 file2
Join the common lines of sorted file1 and sorted
file2. Read standard input if file1 is -.
The output contains the common field and the
remainder of each line from file1 and file2.
In the options below, n can be 1 or 2,
referring to file1 or file2.
Options- -a[n]
- List unpairable lines in file n
(or both if n is omitted).
Solaris does not allow omission of n.
- -e s
- Replace any empty output field with the string s.
- -jn m
- Join on the m th field of file n
(or both files if n is omitted).
- -o n.m
- Each output line contains fields specified by file number n and field
number m. The common field is suppressed unless requested.
- -tc
- Use character c as field separator for input and
output.
- -v n
- Print only the unpairable lines in file n.
With both -v 1 and -v 2, all
unpairable lines are printed.
Solaris only.
- -1 m
- Join on field m of file 1.
Fields start with 1.
Solaris only.
- -2 m
- Join on field m of file 2.
Fields start with 1.
Solaris only.
ExamplesAssuming the following input files:
$ cat score
olga 81 91
rene 82 92
zack 83 93
$ cat grade
olga B A
rene B A
List scores followed by grades, including unmatched
lines:
$ join -a1 score grade
olga 81 91 B A
rene 82 92 B A
zack 83 93
Pair each score with its grade:
$ join -o 1.1 1.2 2.2 1.3 2.3 score grade
olga 81 B 91 A
rene 82 B 92 A
|
jre | /usr/java/bin/jre [options] class [arguments]
Solaris only.
Java Runtime Environment.
This program actually executes compiled Java files.
Options- -classpath path
- Use path as the search path for class
files, overriding $CLASSPATH.
path is a colon-separated list of directories.
- -cp pathlist
- Prepend one or more paths to the value of $CLASSPATH.
Use a colon-separated list when supplying multiple paths.
Components may be either directories or full pathnames to files
to be executed.
- -Dprop=val
- Redefine the value of prop to be
val.
This option may be used any number of times.
- -help
- Print a usage message.
- -ms size
- Set the initial size of the heap to size,
which is in bytes.
Append k or m to
specify kilobytes or megabytes, respectively.
- -mx size
- Set the maximum size of the heap to size,
which is in bytes.
Append k or m to
specify kilobytes or megabytes, respectively.
- -noasyncgc
- Disable asynchronous garbage collection.
- -noclassgc
- Disable garbage collection of Java classes.
- -nojit
- Don't do JIT (“just in time”) compilation;
use the default interpreter instead.
- -noverify
- Disable verification.
- -oss size
- Set the maximum stack size of Java code in a Java thread.
Append k or m to
specify kilobytes or megabytes, respectively.
The default maximum size is 400KB.
- -ss size
- Set the maximum stack size of C code in a Java thread.
Append k or m to
specify kilobytes or megabytes, respectively.
The default maximum size is 128KB.
- -v, -verbose
- Print a message to standard output each time a class
file is loaded.
- -verbosegc
- Print a message every time the garbage collector frees memory.
- -verify
- Run the byte-code verifier on all code.
Note that this only verifies byte-codes that are actually executed.
- -verifyremote
- Run the verifier on all code loaded via a classloader.
This is the default when interpreting.
|
jsh | jsh [options] [arguments]
Job control version of sh (the Bourne shell).
This provides
control of background and foreground processes for the standard shell.
See Chapter 4.
|
keylogin | keylogin [-r]
Solaris only.
Prompt user for a password, then use it to decrypt
the person's secret key. This key is used by secure network
services (e.g., Secure NFS, NIS+).
keylogin is needed only if the user isn't
prompted for a password when logging in.
The -r option updates /etc/.rootkey.
Only a privileged user may use this option.
See also chkey
and keylogout.
|
keylogout | keylogout [option]
Solaris only.
Revoke access to (delete) the secret key used by
secure network services (e.g., Secure NFS, NIS+).
See also
chkey
and keylogin.
Option- -f
- Forget the root key. If specified on a server,
NFS security is broken. Use with care.
|
kill | kill [options] IDs
Terminate one or more process IDs.
You must own the process or be a privileged user.
This command is similar to the kill command that
is built in to the Bourne, Korn, and C shells.
A minus sign before an ID specifies a process group ID.
(The built-in version doesn't allow process group IDs,
but it does allow job IDs.)
Options- -l
- List the signal names. (Used by itself.)
- -s signal
- Send signal signal to the given process or process group.
The signal number
(from /usr/include/sys/signal.h)
or name (from kill -l).
With a signal number of 9, the kill is absolute.
Solaris only.
- -signal
- Send signal signal to the given process or process group.
|
ksh | ksh [options] [arguments]
Korn shell command interpreter. See Chapter 4 for more information,
including command-line options.
|
ld | /usr/ccs/bin/ld [options] objfiles
Combine several objfiles, in the specified order, into
a single executable object module (a.out by default).
ld is the loader and is usually invoked automatically by compiler
commands such as cc.
Options- -a
- Force default behavior for static linking (generate an object file and list
undefined references). Do not use with -r.
- -b
- Ignore special processing for shared reference symbols (dynamic linking only);
output becomes more efficient but less sharable.
- -B directive
- Obey one of the following directives:
dynamic | When loading, use both dynamic (lib.so)
and static (lib.a) libraries
to resolve unknown symbols.
|
eliminate | Remove symbols not assigned a version definition.
Solaris only.
|
group | Treat a shared object and its dependencies as a group.
Implies -z defs.
Solaris only.
|
local | Treat any global symbols that are not assigned a version
definition as local symbols.
Solaris only.
|
reduce | Perform the reduction of symbolic information specified by version
definitions.
Solaris only.
|
static | When loading, use only
static (lib.a) libraries
to resolve unknown symbols.
|
symbolic | In dynamic linking, bind a symbol to its local definition,
not to its global definition.
|
- -d[c]
- Link dynamically (c is y) or statically (c is n);
dynamic linking is the default.
- -Dtoken,...
- Print debugging information as specified by token;
use help to get a list of possible values.
Solaris only.
- -e symbol
- Set symbol as the address of the output file's entry point.
- -f obj
- Use the symbol table of the shared object being built as an
auxiliary filter on shared object obj.
Do not use with -F.
Solaris only.
- -F obj
- Use the symbol table of the shared object being built as a
filter on shared object obj.
Do not use with -f.
Solaris only.
- -G
- In dynamic linking, create a shared object and allow undefined symbols.
- -h name
- Use name as the shared object file to search for during
dynamic linking (default is Unix object file).
- -i
- Ignore LD_LIBRARY_PATH.
Useful for avoiding unwanted effects on the runtime search of the
executable being built.
Solaris only.
- -I name
- Use name as the pathname of the loader (interpreter) to write
into the program header.
Default is none (static) or /usr/lib/libc.so.1 (dynamic).
- -lx
- Search a library named libx.so
or libx.a
(the placement of this option on the line affects when the library
is searched).
- -L dir
- Search directory dir before standard search directories
(this option must precede -l).
- -m
- List a memory profile for input/output sections.
- -M mapfile
- Invoke ld directives from mapfile
(-M messes up the output and is discouraged).
- -Nstring
- Add a DT_NEEDED entry with the value string
to the .dynamic section of the object being built.
Solaris only.
- -o file
- Send the output to file (default is a.out).
- -Qc
- List version information about ld in the output
(c = y, the default) or do not list (c = n).
- -r
- Allow output to be subject to another ld.
(Retain relocation information.)
- -R path
- Record the colon-separated list of directories in path
in the object file for use by the runtime loader.
Multiple instances may be supplied; the values are concatenated together.
- -s
- Remove (strip) symbol table and relocation entries.
- -t
- Suppress warnings about multiply defined symbols of unequal size.
- -u symbol
- Enter symbol in symbol table; useful when loading from an archive
library. symbol must precede the library that defines it
(so -u must precede -l).
- -V
- Print the version of ld.
- -YP,dirlist
- Specify a comma-separated list of directories to use in place of
the default search directories (see also -L).
- -z defs | nodefs | text
- Specify nodefs to allow undefined symbols. The default, defs,
treats undefined symbols as a fatal error. Use text to produce an error
when there are nonwritable relocations.
- -z directive
- Solaris only.
Obey one of the following directives:
allextract | Extract all archive members.
|
combreloc | Combine multiple relocation sections.
|
defaultextract | Return to the default archive extraction rules.
|
ignore | Ignore dynamic dependencies that are not referenced
as part of the linking.
|
initfirst | Shared objects only. This object's initialization runs before
that of others added to the process at the same time.
Similarly,
its “finalization” runs after that of other objects.
|
lazyload | Mark dynamic dependencies for lazy loading.
Lazily loaded objects are loaded when the first binding to the object
is made, not at process startup.
|
loadfltr | Mark the filter object for immediate processing at runtime,
instead of at the first binding.
|
muldefs | Allow multiple symbol definitions, using the first one that occurs.
Otherwise, multiple symbol definitions are a fatal error.
|
nodefs | Allow undefined symbols.
This is the default for shared objects.
The behavior is undefined for executables.
|
nodelete | Mark the object as not being deletable at runtime.
|
nodlopen | Shared objects only.
The object is not available from dlopen(3x).
|
nolazyload | Don't mark dynamic dependencies for lazy loading.
Lazily loaded objects are loaded when the first binding to the object
is made, not at process startup.
|
nopartial | Expand partially initialized symbols in input relocatable objects
into the generated output file.
|
noversion | Do not include any versioning sections.
|
now | Force nonlazy runtime binding for the object.
|
origin | The object requires immediate $ORIGIN
processing at runtime.
|
record | Record dynamic dependencies that are not referenced
as part of the linking.
This is the default.
|
redlocsym | Remove all local symbols except for the SECT
symbols from the SHT_SYMTAB symbol table.
|
textoff | In dynamic mode, allow relocations against all sections, including
those that are not writable.
This is the default for shared objects.
|
textwarn | Dynamic mode only.
Warn if there remain
any relocations against nonwritable, allocatable sections.
This is the default for executables.
|
weakextract | Allow “weak” definitions to trigger archive extraction.
|
|
ldd | ldd [option] file
List dynamic dependencies; that is, list shared objects
that would be loaded if file were executed.
(If a valid file needs no shared objects, ldd
succeeds but produces no output.)
In addition, ldd's options can
show unresolved symbol references that result
from running file.
OptionsSpecify only one of these options:
- -d
- Check references to data objects only.
- -r
- Check references to data objects and to functions.
Solaris OptionsThe following additional options are specific to Solaris:
- -f
- Force checking of nonsecure executables.
This option is dangerous if running as a privileged user.
- -i
- Print the execution order of initialization sections.
- -l
- Do immediate processing of any filters, to list all “filtees”
and their dependencies.
- -s
- Display the search path for shared object dependencies.
- -v
- Display all dependency relationships and version requirements.
|
lex | /usr/ccs/bin/lex [options] [files]
Generate a lexical analysis program (named lex.yy.c)
based on the regular expressions and C statements contained in
one or more input files.
See also yacc and
lex & yacc, which is listed in the Bibliography.
Options- -c
- file's program statements are in C (default).
- -e
- Handle EUC (Extended Unix Code, i.e., 8-bit) characters.
Mutually exclusive with -w.
This gives yytext[] type unsigned char.
Solaris only.
- -n
- Suppress the output summary.
- -Qc
- Print version information in lex.yy.c (if c = y)
or suppress information (if c = n, the default).
- -t
- Write program to standard output, not lex.yy.c.
- -v
- Print a summary of machine-generated statistics.
- -V
- Print version information on standard error.
- -w
- Handle EUC (8-bit or wider) characters.
Mutually exclusive with -e.
This gives yytext[] type wchar_t.
Solaris only.
|
line | line
Read the next line from standard input and write it to standard
output. Exit status is 1 upon EOF.
Typically used in csh scripts to
read from the terminal.
ExamplePrint the first two lines of output from who:
who | ( line ; line )
|
lint | /usr/ccs/bin/lint [options] files
Detect bugs, portability problems, and other possible errors in the
specified C programs. By default, lint uses definitions in the
C library llib-lc.ln.
If desired, output from .c files can be saved
in “object files”
having a .ln suffix. A second lint pass can be invoked on
.ln files and libraries for further checking.
lint also accepts the cc options -D,
-I, and -U.
It may accept additional cc options that are system-specific.
See also Checking C Programs with lint, which is listed
in the Bibliography.
Note: this command checks programs written in ANSI C;
use /usr/ucb/lint if you want to check programs written
in pre-ANSI C. Note also that options
-a,
-b,
-h,
and
-x
have exactly the opposite meaning in the versions for BSD and System V.
Options- -a
- Ignore long values assigned to variables
that aren't long.
- -b
- Ignore break statements that cannot be reached.
- -c
- Don't execute the second pass of lint;
save output from first pass in .ln files.
(Same as BSD -i option.)
- -F
- Print files using full pathname, not just the filename.
- -h
- Don't test for bugs, bad style, or extraneous information.
- -k
- Reenable warnings that are normally suppressed by directive
/* LINTED [message] */,
and print the additional
message (if specified).
- -Ldir
- Search for lint libraries in directory dir before
searching standard directories.
- -lx
- Use library llib-lx.ln in
addition to llib-lc.ln.
- -m
- Ignore extern declarations that could be static.
- -n
- Do not check for compatibility.
- -o lib
- Create a lint library named llib-l.lib.ln from
the output of the first pass of lint.
- -p
- Check for portability to variants of C.
- -Rfile
- Place .ln output (from a .c file) in file,
for use by cxref.
- -s
- Produce short (one-line) diagnostics.
- -u
- Ignore functions or external variables that are undefined or unused.
- -v
- Ignore unused arguments within functions; same as specifying the
directive /* ARGSUSED */.
- -V
- Print product name and release on standard error.
- -Wfile
- Same as -R, except file is prepared for cflow.
- -x
- Ignore unused variables referred to by extern declarations.
- -y
- Same as using the directive /* LINTLIBRARY */, which is the same
as supplying options -v and -x.
|
listusers | listusers [options]
Solaris only.
List all users, optionally just by group, or by specific users.
Options- -g grouplist
- List all users in the comma-separated list of groups grouplist.
- -l users
- List just the named users, sorted by login.
A comma-separated list may also be provided.
|
ln | ln [options] file1 file2 ln [options] files directory
Create pseudonyms (links) for files, allowing them to be
accessed by different names. In the first form, link file1 to
file2, where file2 is usually a new filename. If
file2 is an existing file, it is removed first;
if file2 is
an existing directory, a link named file1 is created in that
directory. In the second form, create links in directory, each
link having the same name as the file specified.
Options- -f
- Force the link to occur (don't prompt for overwrite permission).
- -n
- Do not overwrite existing files.
- -s
- Create a symbolic link. This lets you link across filesystems and
also see the name of the link when you run ls -l.
(Otherwise, you have to use find -inum to find
any other names a file is linked to.)
|
locale | locale [options] [name ...]
Solaris only.
Print locale-specific information.
With no arguments, locale summarizes the current locale.
Depending on the arguments, locale prints information
about entire locale categories or the value of specific items within a locale.
A public locale is one an application can access.
See also localedef.
Options- -a
- Print information about all available public locales.
The POSIX locale should always be available.
- -c
- Provide information about the locale category name.
Useful with or without -k.
- -k
- Print the names and values of the given locale keywords.
- -m
- Print the names of the available charmaps.
|
localedef | localedef [options] localename
Solaris only.
localedef reads a locale definition either on standard
input or from the file named with the -i option.
The format is documented in the locale(5) manpage.
It generates a temporary C source file that is compiled into a
shared-object library.
This library file can then be used by programs that pay attention to the
settings of the locale-specific environment variables in order to return
the correct values for the given locale.
The generated file has the name
localename.so.version.
The default 32-bit version should be moved to
/usr/lib/locale/
localename/localename.so.version.
The 64-bit environment on SPARC systems should use
/usr/lib/locale/localename/ sparcv9/localename.so.version.
Options- -c
- Create the shared object file, even if there are warnings.
- -C options
- Pass options to the C compiler.
This option is deprecated in favor of -W cc.
- -f mapfile
- The file mapfile provides a mapping of
character symbols and collating element symbols to actual
character encodings.
This option must be used if the locale definition uses symbolic names.
- -i localefile
- Read the locale definitions from localefile
instead of from standard input.
- -L options
- Pass options to the C compiler,
after the name of the C source file.
This option is deprecated in favor of -W cc.
- -m model
- Specify -m ilp32 to generate 32-bit object files
(this is the default).
Use -m lp64 to generate 64-bit object files
(SPARC only).
- -W cc,args
- Pass args on to the C compiler.
Each argument is separated from the previous by a comma.
- -x exfile
- Read additional options from the extension file exfile.
ExampleGenerate a 64-bit shared object locale file for Klingonese;
ignore any warning messages:
localedef -c -m lp64 -i klingon.def klingon
|
logger | logger [options] [messages]
Solaris only.
Log messages to the system log.
Command-line messages are logged if provided.
Otherwise, messages are read and logged, line-by-line, from
the file provided via -f.
If no such file is given, logger reads
messages from standard input.
Options- -f file
- Read and log messages from file.
- -i
- Log the process ID of the logger process with each message.
- -p priority
- Log each message with the given priority.
Priorities have the form facility.level.
The default is user.notice.
See syslog(3) for more information.
- -t tag
- Add tag to each message line.
ExampleWarn about upcoming trouble:
logger -p user.emerg 'Incoming Klingon battleship!'
|
login | login [options]
Sign on and identify yourself to the system. At the beginning of each
terminal session, the system prompts you for your username and, if
relevant, a password. The options aren't normally used.
The Korn shell and the C shell have their own,
built-in versions of login.
See Chapter 4 and Chapter 5 for more information.
Options- user
- Sign on as user (instead of being prompted).
- -dtty
- Specify the pathname of the tty that serves as the login port.
- -h host [term]
- Used for remote logins via telnet to indicate the
login is from host host and that the user's
terminal type is term.
Solaris only.
- -p
- Pass the current environment to the new login session.
Solaris only.
- -r host
- Used for remote logins via rlogin to indicate the
login is from host host.
Solaris only.
- var=value
- When specified after the username,
assign a value to one or more environment variables.
PATH and SHELL can't be changed.
- value
- Pass values into the environment. Each value that does not
contain an = is assigned to a variable
of the form Ln, where
n starts at 0 and increments.
Solaris only.
|
logname | logname
Display your login name.
SVR4 prints the value of the LOGNAME environment variable
located in /etc/profile.
Solaris looks the user up in /var/adm/utmp,
which is where information is kept about logged-in users.
See also whoami.
|
look | look [options] string [file]
Solaris only.
Look through a sorted file and print all lines that begin with string.
Words may be up to 256 characters long.
This program is potentially faster than fgrep because it
relies on the file being already sorted, and can thus do a
binary search through the file, instead of reading it sequentially from
beginning to end.
With no file, look searches
/usr/share/lib/dict/words
(the spelling dictionary)
with options -df.
Options- -d
- Use dictionary order.
Only letters, digits, space, and tab are used in comparisons.
- -f
- Fold case; ignore case distinctions in comparisons.
- -t char
- Use char as the termination character, i.e., ignore all characters to the right of char.
|
lookbib | lookbib database
Part of the refer suite of programs.
See Chapter 17.
|
lp | lp [options] [files]
Send files to the printer.
With no arguments, prints standard input.
To print standard input along with other files,
specify – as one of the files.
Options- -c
- Copy files to print spooler;
if changes are made to file while it is still queued for
printing, the printout is unaffected.
- -d dest
- Send output to destination printer named dest.
- -d any
- Used after -f or -S to print the
request on any printer
that supports the given form or character set.
- -f name
- Print request on preprinted form name.
name references printer attributes
set by the administrative command lpforms.
- -H action
- Print according to the named action: hold
(notify before printing), resume (resume a held request),
immediate (print next; privileged users only).
- -i IDs
- Override lp options used for
request IDs currently in the queue;
specify new lp options after -i.
For example, change the number of copies sent.
- -m
- Send mail after files are printed.
- -n number
- Specify the number of copies to print.
- -o options
- Set one or more printer-specific options.
Standard options include:
cpi=n | Print n characters per inch.
n can also be pica, elite, or compressed.
|
lpi=n | Print n lines per inch.
|
length=n | Print pages n units long;
e.g., 11i (inches), 66 (lines).
|
nobanner | Omit banner page (separator) from request.
|
nofilebreak | Suppress formfeeds between files.
|
width=n | Print pages n units wide;
e.g., 8.5i (inches), 72 (columns).
|
stty=list | Specify a quoted list of stty options.
|
- -p
- Enable notification of completion of the print job.
Solaris only.
- -P list
- Print only the page numbers specified in list.
- -q n
- Print request with priority level n (39 = lowest).
- -r
- Don't adapt request if content isn't suitable;
reject instead. (Obscure; used only with -T.)
- -s
- Suppress messages.
- -S name
- Use the named print wheel or character set for printing.
- -t title
- Use title on the printout's banner page.
- -T content
- Send request to a printer that supports content
(default is simple; an administrator sets content
via lpadmin -I).
- -w
- Write a message on the user's terminal
after files are printed
(same as -m if user isn't logged on).
- -y modes
- Print according to locally defined modes.
ExamplesSend mail after printing five copies of report:
lp -n 5 -m report
Format and print thesis; print title too:
nroff -ms thesis | lp - title
|
lpq | /usr/ucb/lpq [options] [job#s] [users]
Show the printer queue.
Standard SVR4 uses lpstat.
|
lpr | /usr/ucb/lpr [options] [files]
Send files to the printer. Standard SVR4 uses lp.
|
lprm | /usr/ucb/lprm [options] [job#s] [users]
Remove requests from printer
queue. Standard SVR4 uses cancel.
|
lprof | lprof [options] lprof -m files [-T] -d out
SVR4 only.
Display a program's profile data on a line-by-line basis.
Data includes a list of source files, each source-code line
(with line numbers), and the number of times each line was executed.
By default, lprof interprets the profile file
prog.cnt.
This file is generated by specifying cc -ql
when compiling a program or when creating a shared object
named prog (default is a.out).
The PROFOPTS environment variable can control
profiling at runtime.
See also prof
and gprof.
Options- -c file
- Read input profile file instead of prog.cnt.
- -d out
- Store merged profile data in file out. Must be used with -m.
- -I dir
- Search for include files in dir as well as in the default place
(/usr/include).
- -m files
- Merge several profile files and total the execution counts.
files are of the form
f1.cnt,
f2.cnt,
f3.cnt, etc.,
where each file contains the profile data from
a different run of the same program. Used with -d.
- -o prog
- Look in the profile file for a program named prog
instead of the name used when the profile file was created.
-o is needed when files have been renamed or moved.
- -p
- Print the default listing; useful with -r and -s.
- -r list
- Used with -p to print only the source files given in list.
- -s
- For each function, print the percentage of code lines that are
executed.
- -T
- Ignore timestamp of executable files being profiled.
Normally, times are checked to insure that the various profiles were
made from the same version of an executable.
- -V
- Print the version of lprof on standard error.
- -x
- Omit execution counts. For lines that executed,
show only the line numbers; for lines that didn't execute,
print the line number, the symbol [U], and the source line.
|
lpstat | lpstat [options]
Print the lp print queue status. With options that take a
list argument, omitting the list produces all information for
that option. list can be separated by commas or, if enclosed in
double quotes, by spaces.
Options- -a [list]
- Show whether the list of printer or class names is accepting requests.
- -c [list]
- Show information about printer classes named in list.
- -d
- Show the default printer destination.
- -D
- Use after -p to show a brief printer description.
- -f [list]
- Verify that the list of forms is known to lp.
- -l
- Use after -f to describe available forms, after -p to show printer
configurations, or after -S to describe printers appropriate
for the specified character set or print wheel.
- -o [list]
- Show the status of output requests. list contains printer names,
class names, or request IDs.
- -p [list]
- Show the status of printers named in list.
- -r
- Show whether the print scheduler is on or off.
- -R
- Show the job's position in the print queue.
- -s
- Summarize the print status (shows almost everything).
- -S [list]
- Verify that the list of character sets or print wheels
is known to lp.
- -t
- Show all status information (reports everything).
- -u [list]
- Show request status for users on list. list can
be:
user | user on local machine
|
all | All users on all systems
|
host!user | user on machine host
|
host!all | All users on host
|
all!user | user on all systems
|
all!all | All users on all systems
|
- -v [list]
- Show device associated with each printer named in list.
|
ls | ls [options] [names]
If no names are given, list the files in the current
directory. With one or more names, list files contained
in a directory name or that match a file
name. The options let you display a variety of information
in different formats. The most useful options include
-F, -R,
-a,
-l, and
-s. Some options don't make sense together;
e.g., -u and -c.
Note: the Solaris /usr/bin/ls pays attention to
the LC_COLLATE environment variable.
Its default value, en_US, (in the United States) causes ls
to sort in dictionary order (i.e., ignoring case).
Set LC_COLLATE to C to restore the traditional
Unix behavior of sorting in ASCII order,
or use /usr/ucb/ls.
Options- -a
- List all files, including the normally hidden . files.
- -A
- Like -a, but exclude .
and .. (the current and parent directories).
Solaris only.
- -b
- Show nonprinting characters in octal.
- -c
- List files by inode modification time.
- -C
- List files in columns (the default format, when displaying to a terminal device).
- -d
- List only the directory's information, not its contents.
(Most useful with -l and -i.)
- -f
- Interpret each name as a directory (files are ignored).
- -F
- Flag filenames by
appending
/ to directories,
> to doors (Solaris only),
* to executable files,
| to fifos,
@ to symbolic links,
and
= to sockets.
- -g
- Like -l, but omit owner name (show group).
- -i
- List the inode for each file.
- -l
- Long format listing (includes permissions, owner, size, modification time,
etc.).
- -L
- List the file or directory referenced by a symbolic link rather than
the link itself.
- -m
- Merge the list into a comma-separated series of names.
- -n
- Like -l, but use user ID and group ID numbers instead of owner and group names.
- -o
- Like -l, but omit group name (show owner).
- -p
- Mark directories by appending / to them.
- -q
- Show nonprinting characters as ?.
- -r
- List files in reverse order (by name or by time).
- -R
- Recursively list subdirectories as well as current directory.
- -s
- Print sizes of the files
in blocks.
- -t
- List files according to modification time (newest first).
- -u
- List files according to the file access time.
- -x
- List files in rows going across the screen.
- -1
- Print one entry per line of output.
ExamplesList all files in the current directory and their sizes; use
multiple columns and mark special files:
ls -asCF
List the status of directories /bin and /etc:
ls -ld /bin /etc
List C source files in the current directory, the oldest first:
ls -rt *.c
Count the files in the current directory:
ls | wc -l
|
m4 | /usr/ccs/bin/m4 [options] [files]
Macro processor for RATFOR, C, and other program files.
Options- -Bn
- Set push-back and argument collection buffers
to n (default is 4096).
- -Dname[=value]
- Define name as value or, if value is not specified,
define name as null.
- -e
- Operate interactively, ignoring interrupts.
- -Hn
- Set symbol table hash array size to n (default is 199).
- -s
- Enable line-sync output for the C preprocessor.
- -Sn
- Set call stack size to n (default is 100 slots).
- -Tn
- Set token buffer size to n (default is
512 bytes).
- -Uname
- Undefine name.
|
mail | mail [options] [users]
Read mail (if no users listed), or send mail to other
users. Type ? for a summary of commands.
Esoteric debugging options exist (not listed) for system administrators.
See also mailx
and vacation.
Options for Sending Mail
- -m type
- Print a “Message-type:” line at the heading of the letter, followed by
type of message.
- -t
- Print a “To:” line at the heading of the letter, showing the names of the
recipients.
- -w
- Force mail to be sent to remote users without waiting for remote transfer
program to complete.
Options for Reading Mail
- -e
- Test for the existence of mail without printing it.
Exit status is 0 if mail exists; otherwise 1.
- -f file
- Read mail from alternate mailbox file.
- -F names
- Forward all incoming mail to recipient names.
SVR4 only.
(See vacation in Appendix B.)
- -h
- Display a window of messages rather than the latest message.
- -p
- Print all messages without pausing.
- -P
- Print messages with all header lines displayed.
- -q
- Terminate on an interrupt.
- -r
- Print oldest messages first.
|
mailx | mailx [options] [users]
Read mail, or send mail to other users.
For a summary of commands, type ? in command mode (e.g., when
reading mail) or ~? in input mode (e.g., when sending mail).
The start-up file .mailrc in the user's home directory is useful
for setting display variables and for defining alias lists.
On Solaris, /usr/ucb/mail and /usr/ucb/Mail
are symbolic links to mailx.
Options
- -B
- Do not buffer standard input or standard output.
Solaris only.
- -b bcc
- Send blind carbon copies to bcc.
Quote the list if there are multiple recipients.
Solaris only.
- -c cc
- Send carbon copies to cc.
Quote the list if there are multiple recipients.
Solaris only.
- -d
- Set debugging.
- -e
- Test for the existence of mail without printing it.
Exit status is 0 if mail exists; otherwise 1.
- -f [file]
- Read mail in alternate file (default is mbox).
- -F
- Store message in a file named after the first recipient.
- -h n
- Stop trying to send after making n network connections, or “hops”
(useful for avoiding infinite loops).
- -H
- Print mail headers only.
- -i
- Ignore interrupts (useful on modems); same as ignore mailx option.
- -I
- Use with -f when displaying saved news articles;
newsgroup and article-ID headers are included.
- -n
- Do not read the system startup mailx.rc
or Mail.rc file(s).
- -N
- Don't print mail headers.
- -r address
- Specify a return address for mail you send.
- -s sub
- Place string sub in the subject header field.
sub must be quoted if it contains whitespace.
- -t
- Use To:, Cc:, and Bcc:
headers in the input to specify recipients instead of command-line arguments.
Solaris only.
- -T file
- Record message IDs and article IDs (of news articles)
in file.
- -u user
- Read user's mail.
- -U
- Convert uucp-type addresses to Internet format.
- -v
- Invoke sendmail with the -v option.
Solaris only.
- -V
- Print version number of mailx and exit.
- -~
- Process tilde escapes, even if not reading from a terminal.
Solaris only.
|
make | /usr/ccs/bin/make [options] [targets]
Update one or more targets according to dependency
instructions in a description file in the current directory.
By default, this file is called makefile or Makefile.
See Chapter 20,
for more information on make.
See also Managing Projects with make, listed in the Bibliography.
Note: the Solaris make has many extensions over the
standard SVR4 make described here.
See make(1) for more information.
Options- -e
- Override makefile assignments with environment variables.
- -f makefile
- Use makefile as the description file; a filename –
denotes standard input.
- -i
- Ignore command error codes (same as .IGNORE).
- -k
- Abandon the current entry when it fails, but keep working with
unrelated entries.
- -n
- Print commands but don't execute (used for testing).
- -p
- Print macro definitions and target descriptions.
- -q
- Query; return 0 if file is up-to-date; nonzero otherwise.
- -r
- Do not use “default” rules.
- -s
- Do not display command lines (same as .SILENT).
- -t
- Touch the target files, causing them to be updated.
|
man | man [options] [[section] subjects]
Display information from the online reference manual.
Each subject is usually the name of a command from Section 1
of the online manuals, unless you specify an optional
section from 1 to 8. If you don't specify a subject,
you must supply either a keyword (for -k)
or a file (for -f). No options except -M can be used
with -k or -f.
The MANPATH environment variable defines the directories
in which man searches for information (default is
/usr/share/man). PAGER defines how output is sent
to the screen (default is more -s).
Note: in Solaris, section must be preceded by -s.
Options- -
- Pipe output through cat instead of more -s.
- -a
- Show all pages matching subject. Solaris only.
- -d
- Debug; evaluate the man command but don't execute.
Solaris only.
- -f files
- Display a one-line summary of one or more reference files.
Same as whatis.
- -F
- Search MANPATH directories, not windex database.
Solaris only.
- -k keywords
- Display any header line that contains one of the
specified keywords. Same as apropos.
- -l
- Like -a, but list only the pages. Solaris only.
- -M path
- Search for online descriptions in directory path instead of
default directory. -M overrides MANPATH.
- -r
- Reformat but don't display manpage.
Same as man - -t. Solaris only.
- -s section
- Specify the section of the manpage to search in.
Required on Solaris for anything that isn't a command.
- -t
- Format the manpages with troff.
- -T mac
- Display information using macro package mac instead of
tmac.an (the man macros).
ExamplesSave documentation on the mv command (strip backspaces):
man mv | col -b > mv.txt
Display commands related to linking and compiling:
man -k link compile | more
Display a summary of all intro files:
man -f intro
Look up the intro page from Section 3M
(the math library):
man 3m intro In SVR4
man -s 3m intro In Solaris
|
mcs | /usr/ccs/bin/mcs [options] files
Manipulate the comment section.
mcs adds to, compresses, deletes, or prints
a section of one or more ELF object files.
The default section is .comment. If any input file is
an archive, mcs acts on each component file and removes
the archive symbol table (unless -p was the only option
specified). Use ar s to regenerate the symbol table.
Use of mcs -d can significantly decrease the size of
large executables, often saving considerable disk space.
At least one option must be supplied.
Options- -a string
- Append string to the comment section of files.
- -c
- Compress the comment section of files
and remove duplicate entries.
- -d
- Delete the comment section (including header).
- -n name
- Act on section name instead of .comment.
- -p
- Print the comment section on standard output.
- -V
- Print the version of mcs on standard error.
Examplemcs -p kernel.o Print the comment section of kernel.o
|
mesg | mesg [options]
Change the ability of other users to use talk, or
to send write messages
to your terminal. With no options, display the permission status.
Options- -n
- Forbid write messages.
- -y
- Allow write messages (the default).
Both options may be provided without the leading –,
for compatibility with BSD.
|
mkdir | mkdir [options] directories
Create one or more directories. You must have write
permission in the parent directory in order to create a
directory. See also rmdir.
Options- -m mode
- Set the access mode for new directories.
- -p
- Create intervening parent directories if they don't exist.
ExamplesCreate a read/execute-only directory named personal:
mkdir -m 555 personal
The following sequence:
mkdir work; cd work
mkdir junk; cd junk
mkdir questions; cd ../..
could be
accomplished by typing this:
mkdir -p work/junk/questions
|
mkmsgs | mkmsgs [options] string_file msg_file
Convert string_file (a list of text strings) into msg_file
(the file whose format is readable by gettxt). The created msg_file
is also used by the commands exstr and srchtxt.
Options- -i locale
- Create msg_file in directory:
/usr/lib/locale/locale/LC_MESSAGES.
For example, if string_file is a collection of error messages
in German, you might specify locale as german.
- -o
- Overwrite existing msg_file.
|
more | more [options] [files]
Display the named files on a terminal, one screenful at a time. After
each screen is displayed, press the Return key to display the next line
or press the spacebar to display the next screenful. Press
h for help with additional commands, q to quit, / to
search, or :n to go to the next file.
more can also be invoked using the name page.
Options- -c
- Page through the file by clearing the screen instead of scrolling.
This is often faster and is much easier to read.
- -d
- Display the prompt Press space to continue, 'q' to quit.
- -f
- Count logical rather than screen lines. Useful when long lines wrap
past the width of the screen.
- -l
- Ignore formfeed (^L) characters.
- -r
- Force display of control characters, in the form ^x.
- -s
- Squeeze; display multiple blank lines as one.
- -u
- Suppress underline characters and backspace (^H).
- -w
- Wait for a user keystroke before exiting.
- -n
- Use n lines for each “window”
(default is a full screen).
- +num
- Begin displaying at line number num.
- +/pattern
- Begin displaying two lines before pattern.
ExamplesPage through file in “clear” mode,
and display prompts:
more -cd file
Format doc to the screen, removing underlines:
nroff doc | more -u
View the manpage for the grep command;
begin near the word “BUGS”
and compress extra whitespace:
man grep | more +/BUGS -s
|
msgfmt | msgfmt [options] pofiles
Solaris only.
msgfmt translates “portable object files”
(file.po)
into loadable message files that can be used by a running application
via the gettext(3C) and dgettext(3C)
library functions.
Portable object files are created using xgettext
from the original C source code files.
A translator then edits the .po file, providing
translations of each string (or “message”) in the
source program.
The format is described in the msgfmt(1) manpage.
Once compiled by msgfmt, the running program
uses the translations for its output when the locale is set up appropriately.
Options- -o file
- Place the output in file.
This option ignores domain directives
and duplicate msgid s.
- -v
- Be verbose. Duplicate message identifiers are listed,
but message strings are not redefined.
|
mv | mv [options] sources target
Basic command to move files and directories around on the system
or to rename them. mv works as the following table shows.
Source | Target | Result |
File | name | Rename file as name.
|
File | Existing file | Overwrite existing file with source file.
| Directory | name | Rename directory as name.
|
Directory | Existing directory | Move directory to be a subdirectory
of existing directory.
|
One or more files | Existing directory | Move files to directory.
|
Options- --
- Use this when one of the names begins with a –.
For compatibility with old programs, a plain –
also works.
- -f
- Force the move, even if target file exists;
suppress messages about restricted access modes.
- -i
- Inquire; prompt for a y (yes) response before overwriting
an existing target.
|
native2ascii | /usr/java/bin/native2ascii [options] [input [output]]
Solaris only.
Convert files encoded in the native character encoding to Latin-1 or Unicode
encoded files.
By default, native2ascii reads standard input and
writes standard output.
Supply filenames for input and output
to read/write named files, instead.
A large number of encodings are supported; see the manpage for the complete list.
Options- -encoding encoding
- Use encoding for the translation.
The default encoding is the value of the
system property file.encoding.
- -reverse
- Perform the reverse operation: translate from Latin-1 or Unicode
to a native encoding.
|
nawk | nawk [options] ['program'] [files] [variable=value]
New version of awk, with additional capabilities.
nawk is a pattern-matching language useful for manipulating
data. See Chapter 11 for more information on nawk.
Options- -f file
- Read program instructions from file instead of supplying program
instructions on command line.
This option may be specified multiple times; each file
is concatenated with the others to make up the program source code.
- -F regexp
- Separate fields using regular expression regexp.
- -v variable=value
- Assign value to variable before executing 'program'.
- variable=value
- Assign value to variable.
When specified intermixed with files, the
assignment occurs at that point in the processing.
|
neqn | neqn [options] [files]
Equation preprocessor for nroff.
See Chapter 17.
|
nice | nice [options] command [arguments]
Execute a command and arguments with lower priority
(i.e., be “nice” to other users).
Also built-in to the C shell, with a different command syntax (see
Chapter 5).
Options- -n
- Run command with a niceness of n (1-19); default
is 10. Higher n
means lower priority. A privileged user can raise
priority by specifying a negative n (e.g., -5).
nice works differently in the C shell (see Chapter 5).
+n raises priority, -n lowers it, and 4 is the default.
- -n n
- Same as –n.
Solaris only.
|
nl | nl [options] [file]
Number the lines of file in logical page segments.
Numbering resets to 1 at the start of each logical page.
Pages consist of a header, body, and footer; each section may be empty.
It is the body that gets numbered.
The sections are delimited by special standalone lines as indicated
next; the delimiter lines are copied to the output as empty lines.
Section Delimiters
\:\:\: | Start of header |
\:\: | Start of body |
\: | Start of footer |
Options- -btype
- Number lines according to type. Values are:
a | All lines. |
n | No lines. |
t | Text lines only (the default).
|
p"exp" | Lines matching the regular expression exp only.
|
- -dxy
- Use characters xy to delimit logical pages (default is
\:).
- -ftype
- Like -b, but number footer (default type is n).
- -htype
- Like -b, but number header (default type is n).
- -in
- Increment each line number by n (default is 1).
- -ln
- Count n consecutive blank lines as one line.
- -nformat
- Set line number format. Values are:
ln | Left-justify, omit leading zeros.
|
rn | Right-justify, omit leading zeros (default).
|
rz | Right-justify.
|
- -p
- Do not reset numbering at start of pages.
- -sc
- Separate text from line number with character(s) c
(default is a tab).
- -vn
- Number each page starting at n (default is 1).
- -wn
- Use n columns to show line number (default is 6).
ExamplesList the current directory, numbering files as 1), 2), etc.:
ls | nl -w3 -s') '
Number C source code and save it:
nl prog.c > print_prog
Number only lines that begin with #include:
nl -bp"^#include" prog.c
|
nm | /usr/ccs/bin/nm [options] objfiles
Print the symbol table (name list) in alphabetical order for
one or more object files (usually ELF or COFF files),
shared or static libraries, or binary executable programs.
Output includes each symbol's value, type, size, name, etc.
A key letter categorizing the symbol can also be displayed.
You must supply at least one object file.
Options- -A
- Write the full pathname or library name on each line.
Solaris only.
- -C
- Print demangled C++ symbol names.
Solaris only.
- -D
- Display the SHT_DYNSYM symbol information.
Solaris only.
- -e
- Report only external and static symbols; obsolete.
- -f
- Report all information; obsolete.
- -g
- Write only external (global) symbol information.
Solaris only.
- -h
- Suppress the header.
- -l
- Use with -p; indicate WEAK symbols by appending
an asterisk (*) to key letters.
- -n
- Sort the external symbols by name.
- -o
- Report values in octal.
- -p
- Precede each symbol with its key letter (used for parsing).
- -r
- Report the object file's name on each line.
- -R
- Print the archive name (if present),
followed by the object file and symbol name.
-r overrides this option.
Solaris only.
- -s
- Print section name instead of section index.
Solaris only.
- -t format
- Write numeric values in the specified format:
d for decimal,
o for octal,
and
x for hexadecimal.
Solaris only.
- -T
- Truncate the symbol name in the display; obsolete.
- -u
- Report only the undefined symbols.
- -v
- Sort the external symbols by value.
- -V
- Print nm's version number on standard error.
- -x
- Report values in hexadecimal.
Key Letters
A | Absolute symbol.
|
B | BSS (uninitialized data space).
|
C | Common symbol.
SVR4 only.
|
D | Data object symbol.
|
F | File symbol.
|
N | Symbol with no type.
|
S | Section symbol.
|
T | Text symbol.
|
U | Undefined symbol.
|
|
nohup | nohup command [arguments] &
Continue to execute the named command and optional command
arguments after you log out (make command immune to hangups;
i.e., no hangup.
In the C shell, nohup is built
in. In the Bourne shell, nohup allows output redirection; output
goes to nohup.out by default.
In the Korn shell, nohup is an alias that allows the
command it runs to also be aliased.
(See Chapter 4 and Chapter 5.)
|
nroff | nroff [options] [files]
Format documents to line printer or to screen.
See Chapter 12.
|
od | od [options] [file] [[+] offset[. | b]]
Octal dump; produce a dump (normally octal) of the named file.
file is displayed from its beginning, unless you
specify an offset (normally in octal bytes).
In the following options, a “word” is a 16-bit unit.
Options- -A base
- Indicate how the offset should be written.
Values for base
are
d for decimal,
o for octal,
x for hexadecimal,
or
n for no offset.
Solaris only.
- -b
- Display bytes as octal.
- -c
- Display bytes as ASCII.
- -C
- Interpret bytes as characters based on the setting of LC_CTYPE.
Solaris only.
- -d
- Display words as unsigned decimal.
- -D
- Display 32-bit words as unsigned decimal.
- -f
- Display 32-bit words as floating point.
- -F
- Display 64-bit words as extended precision.
- -j skip
- Jump over skip bytes from the beginning of the input.
skip can have a leading 0
or 0x for it to be treated as an octal or hexadecimal
value.
It can have a trailing b, k,
or m to be treated as a multiple of 512, 1024,
or 1,048,576 bytes.
Solaris only.
- -N count
- Process up to count input bytes.
Solaris only.
- -o
- Display words as unsigned octal (the default).
- -O
- Display 32-bit words as unsigned octal.
- -s
- Display words as signed decimal.
- -S
- Display 32-bit words as signed decimal.
- -t type_string
- Specify one or more output types. See Section . Solaris only.
- -v
- Verbose; show all data.
Duplicate lines print as *.
- -x
- Display words as hexadecimal.
- -X
- Display 32-bit words as hexadecimal.
- +
- Required before offset if file isn't specified.
Modifiers for offset- .
- offset value is decimal.
- b
- offset value is 512-byte blocks.
Type StringsType strings can be followed by a decimal number indicating how
many bytes to process.
a | ASCII named characters (e.g., BEL for \007)
|
c | Single- or multibyte characters
|
d, o, u, x | Signed decimal, unsigned octal, decimal, and hexadecimal
|
f | Floating point
|
|
page | page [options] [files]
Same as more.
|
passwd | passwd [options] [user]
Create or change a password associated with a user name.
Only the owner or a privileged user may change a password. Owners
need not specify their user name.
Options
Normal users may change the so-called gecos information (user's full name,
office, etc.) and login shell when
using NIS or NIS+; otherwise only privileged users may change the
following:
- -D domain
- Use the passwd.org_dir database in domain,
instead of in the local domain.
Solaris only.
- -e
- Change the login shell.
Solaris only.
- -g
- Change the gecos information.
Solaris only.
- -r db
- Change the password in password database db, which is
one of files, nis, or
nisplus.
Only a privileged user may use files.
Solaris only.
- -s
- Display password information:
user name.
Password status (NP for no password, PS for password, LK for locked).
The last time the password was changed (in mm/dd/yy format).
Number of days that must pass before user can rechange
the password.
Number of days before the password expires.
Number of days prior to expiration that user is warned
of impending expiration.
Options (privileged users only)- -a
- Use with -s to display password information for all users.
user should not be supplied.
- -d
- Delete password; user is no longer prompted for one.
- -f
- Force expiration of user's password; user must change
password at next login.
- -h
- Change the home (login) directory.
Solaris only.
- -l
- Lock user's password; mutually exclusive with -d.
- -n
- Set Item 4 of user's password information. Usually used with -x.
- -w
- Set Item 6 for user.
- -x
- Set Item 5 for user. Use –1 to disable password
aging, 0 to force expiration like -f.
|
paste | paste [options] files
Merge corresponding lines of one or more files into vertical
columns, separated by a tab.
See also cut,
join,
and pr.
Options- -
- Replace a filename with the standard input.
- -d'char'
- Separate columns with char instead of a tab.
char can be any regular
character or the following escape sequences:
Note: you can separate columns with different characters
by supplying more than one char.
\n | Newline
|
\t | Tab
|
\ | Backslash
|
\0 | Empty string
|
- -s
- Merge subsequent lines from one file.
ExamplesCreate a three-column file from files
x, y, and z:
paste x y z > file
List users in two columns:
who | paste - -
Merge each pair of lines into one line:
paste -s -d"\t\n" list
|
patch | patch [options]
[sourcefile [patchfile]]
Solaris only.
patch reads a “patch” containing
the output of diff in normal, ed-script,
or context format, and applies the changes contained therein to the
original version of sourcefile.
Multiple files can be patched, but it must be possible to determine the
name of the original file from the contents of the patch.
Distributing patches is an easy way to provide upgrades to source file
distributions where the changes are small relative to the size of
the entire distribution.
Note: this entry documents the Solaris version,
which is a somewhat older version of Larry Wall's original
patch program.
The Free Software Foundation now maintains patch.
Newer, more capable versions are available from them
and are recommended;
see http://www.gnu.org.
Options- -b
- Make a backup of each file, in file.orig.
An existing file.orig is overwritten.
- -c
- The patchfile is a context diff
(from diff -c or diff -C).
- -d dir
- Change directory to dir before applying the patch.
- -D identifier
- Bracket changes with C preprocessor #ifdef.
#ifdef identifier
...
#endif
- -e
- The patchfile is an ed script
(from diff -e).
- -i file
- Read the patch from file instead of from standard input.
- -l
- Patch loosely.
Any sequence of whitespace characters in the patch may match
any sequence of whitespace in sourcefile.
Other characters must match exactly.
- -n
- The patchfile is a normal diff
(from diff with no special options).
- -N
- Ignore patches that have already been applied.
Normally, such patches are rejected.
- -o newfile
- Instead of updating each source file in place,
write the full contents of the modified file(s) to newfile.
If a file is updated multiple times, newfile
will contain a copy of each intermediate version.
- -pN
- Remove N leading pathname components from the
filename used in the patch.
The leading / of a full pathname counts as one component.
Without this option, only the final filename part of the filename is used.
- -r rejfile
- Use rejfile to contain patches that could not
be applied, instead of file.rej.
Rejected patches are always in context diff format.
- -R
- Reverse the sense of the patch.
In other words, assume that the patch was created using
diff new old,
instead of diff old new.
ExampleUpdate a software distribution:
$ cd whizprog-1.1
$ patch -p1 < whizprog-1.1-1.2.diff
Lots of messages here as patch works
$ find . -name '*.orig' -print | xargs rm
$ cd ..
$ mv whizprog-1.1 whizprog-1.2
|
pathchk | pathchk [-p] pathnames
Solaris only.
Check pathnames.
This command verifies that the file(s) named by pathnames
do not violate any constraints of the underlying filesystem (such as
a name that might be too long), and that the files could be accessed
(e.g., if an intermediate directory lacks search
permission, it is
a problem).
The -p option provides additional portability
checks for the pathnames.
|
pax | pax [options] [patterns]
Solaris only.
Portable Archive Exchange program.
When members of the POSIX 1003.2 working group could not standardize
on either tar or cpio,
they invented this program.[3]
(See also tar">cpio and tar.)
pax operates in four modes, depending on the
combinations of -r and -w:
- List mode
- No -r and no -w.
List the contents of a pax archive.
Optionally, restrict the output to filenames and/or directories
that match a given pattern.
- Extract mode
- -r only.
Extract files from a pax archive.
Intermediate directories are created as needed.
- Archive mode
- -w only.
Archive files to a new or existing pax archive.
The archive is written to standard output; it may be redirected to
an appropriate tape device if needed for backups.
- Pass-through mode
- -r and -w.
Copy a directory tree from one location to another,
analogous to cpio -p.
OptionsHere are the options available in the four modes:
None: c d f n s v
-r: c d f i k n o p s u v
-w: a b d f i o s t u v x X
-rw: d i k l n p s t u v X
- -a
- Append files to the archive.
This may not work on some tape devices.
- -b size
- Use size as the blocksize, in bytes,
of blocks to be written to the archive.
- -c
- Complement.
Match all file or archive members that do not
match the patterns.
- -d
- For files or archive members that are directories,
extract or archive only the directory itself, not the tree it contains.
- -f archive
- Use archive instead of standard input
or standard output.
- -i
- Interactively rename files.
For each file,
pax writes a prompt to /dev/tty
and reads a one-line response from /dev/tty.
The responses are as follows:
Return | Skip the file.
|
A period | Take the file as is.
|
new name | Anything else is taken as the new name to use for the file.
|
EOF | Exit immediately with a nonzero exit status.
|
- -k
- Do not overwrite existing files.
- -l
- Make hard links.
When copying a directory tree (-rw),
make hard links between the source and destination hierarchies
wherever possible.
- -n
- Choose the first archive member that matches each pattern.
No more than one archive member will match for each pattern.
- -o options
- Reserved for format-specific options.
(Apparently unused in Solaris.)
- -p privs
- Specify one or more privileges for the extracted file.
privs specify permissions or other characteristics
to be preserved or ignored.
a | Do not preserve file access times.
|
e | Retain the user and group IDs, permissions (mode),
and access and modification time.
|
m | Do not preserve the file modification time.
|
o | Retain the user and group ID.
|
p | Keep the permissions (mode).
|
- -r
- Read an archive and extract files.
- -s replacement
- Use replacement to modify file or archive member names.
This is a string of the form
-s/old/new/[gp].
This is similar to the substitution commands in ed,
ex, and sed.
old is a regular expression,
and new may contain & to mean
the matched text and \n
for subpatterns.
The trailing g indicates the substitution should
be applied globally.
A trailing p causes pax to
print the resulting new filename.
Multiple -s options may be supplied.
The first one that works is applied.
Any delimiter may be used, not just /, but in
all cases it is wise to quote the argument to prevent the shell
from expanding wildcard characters.
- -t
- Reset the access time of archived files to what they were before
being archived by pax.
- -u
- Ignore files older than preexisting files or archive members.
The behavior varies based on the current mode.
- Extract mode
- Extract the archive file if it is newer than an existing file with the same name.
- Archive mode
- If an existing file with the same name as an archive member is newer
than the archive member, supersede the archive member.
- Pass-through mode
- Replace the file in the destination hierarchy with the file in the source
hierarchy (or a link to it) if the source hierarchy's file is newer.
- -v
- In list mode, print a verbose table of contents.
Otherwise, print archive member names on standard error.
- -w
- Write files to standard output in the given archive format.
- -x format
- Use the given format for the archive.
The value of format is either cpio
or ustar.
The details of both formats are provided in the IEEE 1003.1 (1990) POSIX
standard.
The two formats are mutually incompatible; attempting to append using one
format to an archive using the other is an error.
- -X
- When traversing directory trees, do not cross into a directory on
a different device (the st_dev field in the stat
structure, see stat(2);
similar to the -mount option of find).
ExamplesCopy the current directory to tape:
pax -x ustar -w -f /dev/rmt/0m .
Copy a home directory to a different directory
(presumably on a bigger disk).
# cd /home
# pax -r -w arnold /newhome
|
perl | perl [options] [programfile] [files]
perl is the interpreter for the Perl
programming language (the Swiss Army knife of Unix programming tools).
The Perl program is provided via one or more -e options.
If no -e options are used, the first file named on
the command line is used for the program.
For more information about Perl, see
Learning Perl,
Programming Perl,
and
Advanced Perl Programming, all listed in the Bibliography.
Note: while not distributed with SVR4 or Solaris, perl is
widely used for the Web, CGI, and system-administration tasks,
and many other things.
The starting point for All Things Perl is
http://www.perl.com.
OptionsThis option list is for perl Version 5.005 patchlevel 2.
See perlrun(1) for more details.
- -a
- Turn on autosplit mode when used with -n or -p.
Splits to @F.
- -c
- Check syntax but does not execute.
- -d
- Run the script under the debugger.
Use -de 0 to start the debugger without a script.
- -d:module
- Run the script under control of the module installed as
Devel:module.
- -Dflags
- Set debugging flags.
flags may be a string of letters, or
the sum of their numerical equivalents.
See "Debugging Flags."
perl must be compiled with
-DDEBUGGING for these flags to take effect.
- -e 'commandline'
- May be used to enter a single line of script.
Multiple -e commands may be given to build up a
multiline script.
- -F regexp
- Specify a regular expression to split on if -a is in effect.
- -h
- Print a summary of the options.
- -i[ext]
- Files processed by the <> construct are
to be edited in place.
The old copy is renamed, and the processed copy is written to the
original filename.
The optional ext indicates an extension to use
for the renamed copy.
Various rules apply to how this is done; see perlrun(1).
- -Idir
- With -P, tells the C preprocessor where
to look for include files.
The directory is also prepended to @INC.
- -l[octnum]
- Enables automatic line-end processing, e.g., -l013.
- -m[-]module
- Equivalent to use module();.
With a – after -m, it is
equivalent to no module();.
- -m[–]'module=arg[,arg]',
-M[–]'module=arg[,arg]',
- Shorthand for -M'module qw(arg ...)'.
This avoids the need for quoting inside the argument.
- -M[–]'module [...]'
- Equivalent to use module...;.
With a – after -M, it is
equivalent to no module...;.
The “...” represents additional code you might wish to supply,
for example:
-M'mymodule qw(whizfunc wimpfunc)'
- -n
- Assume an input loop around your script.
Input lines are not printed.
(Like sed -n or awk.)
- -p
- Assume an input loop around your script.
Input lines are printed.
(Like sed.)
- -P
- Run the C preprocessor on the script before
compilation by perl.
- -s
- Interpret -xxx on the command line as
a switch and sets the corresponding variable $xxx in the script.
- -S
- Use the PATH environment variable to search for
the script.
- -T
- Force taint checking.
- -u
- Dump core after compiling the script.
For use with
the undump(1) program (where available).
Largely superseded by the Perl-to-C compiler that comes with perl.
- -U
- Allow perl to perform unsafe operations.
- -v
- Print the version and patchlevel of the perl executable.
- -V
- Print the configuration information and the value of @INC.
- -V:var
- Print the value of configuration variable var to standard output.
- -w
- Print warnings about possible spelling errors and
other error-prone constructs in the script.
- -x [dir]
- Extract the Perl program from the input stream.
If dir is specified, perl
switches to it before running the program.
- -0val
- (That's the number zero.) Designate an
initial value for the record separator $/.
See also -l.
Debugging Flags
Value | Letter | Debugs |
1 | p | Tokenizing and parsing |
2 | s | Stack snapshots |
4 | l | Context (loop) stack processing |
8 | t | Trace execution |
16 | o | Method and overloading resolution |
32 | c | String/numeric conversions |
64 | P | Print preprocessor command for -P |
128 | m | Memory allocation |
256 | f | Format processing |
512 | r | Regular expression parsing and execution |
1024 | x | Syntax tree dump |
2048 | u | Tainting checks |
4096 | L | Memory leaks (needs -DLEAKTEST when compiling perl)
|
8192 | H | Hash dump; usurps values() |
16384 | X | Scratch-pad allocation |
32768 | D | Cleaning up |
65536 | S | Thread synchronization |
|
pic | pic [options] [files]
Preprocessor for
nroff/troff line pictures. See Chapter 17.
|
pr | pr [options] [files]
Format one or more files according to options to standard
output. Each page includes a heading that consists of the page number,
filename, date, and time.
When files are named directly, the date and time are
those of the file's modification time.
Otherwise, the current date and time are used.
Options- -a
- Multicolumn format; list items in rows going across.
- -d
- Double-spaced format.
- -e[cn]
- Set input tabs to every n th position (default is 8),
and use c as field delimiter (default is a tab).
- -f
- Separate pages using formfeed character (^L) instead of
a series of blank lines.
- -F
- Fold input lines (avoids truncation by -a or -m).
- -hstr
- Replace default header with string str.
- -icn
- For output, replace whitespace with field
delimiter c (default is a tab) every nth position (default
is 8).
- -ln
- Set page length to n lines (default is 66).
- -m
- Merge files, printing one in each column
(can't be used with -n and -a).
Text is chopped to fit. See also paste.
- -n[cn]
- Number lines with numbers n digits in
length (default is 5), followed by field separator c
(default is a tab).
See also nl.
- -on
- Offset each line n spaces (default is 0).
- -p
- Pause before each page.
- -r
- Suppress messages for files that can't be found.
- -sc
- Separate columns with c (default is a tab).
- -t
- Omit the page header and trailing blank lines.
- -wn
- Set line width to n (default is 72).
- +num
- Begin printing at page num (default is 1).
- -n
- Produce output having n columns (default is 1);
tabs are expanded as with -i.
ExamplesPrint a side-by-side list, omitting heading and extra lines:
pr -m -t list.1 list.2 list.3
Alphabetize a list of states; number the lines in five columns:
sort states_50 | pr -n -5
|
printenv | /usr/ucb/printenv [variable]
Print values of all environment variables
or, optionally, only the specified variable.
The SVR4 alternative, env, doesn't let you
view just one variable, but it lets you redefine them.
|
printf | printf formats [strings]
Print strings using the specified formats.
formats can be ordinary text characters, C-language escape
characters,
printf(3S) format conversion specifiers,
or, more commonly, a set of conversion arguments listed next.
Arguments- %b
- Process a string argument for backslash escapes
(not in printf(3S)).
See the description of allowed escapes under echo.
- %s
- Print the next string.
- %n$s
- Print the n th string.
- %[-]m[.n]s
- Print the next string, using a field that is m characters wide.
Optionally limit the field to print only the first n characters
of string.
Strings are right-adjusted unless the
left-adjustment flag – is specified.
Examples$ printf '%s %s\n' "My files are in" $HOME
My files are in /home/arnold
$ printf '%-25.15s %s\n' "My files are in" $HOME
My files are in /home/arnold
|
prof | /usr/ccs/bin/prof [options] [object_file]
Display the profile data for an object file.
The file's symbol table is compared with profile file mon.out
(created by programs compiled with cc -p).
Choose only one of the sort options
-a, -c, -n, or -t .
See also gprof
and lprof.
Options
-a | List output by symbol address.
|
-c | List output by decreasing number of calls.
|
-C | Demangle C++ symbol names.
Solaris only.
|
-g | Include nonglobal (static) function symbols
(invalid with -l).
|
-h | Suppress the report heading.
|
-l | Exclude nonglobal function symbols (the default).
Invalid with -g.
|
-mpf | Use pf as the input profile file instead of mon.out.
|
-n | List by symbol name.
|
-o | Show addresses in octal (invalid with -x).
|
-s | Print a summary on standard error.
|
-t | List by decreasing total time percentage (the default).
|
-V | Print version information on standard error.
|
-x | Show addresses in hexadecimal (invalid with -o).
|
-z | Include zero usage calls.
|
|
prs | /usr/ccs/bin/prs [options] files
An SCCS command. See Chapter 18.
|
prt | /usr/ccs/bin/prt [options] files
Solaris only. An SCCS command. See Chapter 18.
|
ps | ps [options]
Report on active processes. In options, list arguments
should either be separated by commas or put in double quotes.
In comparing the amount of output produced, note that
-e > -d > -a and -l > -f.
In the BSD version, options work much differently; you can also
display data for a single process.
Options- -a
- List all processes except group leaders and processes not
associated with a terminal.
- -A
- Same as -e.
Solaris only.
- -c
- List scheduler data set by priocntl
(an administrative command).
- -d
- List all processes except session leaders.
- -e
- List all processes.
- -f
- Produce a full listing.
- -glist
- List data only for specified list of group leader ID numbers
(i.e., processes with same ID and group ID).
- -G list
- Show information for processes whose real group ID
is found in list.
Solaris only.
- -j
- Print the process group ID and session ID.
- -l
- Produce a long listing.
- -nfile
- Use the alternate file for the list of function names
in the running kernel
(default is /unix);
obsolete as of SVR4.
- -o format
- Customize information according to format.
Rarely used.
Solaris only.
- -plist
- List data only for process IDs in list.
- -slist
- List data only for session leader IDs in list.
- -tlist
- List data only for terminals in list (e.g., tty1).
- -ulist
- List data only for usernames in list.
- -U uidlist
- Show information for processes whose real user ID
is found in list.
Solaris only.
- -y
- With -l, omit the F
and ADDR columns and use kilobytes
instead of
pages for the RSS and SZ columns.
Solaris only.
|
pwd | pwd
Print the full pathname of the current directory.
(Command name stands for “print working directory.”)
Note: the built-in versions, pwd (Bourne and Korn shells)
and dirs (C shell), are faster, so
you might want to define the following C shell alias:
alias pwd dirs -l
|
rcp | rcp [options] sources target
Copy files between machines.
Both sources and target are filename
specifications of the form
host:pathname, where
host: can be omitted for a file on the local machine.
If no pathname is included in
target, source files are placed in your home directory.
If you have a different username on the remote host, specify the form
username@hostname:file.
See also ssh.
Options- -p
- Preserve in copies the modification times, access times, and modes of
the source files.
- -r
- If target and sources are both directories, copy each subtree
rooted at source.
Bear in mind that both symbolic and hard links are copied as real files;
the linking structure of the original tree is not
preserved.
ExamplesCopy the local files junk and test to your home directory
on machine hermes:
rcp junk test hermes:
Copy the local bin directory and all subdirectories to the
/usr/tools directory on machine diana:
rcp -r /bin diana:/usr/tools
Copy all files in your home directory on machine hera,
and put them in local directory /home/daniel with times and modes
unchanged:
rcp -p "hera:*" /home/daniel
Quote the first argument to prevent filename expansion
from occurring on
the local machine.
|
regcmp | /usr/ccs/bin/regcmp [-] files
Stands for “regular expression compile.”
Compile the regular expressions in one or more files and place
output in file.i
(or in file.c if - is
specified). The output is C source code, while the
input entries in files are of the form:
C variable "regular expression"
The purpose of this program is to precompile regular expressions
for use with the regex(3C) library routine,
avoiding the overhead of the regcmp(3C) function.
|
refer | refer [options] files
Bibliographic references preprocessor for troff.
See Chapter 17.
|
reset | /usr/ucb/reset [options] [type]
Clear terminal settings.
reset disables CBREAK mode, RAW mode, output delays,
and parity checking.
reset also restores undefined special characters and enables processing
of newlines, tabs, and echoing.
This command is useful when a program aborts in a way that leaves the
terminal confused (e.g., keyboard input might not echo on the screen).
To enter reset at the keyboard, you may need to use a
linefeed (^J) instead of a carriage return.
reset uses the same command-line arguments as tset.
|
rksh | rksh [options] [arguments]
Restricted version of ksh (the Korn shell), used in secure environments.
rksh prevents you from changing out of the directory or from
redirecting output. See Chapter 4.
|
rlogin | rlogin [options] host
Connect terminal on current local host system
(i.e., log in) to a remote host system.
The .rhosts file in your home directory
(on the remote host) lists the hostnames (and optionally,
the usernames on those hosts)
you're allowed to connect from without giving a password.
See also ssh.
Options- -8
- Allow 8-bit data to pass instead of 7-bit data.
- -e c
- Use escape character c (default is ~).
You can type ~. to disconnect from remote host, though
you'll exit more “cleanly” by logging out.
- -E
- Do not have any escape character.
Solaris only.
- -l user
- Log in to remote host as user, instead of using
the name on the local host.
- -L
- Allow rlogin to run in LITOUT mode
(8-bit data may pass in output only).
|
rm | rm [options] files
Delete one or more files. To remove a file, you must have write
permission in the directory that contains the file, but you need not
have permission on the file itself. If you do not have write
permission on the file, you are prompted (y or n) to override.
Options- -f
-
Force.
Remove write-protected files without prompting.
- -i
- Prompt for y (remove the file) or n
(do not remove the file).
Overrides -f.
- -r
-
If file is a directory,
remove the entire directory and all its contents, including subdirectories.
Be forewarned: use of this option can be dangerous.
- -R
- Same as -r.
Solaris only.
- --
- Mark the end of options (rm still accepts -,
the old form).
Use this when supplying a filename beginning with –.
|
rmdel | /usr/ccs/bin/rmdel -rsid files
An SCCS command. See Chapter 18.
|
rmdir | rmdir [options] directories
Delete the named directories
(the directory itself, not the contents).
directories are deleted from the parent directory
and must be empty (if not, rm -r can be used instead).
See also mkdir.
Options- -p
- Remove directories and any intervening parent directories
that become empty as a result; useful for removing subdirectory trees.
- -s
- Suppress standard error messages caused by -p.
|
rmic | /usr/java/bin/rmic [options] classes
Solaris only.
Remote Method Invocation compiler for Java.
rmic takes the fully package-qualified class names and
generates skeleton and stub class files to provide remote method invocation.
The class must have previously been successfully compiled
with java.
For a method WhizImpl in class whiz,
rmic creates two files,
WhizImpl_Skel.class and
WhizImpl_Stub.class.
The “skeleton” file implements the server side of the RMI;
the “stub” file implements the client side.
Options- -classpath path
- Use path as the search path for class
files, overriding $CLASSPATH.
path is a colon-separated list of directories.
- -d dir
- Place the generated files in dir.
- -depend
- Recompile missing or out-of-date class files referenced from other
class files, not just from source code.
- -g
- Generate debugging tables with line numbers.
With -O, also generate information about
local variables.
- -keepgenerated
- Keep the generated .java source files for the
skeletons and the stubs.
- -nowarn
- Disable all warnings.
- -O
- Perform optimizations that may produce faster but larger class files.
It may also slow down compilation.
This option should be used with discretion.
- -show
- Use the GUI for the RMI compiler to enter class names.
- -verbose
- Print messages as files are compiled and loaded.
|
rmiregistry | /usr/java/bin/rmiregistry [port]
Solaris only.
Create and start a remote object registry on the specified port.
The default port is 1099.
The registry provides naming services for RMI (Remote Method Invocation)
servers and clients.
|
roffbib | roffbib [options] [files]
Part of the refer suite of programs.
See Chapter 17.
|
rsh | /usr/lib/rsh
Restricted version of sh (the Bourne shell)
that is intended to be used where security is important.
rsh prevents you from changing out of the directory or from
redirecting output. See Chapter 4.
|
rsh | rsh [options] host [command]
A BSD-derived command to invoke a remote shell. This command is often
found in /usr/ucb and should not be confused with rsh,
the restricted shell.
On Solaris, it is in /usr/bin.
rsh connects to host and executes command.
If command
is not specified, rsh allows you to rlogin to host.
If shell metacharacters need to be interpreted on the remote machine,
enclose them in quotes. This command is sometimes called remsh.
See also ssh.
Options- -l user
- Connect to host with a login name of user.
- -n
- Divert input to /dev/null. Sometimes useful when piping rsh to a
command that reads standard input but that might terminate before rsh.
|
sact | /usr/ccs/bin/sact files
An SCCS command.
See Chapter 18.
|
sccs | /usr/ccs/bin/sccs [options] command [SCCS_options] [files]
A user-friendly interface to SCCS. See Chapter 18.
|
sccsdiff | /usr/ccs/bin/sccsdiff -rsid1 -rsid2 [options] files
An SCCS command. See Chapter 18.
|
script | script [option] [file]
Create a record of your login session, storing in file everything that
displays on your screen. The default file is called typescript.
script records non-printing characters as control characters and
includes prompts. This command is useful for beginners or for
saving output from a time-consuming command.
Option- -a
- Append the script record to file.
|
sdiff | sdiff [options] file1 file2
Produce a side-by-side comparison of file1 with file2.
Output is:
- text text
- Identical lines.
- text <
- Line that exists only in file1.
- > text
- Line that exists only in file2.
- text | text
- Lines that are different.
Options- -l
- List only lines of file1 that are identical.
- -o outfile
- Send identical lines of
file1 and file2 to outfile;
print line differences and edit outfile
by entering, when prompted, the following commands:
e | Edit an empty file.
|
e b | Edit both left and right columns.
|
e l | Edit left column.
|
e r | Edit right column.
|
l | Append left column to outfile.
|
q | Exit the editor.
|
r | Append right column to outfile.
|
s | Silent mode; do not print identical lines.
|
v | Turn off “silent mode.”
|
- -s
- Do not print identical lines.
- -wn
- Set line length to n (default is 130).
ExampleShow differences using 80 columns and ignore identical lines:
sdiff -s -w80 list.1 list.2
|
sed | sed [options] [files]
Stream editor.
Edit one or more files without user interaction.
See Chapter 10,
for more information on sed.
The -e and -f options
may be provided multiple times, and they may be used with each other.
Options- -e 'instruction'
- Apply the editing instruction to the files.
- -f script
- Apply the set of instructions from the editing script.
- -n
- Suppress default output.
|
serialver | /usr/java/bin/serialver [-show | classname]
Solaris only.
Print the serialVersionUID for classname
in a form suitable for copying into an evolving class.
The -show option starts a simple GUI in which you enter
the full classname.
|
sh | sh [options] [arguments]
The standard command interpreter (or Bourne shell)
that executes commands from a
terminal or a file. See Chapter 4 for more information on
the
Bourne shell, including command-line options.
|
size | /usr/ccs/bin/size [options] [objfile ...]
Print the (decimal) number of bytes of each section
of objfile.
If objfile is not specified, a.out is used.
Options- -f
- Print sizes, names, and total size for allocatable sections.
- -F
- Print sizes, permission flags, and total size for loadable segments.
- -n
- Print sizes for nonallocatable sections or for nonloadable segments.
- -o
- Print output in octal.
- -V
- Report the size program version number.
- -x
- Print output in hexadecimal.
|
sleep | sleep seconds
Wait a specified number of seconds before
executing another command. Often used in shell scripts.
sleep is built in to ksh93.
|
soelim | soelim [files]
A preprocessor that reads nroff/troff
input files,
resolving and then eliminating .so requests.
That is, input lines such as:
.so header
are replaced by the contents of the file header.
Normally, .so requests are resolved by nroff or troff.
Use soelim whenever you are preprocessing the input
(e.g., passing it through tbl or sed), and the
complete text is needed prior to formatting.
ExampleRun a sed script
on (all) input before formatting:
soelim file | sed -e 's/--/\\(em/g' | nroff -mm - | lp
|
sort | sort [options] [files]
Sort the lines of the named files,
typically in alphabetical order.
See also comm">uniq, comm,
and join.
Options- -b
- Ignore leading spaces and tabs.
- -c
- Check whether files are already sorted, and if so, produce no
output.
- -d
- Sort in dictionary order (ignore punctuation).
- -f
- “Fold”; ignore uppercase/lowercase differences.
- -i
- Ignore nonprinting characters (those outside ASCII range 040-176).
- -k fieldspec
- Specify significance of input fields for sorting.
See the fuller description below.
Solaris only.
- -m
- Merge sorted input files.
- -M
- Compare first three characters as months.
- -n
- Sort in arithmetic (numerical) order.
- -o file
- Put output in file.
- -r
- Reverse the order of the sort.
- -tc
- Fields are separated with c (default is any whitespace).
- -T dir
- Use dir for temporary files.
Solaris only.
- -u
- Identical lines in input file appear only one (u nique) time in
output.
- -y[kmem]
- Adjust the amount of memory (in kilobytes) sort uses.
If kmem is not specified, allocate the maximum memory.
- -zrecsz
- Provide the maximum number of bytes for any one line in
the file. This option prevents abnormal termination
of sort in certain
cases.
Solaris sort accepts but otherwise ignores this option.
- +n [-m]
- Skip n fields before sorting, and sort up to field position
m. If m is missing, sort to end of line.
Positions take the form a.b, which means
character b of field a. If .b is missing,
sort at the first character of the field.
Counting starts at zero.
Solaris allows fields to have optional trailing modifiers, as
in the -k option.
Field Specifications for -kA fieldspec has the form
fieldstart[type][,fieldend[type]].
- fieldstart
- A field number and optional starting character of the form
fnum[.schar].
fnum is the field number, starting from 1.
schar, if present, is the starting character within
the field, also counting from 1.
- fieldend
- A field number and optional ending character of the form
fnum[.echar].
fnum is the field number, starting from 1.
echar, if present, is the last
significant character within
the field, also counting from 1.
- type
- A modifier, one of the letters
b,
d,
f,
i,
M,
n,
or
r.
The effect is the same as the corresponding option, except that
the b modifier only applies to the fields,
not the whole line.
ExamplesList files by decreasing number of lines:
wc -l * | sort -rn
Alphabetize a list of words, remove duplicates, and print the frequency
of each word:
sort -fd wordlist | uniq -c
Sort the password file numerically by the third field (user ID):
sort +2n -t: /etc/passwd
Find the top 20 disk hogs on a system:
cd /home; du -sk * | sort -nr | head -20
|
sortbib | sortbib [option] files
Part of the refer suite of programs.
See Chapter 17.
|
sotruss | sotruss [options] program [args ...]
Solaris only.
Shared object library version of truss.
sotruss executes program,
passing it args, if any.
It then traces calls into and/or out of shared object libraries that are
loaded dynamically.
Options- -f
- Follow children created by fork(2) and print
output for each child.
Each output line contains the process's process ID.
- -F fromlist
- Only trace calls from the libraries named in fromlist,
which is a colon-separated list of libraries.
The default is to trace only calls from the main executable.
- -o file
- Send output to file.
If used with -f, the process ID of the running
program is appended to the filename.
- -T tolist
- Only trace calls to routines in the libraries named in tolist,
which is a colon-separated list of libraries.
The default is to trace all calls.
|
spell | spell [options] [files]
Compare the words of one or more named files with the system
dictionary and report all misspelled words. System files for
spell reside in /usr/lib/spell.
Options- -b
- Check for British spelling.
- -i
- Ignore files included with the nroff
or troff .so request.
No effect if deroff is unavailable.
- -l
- Follow all included files (files named
in .so or .nx
requests); default is to ignore files that begin
with /usr/lib.
- -v
- Include words that are derived from dictionary list but are not
literal entries.
- -x
- Show every possible word stem (on standard error).
- +wordlist
- Use the sorted wordlist file as a local dictionary to add
to the system dictionary; words in wordlist are not treated
as misspelled.
ExampleRun the first pass of spell:
spell file1 file2 > jargon
After editing the jargon file,
use it as a list of
special terms. The second pass of spell produces genuine
misspellings:
spell +jargon file[12] > typos
|
split | split [options] [infile] [outfile]
Split infile into several files of equal length.
infile remains unchanged, and the results are written to
outfileaa, outfileab, etc.
(default is xaa, xab, etc.).
If infile is – (or missing), standard input is read.
See also csplit.
Option- -n
- Split infile into files, each n lines long (default is 1000).
Solaris OptionsThese options are unique to Solaris:
- -a slen
- Use slen characters for the filename suffix.
Default is 2.
- -b n[m]
- Split into pieces of size n bytes.
An optional multiplier m may be supplied:
k for kilobytes and m
for megabytes.
Mutually exclusive with -l.
- -ln
- Same as -n.
Mutually exclusive with -b.
ExamplesBreak bigfile into 1000-line segments:
split bigfile
Join four files, then split them into ten-line files named
new.aa, new.ab, etc. Note that without
the -, new.
would be treated as a nonexistent input file:
cat list[1-4] | split -10 - new.
|
srchtxt | srchtxt [options] [regexp]
A grep-like utility to search message files for text strings that
match regular expression regexp.
srchtxt is one of the message
manipulation commands like gettxt and mkmsgs.
If no regexp is used,
srchtxt displays all message strings from the specified files.
Options
- -l locale
- Search files that reside in the directory /usr/lib/locale/ locale/LC_MESSAGES,
where locale is the language in which the message strings have been
written. The default locale is set by environment variables
LC_MESSAGES or LANG. If neither is set, srchtxt searches
directory /usr/lib/locale/C/LC_MESSAGES.
- -m msgfiles
- Search for strings in one or more comma-separated msgfiles.
Specifying a pathname for msgfiles overrides the -l option.
- -s
- Don't print message numbers for strings.
|
ssh | ssh2 [-l user] host [commands] ssh2 [options] [user@]host
Secure shell.
This is a secure replacement for the rsh,
rlogin, and rcp programs.
ssh uses strong public-key encryption technologies
to provide end-to-end encryption of data.
There may be licensing/patent issues restricting the use of the software
in some countries.
Note: ssh2 is not distributed with SVR4 or Solaris.
Source code for the noncommercial version for Unix can be downloaded from
ftp://ftp.cs.hut.fi/pub/ssh.
More information can be found at
http://www.ssh.fi
and
http://www.ipsec.com.
|
strings | strings [options] files
Search object or binary files
for sequences of four or more printable characters that end with a
newline or null. See also od.
Options- -a
- Search entire file, not just the initialized data portion of object files.
Can also specify this option as -.
- -o
- Display the string's offset position before the string.
- -n n
- Minimum string length is n (default is 4).
Can also specify this option as -n.
- -t format
- Specify how to print string offsets.
format is one of
d,
o,
or
x
for decimal, octal, or hexadecimal,
respectively.
Solaris only.
|
strip | /usr/ccs/bin/strip [options] files
Remove information from ELF object files or archive files,
thereby reducing file sizes and freeing disk space.
The following items can be removed:
Symbol table
Debugging information
Line number information
Static symbol information
External symbol information
Block delimiters
Relocation bits
ELF versions of strip provide facilities for
removing only the first
three items.
OptionsThe following options refer to the previous list:
- -b
- Strip only Items 1, 2, and 3.
This is the default.
- -l
- Strip only Item 3 (line number information).
- -r
- Strip Items 1, 2, 3, and 6.
(Solaris: same as the default action: strip Items 1, 2, and 3.)
- -V
- Print the version number of strip on standard error.
- -x
- Strip only Items 2 and 3.
|
stty | stty [options] [modes]
Set terminal I/O options for the current device. Without options,
stty reports the terminal settings, where a ^
indicates the Control key, and ^‘ indicates a null value.
Most modes can be switched using an optional preceding –
(shown in brackets).
The corresponding description is also shown in brackets.
As a privileged user, you can set or read settings from another device using
the syntax:
stty [options] [modes] < device
stty is one of the most complicated Unix commands.
The complexity stems from the need to deal with a large range of
conflicting, incompatible, and
nonstandardized terminal devices--everything from printing teletypes
to CRTs to pseudo-terminals for windowing systems.
Only a few of the options are really needed for day-to-day use.
stty sane is a particularly valuable one to remember.
Options- -a
- Report all option settings.
- -g
- Report current settings.
Control Modes
- 0
- Hang up connection (set the baud rate to zero).
- n
- Set terminal baud rate to n (e.g., 19200).
- [-]clocal
- [Enable] disable modem control.
- [-]cread
- [Disable] enable the receiver.
- [-]crtscts
- [Disable] enable output hardware flow control using RTS/CTS.
- [-]crtsxoff
- [Disable] enable input hardware flow control using RTS.
- csn
- Select character size in bits (5 n 8).
- [-]cstopb
- [One] two stop bits per character.
- defeucw
- Set the width in bytes per character and screen display columns per character,
for EUC (Extended Unix Code) characters.
Solaris only.
- [-]hup
- [Do not] hang up connection on last close.
- [-]hupcl
- Same as [-]hup.
- ispeed n
- Set terminal input baud rate to n.
- [-]loblk
- [Do not] block layer output.
For use with shl; obsolete.
- ospeed n
- Set terminal output baud rate to n.
- [-]parenb
- [Disable] enable parity generation and detection.
- [-]parext
- [Disable] enable extended parity generation and detection for
mark and space parity.
- [-]parodd
- Use [even] odd parity.
Input Modes
- [-]brkint
- [Do not] signal INTR on break.
- [-]icrnl
- [Do not] map carriage return (^M) to newline (^J) on input.
- [-]ignbrk
- [Do not] ignore break on input.
- [-]igncr
- [Do not] ignore carriage return on input.
- [-]ignpar
- [Do not] ignore parity errors.
- [-]imaxbel
- [Do not] echo BEL when input line is too long.
- [-]inlcr
- [Do not] map newline to carriage return on input.
- [-]inpck
- [Disable] enable input parity checking.
- [-]istrip
- [Do not] strip input characters to 7 bits.
- [-]iuclc
- [Do not] map uppercase to lowercase on input.
- [-]ixany
- Allow [only XON] any character to restart output.
- [-]ixoff
- [Do not] send START/STOP characters when the
queue is nearly empty/full.
- [-]ixon
- [Disable] enable START/STOP output control.
- [-]parmrk
- [Do not] mark parity errors.
Output Modes
- bsn
- Select style of delay for backspaces (n = 0 or 1).
- crn
- Select style of delay for carriage returns (0 n 3).
- ffn
- Select style of delay for formfeeds (n = 0 or 1).
- nln
- Select style of delay for linefeeds (n = 0 or 1).
- [-]ocrnl
- [Do not] map carriage return to newline on output.
- [-]ofdel
- Set fill character to [NULL] DEL.
- [-]ofill
- Delay output with [timing] fill characters.
- [-]olcuc
- [Do not] map lowercase to uppercase on output.
- [-]onlcr
- [Do not] map newline to carriage return-newline on output.
- [-]onlret
- [Do not] perform carriage return after newline.
- [-]onocr
- [Do not] output carriage returns at column zero.
- [-]opost
- [Do not] postprocess output; ignore all other output modes.
- tabn
- Select style of delay for horizontal tabs (0 n 3).
- vtn
- Select style of delay for vertical tabs (n = 0 or 1).
Local Modes
- [-]echo
- [Do not] echo every character typed.
- [-]echoctl
- [Do not] echo control characters as ^char,
DEL as ^?.
- [-]echoe
- [Do not] echo ERASE character as BS-space-BS string.
- [-]echok
- [Do not] echo newline after KILL character.
- [-]echoke
- [Do not] BS-SP-BS erase entire line on line kill.
- [-]echonl
- [Do not] echo newline (^J).
- [-]echoprt
- [Do not] echo erase character as character is “erased.”
- [-]flusho
- Output is [not] being flushed.
- [-]icanon
- [Disable] enable canonical input (ERASE and KILL processing).
- [-]iexten
- [Disable] enable extended functions for input data.
- [-]isig
- [Disable] enable checking of characters against INTR,
QUIT, and SWITCH.
- [-]lfkc
- Same as [-]echok.
Obsolete.
- [-]noflsh
- [Enable] disable flush after INTR, QUIT, or
SWITCH.
- [-]pendin
- [Do not] retype pending input at next read or input character.
- [-]stappl
- [Line] application mode on a synchronous line.
- [-]stflush
- [Disable] enable flush on synchronous line.
- [-]stwrap
- [Enable] disable truncation on synchronous line.
- [-]tostop
- [Do not] send SIGTTOU when background processes write to the
terminal.
- [-]xcase
- [Do not] change case on local output.
Control Assignments
- ctrl-char c
- Set control character to c. ctrl-char is:
ctab, discard, dsusp, eof,
eol, eol2,
erase, intr, kill,
lnext, quit, reprint,
start, stop, susp, swtch,
werase.
- min n
- With -icanon, n is the
minimum number of characters that will satisfy the read
system call until the timeout set with time expires.
- time n
- With -icanon, n is the number of tenths
of seconds to wait before a read system call times out.
If the minimum number of characters set with min has
been read, the read can return before the timeout
expires.
- line i
- Set line discipline to i (1 i 126).
Combination Modes
- async
- Set normal asynchronous communications.
- cooked
- Same as -raw.
- [-]evenp
- Same as [-]parenb and
cs7[8].
- ek
- Reset ERASE and KILL characters to # and @.
- [-]lcase
- [Un] set xcase, iuclc, and olcuc.
- [-]LCASE
- Same as [-]lcase.
- [-]markp
- [Disable] enable parenb, parodd,
and parext, and set cs7[8].
- [-]nl
- [Un] set icrnl and onlcr.
-nl also unsets
inlcr, igncr, ocrnl, and onlret.
- [-]oddp
- Same as [-]parenb, [-]parodd, and
cs7[8].
- [-]parity
- Same as [-]parenb and cs7[8].
- [-]raw
- [Disable] enable raw input and output (no ERASE, KILL, INTR,
QUIT, EOT, SWITCH, or output postprocessing).
- sane
- Reset all modes to reasonable values.
- [-]spacep
- [Disable] enable parenb and parext, and set cs7[8].
- [-]tabs
- [Expand to spaces] preserve output tabs.
- term
- Set all modes suitable for terminal
type term (tty33, tty37, vt05, tn300, ti700, or tek).
(These predefined names are all so obsolete as to be useless.)
Hardware Flow Control Modes
- [-]cdxon
- [Disable] enable CD on output.
- [-]ctsxon
- [Disable] enable CTS on output.
- [-]dtrxoff
- [Disable] enable DTR on input.
- [-]isxoff
- [Disable] enable isochronous hardware flow control on input.
- [-]rtsxoff
- [Disable] enable RTS on input.
Clock Modes
These options may not be supported on all hardware:
- [x|r]cibrg
- Get the transmit|receive clock from internal baud rate generator.
- [x|r]ctset
- Get the transmit|receive clock from transmitter timing-lead,
CCITT V.24 circuit 114,
EIA-232-D pin 15.
- [x|r]crset
- Get the transmit|receive clock from receiver timing-lead,
CCITT V.24 circuit 115,
EIA-232-D pin 17.
For modes beginning with t,
pin is transmitter timing-lead,
V.24 circuit 113, EIA-232-D pin 24.
For modes beginning with r,
pin is receiver timing-lead,
V.24 circuit 128, no EIA-232-D pin.
- [t|r]setcoff
- No transmitter|receiver timing clock.
- [t|r]setcrbrg
- Send receive baud rate generator to pin.
- [t|r]setctbrg
- Send transmit baud rate generator to pin.
- [t|r]setctset
- Send transmitter timing to pin.
- [t|r]setcrset
- Send receiver timing to pin.
Window size
- columns n
- Set size to n columns.
Can also be given as cols.
- rows n
- Set size to n rows.
- xpixels n
- Set size to n pixels across.
- ypixels n
- Set size to n pixels up and down.
|
su | su [option] [user] [shell_args]
Create a shell with the effective user ID of another user (that is,
login as user). If no user is specified, create a shell for a
privileged user (that is, become a superuser). Enter EOF to terminate.
You can run the shell with particular options by passing them
as shell_args (e.g., if the shell runs sh, you can specify
-c command to execute command via sh,
or -r to create a restricted shell).
su will inherit your environment settings.
Administrators wishing to switch to a user's setup (perhaps
to help them solve a problem) may wish to consider using this sequence:
me$ su Switch to root
Password: Enter root password
# su - user
Switch to other user
user$
Option- -
- Go through the entire login sequence (i.e., change to user's
environment).
|
tail | tail [options] [file]
Print the last ten lines of the named file. Use only one of
-f or -r.
Options- -f
- Don't quit at the end of file; “follow” file as it grows.
End with an INTR (usually ^C).
- -r
- Copy lines in reverse order.
- -n[k]
- Begin printing at n th item from end of file. k specifies
the item to count: l (lines, the default), b (blocks),
or c (characters).
- -k
- Same as previous, but use the default count of 10.
- +n[k]
- Like -n, but start at n th item from beginning of file.
- +k
- Like -k, but count from beginning of file.
ExamplesShow the last 20 lines containing instances of .Ah:
grep '\.Ah' file | tail -20
Continually track the latest uucp activity:
tail -f /var/spool/uucp/LOGFILE
Show the last 10 characters of variable name:
echo "$name" | tail -c
Reverse all lines in list:
tail -r list
|
talk | talk user [@hostname] [tty]
Exchange typed communication with another user who is on the
local machine or on machine hostname.
talk might be useful
when you're logged in via modem and need something quickly, making it
inconvenient to telephone or send email. talk splits your
screen into two windows. When connection is established, you type in
the top half while user's typing appears in the bottom half.
Type ^L to redraw the screen and ^C (or interrupt) to exit. If
user is logged in more than once, use tty to specify the
terminal line.
The user needs to have used mesg y.
NotesThere are different versions of talk
that use different protocols; interoperability across different
Unix systems is very limited.
talk is also not very useful if the remote user
you are “calling”
is using a windowing environment, since there is no way for you to know
which tty to use to get their attention.
The connection request could easily show up in an iconified window!
Even if you know the remote tty, the called
party must have done a mesg y to accept the request.
|
tar | tar [options] [files]
Copy files to or restore files from tape (tape archive).
If any files are directories,
tar acts on the entire subtree.
(See also cpio
and pax.)
Options are supplied as one group, with any arguments
placed afterward in corresponding order.
Originally, tar did not even accept a leading –
on its options.
Although the Solaris version allows one, it does not require it.
On many other Unix systems, you may use
conventional option notation, with each option
preceded by a dash and separated from the other options with whitespace.
Some systems actually require the use of separate options.
Check your local documentation for the final word.
Notes
For the following reasons, tar is best used as a way
to exchange file or source code archives over a network.
A system administrator performing system backups is advised to use
the vendor-supplied backup program (typically called dump
or backup; see your local documentation) for
backups instead of tar.
(Many of these same points apply to cpio
and to pax as well.)
Most Unix versions of tar preserve the leading
/ from an absolute filename in the archive.
This makes it difficult or impossible to extract the files on
a different system.
The tar archive format was designed when Unix file
and directory names were short (14 characters maximum).
Modern Unix systems allow individual filenames to be up to 255 characters
in length, but the tar archive header has a
limit of 100 characters for the entire pathname.
This makes it difficult or
impossible in practice to archive a typical Unix filesystem.
In general, Unix versions of tar cannot recover
from data errors, which are particularly common with tapes.
An early tape error can render an entire tar
tape useless.
While tar does checksum the header information
describing each archived file, it does not checksum the actual
data blocks.
Thus, if a data block
becomes corrupted on a tape,
tar will never notice.
The GNU version of tar
has extensions to get around many of these problems,
at the cost of portability of the archive format to non-GNU versions.
Source code can be obtained from the Free Software Foundation
(http://www.gnu.org).
Control Options (Solaris)- -C dir files
- Change directory to dir before adding
files to the archive.
Use relative pathnames.
This option makes it possible to archive files that don't share
a common ancestor directory.
- -I file
- Read a list of filenames to be archived,
one filename per line,
from file.
Useful when there are too many files to name on the command line.
- -X
- Exclude files.
The corresponding file argument is read for a list of relative
pathnames, one per line, of files that should not be archived.
This option may be provided multiple times with multiple files.
Filenames that appear here are excluded even if the same name
was provided in a file used with -I.
Function Options (choose one)- c
- Create a new archive.
- r
- Append files to archive.
- t
- Table of contents.
Print the names of files if they are stored on the archive (if files
not specified, print names of all files).
- u
- Update.
Add files if not in archive or if modified.
- x
- Extract files from archive (if files not specified, extract
all files).
Options- b n
- Use blocking factor n (default is 1; maximum is 20).
Different Unix systems often allow larger blocking factors.
- B
- Continue reading until logical blocks are full.
For use across Ethernet connections with rsh.
On by default when reading standard input.
Solaris only, but also common on many other Unix systems.
- e
- Exit immediately upon unexpected errors.
Solaris only.
- E
- Use an extended header that allows longer filenames,
larger files, and other extensions.
Not portable.
Solaris only.
- f arch
- Store files in or extract files from archive arch;
arch is usually a device name (default
varies from system to system).
If arch is -, standard input or output is used as appropriate
(e.g., when piping a tar archive to a remote host).
- F, FF
- With F, do not archive SCCS
and RCS directories.
With FF, also exclude files named
a.out,
core,
errs,
and all .o files.
Solaris only.
- i
- Ignore directory checksum errors.
Solaris only.
- k size
- Specify the archive size in kilobytes.
Archives that are larger than size are split across
volumes.
Useful for fixed-size media, such as floppy disks.
Solaris only.
- l
- Print error messages about links that can't be found.
- L
- Follow symbolic links.
SVR4 only.
- m
- Do not restore file modification times;
update them to the time of extraction.
- n
- Archive is not a tape device.
This allows tar to seek, instead of doing
sequential reads, which is faster.
Solaris only.
- o
- Change ownership of extracted files to that of user running program.
This is the default for nonprivileged users.
- p
- Preserve permissions of extracted files.
Solaris ACLs are restored if recorded in the archive
and are added to the archive when used with c.
- P
- Do not add a trailing / to directory names in
the archive.
Solaris only.
- v
- Print function letter (x for extraction or a for archive)
and name of files.
With t,
print a listing similar to that of ls -l.
- w
- Wait for user confirmation (y).
- n[c]
- Select tape drive n and use speed c.
n is 0–7 (default is 0);
c is l (low), h (high),
or m (medium, the default).
Used to modify arch.
(These are highly system-specific and non-portable:
it is much better to always just specify the arch
explicitly.)
ExamplesCreate an archive of /bin
and /usr/bin (c),
show the command working (v),
and write on the tape in /dev/rmt/0:
tar cvf /dev/rmt/0 /bin /usr/bin
List the archive's contents in a format like ls -l:
tar tvf /dev/rmt/0
Extract the /bin directory:
tar xvf /dev/rmt/0 /bin
Create an archive of the current directory, and store it
in a file /tmp/backup.tar on the system.
(Backing up a directory into a file in that directory almost
never works.)
tar cvf /tmp/backup.tar .
Similar, but compress the archive file:
tar cvf - . | compress > /tmp/backup.tar.Z
(The - tells tar to store the directory on standard output,
which is then redirected through the pipe.)
Copy a directory tree from one location to another:
# cd olddir; tar cf - . | (cd newdir; tar xvpf -)
|
tbl | tbl [options] [files]
Preprocessor for nroff/troff tables. See Chapter 17.
|
tee | tee [options] [files]
Duplicate the standard input; send one copy to standard output and
another copy to files.
Options- -a
- Append output to files.
- -i
- Ignore all interrupts.
ExamplesDisplay a who listing on the screen and store it
in two files:
who | tee userlist ttylist
Display misspelled words and add them to existing typos:
spell ch02 | tee -a typos
|
telnet | telnet [options] [host [port]]
Communicate with another host using the Telnet protocol.
host may be either a name or a numeric Internet address (dot format).
telnet has a command mode (indicated by the telnet> prompt)
and an input mode (usually a login session on the host system).
If no host is given, telnet defaults to command mode.
You can also enter command mode from input mode by
typing the escape character ^]. In command mode, type ? or
help to list the available commands.
Solaris OptionsSolaris telnet provides these options:
- -8
- Use an 8-bit data path.
This negotiates the BINARY option for input and output.
- -c
- Don't read $HOME/.telnetrc at startup.
- -d
- Set the debug option to true.
- -e c
- Use c as the escape character.
The default is ^].
A null value disables the escape character mechanism.
- -E
- Don't have an escape character.
- -l user
- Use the ENVIRON option to pass the value of
the USER environment variable.
- -L
- Use an 8-bit data path on output.
This negotiates the BINARY option only for output.
- -n file
- Record trace information in file.
- -r
- Provide an rlogin-style interface, in which the
escape character is ~ and is only recognized
after a carriage return.
The regular telnet escape character must still
be used before a telnet command.
"~. Return" and "~ ^Z" terminates
or stops a session, respectively.
This feature
may change in future versions of Solaris.
|
test | test expression or [ expression ]
Evaluate an expression and, if its value is
true, return a zero exit status; otherwise, return
a nonzero exit status. In shell scripts, you can use the alternate
form [ expression ]. The
brackets are typed literally and must be separated from
expression. Generally, this command is used with
conditional constructs in shell programs. See Chapter 4 for more information on test.
|
time | time [option] command [arguments]
Execute a command with optional arguments
and print the total elapsed time, execution
time, process execution time, and system time of the process
(all in seconds).
Times are printed on standard error.
OptionThis option is available only on Solaris:
- -p
- Print the real, user, and system times with a single space separating
the title and the value, instead of a tab.
|
timex | timex [options] command [arguments]
Execute a command with optional arguments
and print information specified by the
time command. Report process data with various options.
Options- -o
- Show total number of blocks and characters used.
- -p suboptions
- Show process accounting data with possible suboptions.
- -s
- Show total system activity.
Suboptions for –p- -f
- Include fork/exec flag and system exit status.
- -h
- Show “hog” factor (fraction of CPU time used)
instead of mean memory size.
- -k
- Show total kcore-minutes instead of memory size.
- -m
- Show mean core size (this is the default behavior).
- -r
- Show CPU use percentage (user time / (system time + user time)).
- -t
- Show user and system CPU times.
|
touch | touch [options] [date] files
For one or more files,
update the access time and modification timestamp
to the current time and date, or update to the optional
date. date is a date and time
in the format mmddhhmm[yy].
touch is useful in forcing other commands to handle files a certain
way; e.g., the operation of make, and sometimes find,
relies on a file's access and modification times.
Options- -a
- Update only the access time.
- -c
- Do not create nonexistent files.
- -m
- Update only the modification time.
- -r file
- Use the access and/or modification times of file
instead of the current time.
Solaris only.
- -t time
- Use the time as provided by time, which has the form
[[cc]yy]mmddhhmm[.ss].
Solaris only.
|
tput | tput [options] capname [arguments]
Print the value of the terminal capability capname (and its
associated numeric or string arguments) from the terminfo
database. capname is a terminfo capability such as clear
or col. (See termcap & terminfo, which is
listed in the Bibliography.)
The last five options are mutually exclusive and are not used when
specifying a capname.
Exit statuses are:
- 0
- When a Boolean
capname is set to true or when
a string capname is defined
- 1
- When a Boolean is false or when a string is undefined
- 2
- For usage errors
- 3
- For unknown terminal type
- 4
- For unknown capname
Options
- -Ttype
- Print the capabilities of terminal type (default is the terminal
in use).
- -S
- Read capname from standard input (this allows tput to
evaluate more than one capname).
- clear
- Print the clear-screen sequence.
Solaris only.
- init
- Print initialization strings and expand tabs.
- reset
- Print reset strings if present; act like init if not.
- longname
- Print the terminal's long name.
ExamplesShow the number of columns for the xterm terminal type:
tput -Txterm cols
Define shell variable restart to reset
terminal characteristics:
restart=`tput reset`
|
tr | tr [options] [string1 [string2]]
Copy standard input to standard output, performing
substitution of characters from string1 to string2
or deletion of characters in string1.
System V requires that string1 and
string2 be enclosed in square brackets.
BSD versions do not have this requirement.
Options- -c
- Complement characters in string1 with characters in the
current character set.
The complement is the set of all characters not in string1.
- -d
- Delete characters in string1 from output.
- -s
- Squeeze out repeated output characters in string2.
ExamplesChange uppercase to lowercase in a file:
tr '[A-Z]' '[a-z]' < file
Solaris allows the use of character classes:
tr '[:upper:]' '[:lower:]' < file
Turn spaces into newlines (ASCII code 012):
tr ' ' '\012' < file
Strip blank lines from file and save in new.file
(or use \011 to change successive tabs into one tab):
tr -s "" "\012" < file > new.file
Delete colons from file; save result in new.file:
tr -d : < file > new.file
Make long search path more readable:
echo $PATH | tr ':' '\n'
|
troff | troff [options] [files]
Document formatter for laser printer or typesetter.
See Chapter 12.
|
true | true
A do-nothing command that returns a successful (zero) exit status.
Normally used in Bourne shell scripts. See also false.
|
truss | truss [options] arguments
Trace system calls, signals, and machine faults while executing arguments.
arguments is either a Unix command to run or,
if -p is specified,
a list of process IDs representing
the already running processes to trace.
The options
-m,
-r,
-s,
-t,
-v,
-w,
and
-x
accept a comma-separated list of
arguments. A ! reverses the sense of the list, telling truss
to ignore those elements of the list during the trace. (In the C shell,
use a backslash before !.)
The keyword all can include/exclude all
possible elements for the list.
The optional ! and
corresponding description are shown in brackets.
The Solaris truss also provides tracing of user-level
function calls in dynamically loaded shared libraries.
This command is particularly useful for finding missing files
when a third-party application fails.
By watching the access and open
system calls, you can find where, and which, files the application
program expected to find, but did not.
Many systems have similar programs named trace
or strace.
These programs are worth learning how to use.
Options- -a
- Display parameters passed by each exec(2) call.
- -c
- Count the traced items and print a summary rather than listing them
as they happen.
- -d
- Print a timestamp in the output,
of the form seconds.fraction,
indicating the time relative to the start of the trace.
Times are when the system call completes, not starts.
Solaris only.
- -D
- Print a delta timestamp in the output,
of the form seconds.fraction,
indicating the time between events (i.e., the time not
inside system calls).
Solaris only.
- -e
- Display values of environment variables passed by each exec(2) call.
- -f
- Follow child processes. Useful for tracing shell scripts.
- -i
- List sleeping system calls only once, upon completion.
- -m[!]faults
- Trace [exclude from trace] the list of machine
faults. faults are names or numbers, as listed in
<sys/fault.h> (default is -mall -m!fltpage).
- -M[!]faults
- When the traced process receives one of the named faults,
truss leaves the process in a stopped state and
detaches from it
(default is -M!all).
The process can subsequently be attached to with a debugger, or with
another invocation of truss using different options.
Solaris only.
- -l
- Show the lightweight process ID for a multithreaded process.
Solaris only.
- -o outfile
- Send trace output to outfile, not standard error.
- -p
- Trace one or more running processes instead of a command.
- -r[!]file_descriptors
- Display [don't display] the full I/O buffer of read system calls for
file_descriptors (default is -r!all).
- -s[!]signals
- Trace [exclude from trace] the list of signals.
signals are names or numbers, as listed in
<sys/signal.h> (default is -sall).
- -S[!]signals
- When the traced process receives one of the named signals,
truss leaves the process in a stopped state and
detaches from it (see -M)
(default is -S!all).
Solaris only.
- -t[!]system_calls
-
Trace [exclude from trace] the list of system_calls.
system_calls are names or numbers, as listed in Section
2, “System Calls,” of the UNIX
Programmer's Reference Manual (see Bibliography);
default is -tall.
- -T[!]system_calls
- When the traced process executes one of the named system calls,
truss leaves the process in a stopped state and
detaches from it (see -M)
(default is -T!all).
Solaris only.
- -u[!]lib,...:[:][!]func,...
- Trace user-level function calls, not just system calls.
lib is a comma-separated list of dynamic library
names, without the .so.n suffix.
func is a comma-separated list of names.
Shell wildcard syntax may be used to specify many names.
(Such use should be quoted to protect it from expansion by the shell.)
The leading ! indicates libraries and/or functions
to exclude.
With :, only calls into the library from outside it
are traced; with ::, all calls are traced.
Solaris only.
- -U[!]lib,...:[:][!]func,...
- When the traced process executes one of the named user-level functions,
truss leaves the process in a stopped state and
detaches from it (see -M).
Solaris only.
- -v[!]system_calls
- Verbose mode. Same as -t, but also list the contents of any structures
passed to system_calls (default is -v!all).
- -w[!]file_descriptors
- Display [don't display] the full I/O buffer of write system calls for
file_descriptors (default is -w!all).
- -x[!]system_calls
- Same as -t, but display the system call arguments as raw code
(hexadecimal) (default is -x!all).
ExamplesTrace system calls access,
open, and close for the lp command:
truss -t access,open,close lp files > truss.out
Trace the make command, including its child processes, and store
the output in make.trace:
truss -f -o make.trace make target
|
tset | /usr/ucb/tset [options] [type]
Set terminal modes. Without arguments, the terminal is reinitialized
according to the TERM environment variable.
tset is typically used in startup scripts
(.profile or .login).
type is the terminal type; if preceded by a ?,
tset prompts the user to enter a different type, if needed.
Press the Return key to use the default value, type.
See also reset.
Options- -
- Print terminal name on standard output;
useful for passing this value to TERM.
- -ec
- Set erase character to c; default is ^H (backspace).
- -ic
- Set interrupt character to c (default is ^C).
- -I
- Do not output terminal initialization setting.
- -k c
- Set line-kill character to c (default is ^U).
- -m[port[baudrate]:type]
- Declare terminal specifications.
port is the port type (usually dialup or plugboard).
tty is the terminal type; it can be preceded by ? as above.
baudrate checks the port speed
and can be preceded by any of these characters:
> | Port must be greater than baudrate.
|
< | Port must be less than baudrate.
|
@ | Port must transmit at baudrate.
|
! | Negate a subsequent >, <,
or @ character.
|
? | Prompt for the terminal type.
With no response, use the given type.
|
- -n
- Initialize “new” tty driver modes.
Useless because of redundancy
with the default stty settings
in SVR4
that incorporate the functionality of the BSD “new”
tty driver.
- -Q
- Do not print “Erase set to” and “Kill set to” messages.
- -r
- Report the terminal type.
- -s
- Return the values of TERM assignments to
shell environment. This is a commonly done via
eval \‘tset -s\‘ (in the C shell, you would
surround this with the commands
set noglob and unset noglob).
ExamplesSet TERM to wy50:
eval `tset -s wy50`
Prompt user for terminal type (default is vt100):
eval `tset -Qs -m '?vt100'`
Similar to above, but the baudrate must exceed 1200:
eval `tset -Qs -m '>1200:?xterm'`
Set terminal via modem.
If not on a dial-in line,
the ?$TERM
causes tset to prompt with the value of
$TERM as the default terminal type:
eval `tset -s -m dialup:'?vt100' "?$TERM"`
|
tty | tty [options]
Print the device name of your terminal.
This is useful for shell scripts and often for
commands that need device information.
Options- -l
- Print the synchronous line number, if on an active synchronous line.
- -s
- Return only the codes: 0 (a terminal), 1 (not a terminal),
2 (invalid options used).
|
type | type program ...
Print a description of program, i.e., whether it is
a shell built in, a function, or an external command.
type is built-in to the Bourne and Korn shells.
See Chapter 4 and also see which.
ExampleDescribe cd and ls:
$ type cd ls
cd is a shell builtin
ls is /usr/bin/ls
|
umask | umask [value]
Print the current value of the file creation mode mask, or
set it to value, a three-digit octal code specifying
the read-write-execute permissions to be turned off. This
is the opposite of chmod.
Normally used in .login or .profile.
umask is a built-in command in the Bourne,
Korn, and C shells
(see Chapter 4 and Chapter 5).
umask
Number | File
Permission | Directory Permission |
0 | rw- | rwx |
1 | rw- | rw- |
2 | r-- | r-x |
3 | r-- | r-- |
4 | -w- | -wx |
5 | -w- | -w- |
6 | --- | --x |
7 | --- | --- |
ExamplesTurn off write permission for others:
umask 002 Produces file permission -rw-rw-r--
Turn off all permissions for group and others:
umask 077 Produces file permission -rw-------
Note that you can omit leading zeroes.
|
uname | uname [options]
Print the current Unix system name.
Options- -a
- Report the information supplied by all the other options.
- -i
- The hardware platform name.
(For example, i86pc; compare to i386
from -p.)
Solaris only.
- -m
- The hardware name.
- -n
- The node name.
- -p
- The host's processor type.
- -r
- The operating system release.
- -s
- The system name.
This is the default action when no options are provided.
- -v
- The operating system version.
- -S name
- Change the nodename to name.
Privileged users only.
Solaris only.
- -X
- Print expanded information as expected by SCO Unix systems.
Solaris only.
|
uncompress | uncompress [option] [files]
Restore the original file compressed by compress.
The .Z extension is implied, so it can be omitted when
specifying files.
The -f and -v options
from compress are also allowed.
See compress for more information.
Option- -c
- Same as zcat
(write to standard output without changing files).
|
unexpand | unexpand [options] [files]
Convert spaces back into an appropriate number of tab characters.
unexpand reads the named files,
or standard input if no files are provided.
See also expand.
Options- -a
- Replace spaces with tabs everywhere possible, not just
leading spaces and tabs.
- -t tablist
- Interpret tabs according to tablist, a space- or
comma-separated list of numbers in ascending order
that describe
the “tabstops” for the input data.
|
unget | /usr/ccs/bin/unget [options] files
An SCCS command. See Chapter 18.
|
uniq | uniq [options] [file1 [file2]]
Remove duplicate adjacent lines from sorted file1,
sending one copy of each line to file2 (or to standard output).
Often used as a filter. Specify only one of
-c, -d, or -u. See also comm
and sort.
Options- -c
- Print each line once, counting instances of each.
- -d
- Print duplicate lines once, but no unique lines.
- -f n
- Ignore first n fields of a line.
Fields are separated by spaces or by tabs.
Solaris only.
- -s n
- Ignore first n characters of a field.
Solaris only.
- -u
- Print only unique lines (no copy of duplicate entries is kept).
- -n
- Ignore first n fields of a line.
Fields are separated by spaces or by tabs.
- +n
- Ignore first n characters of a field.
ExamplesSend one copy of each line from list
to output file list.new
(list must be sorted):
uniq list list.new
Show which names appear more than once:
sort names | uniq -d
Show which lines appear exactly three times:
sort names | uniq -c | awk '$1 == 3'
|
units | units
Interactively supply a formula to convert a number from one unit to another.
/usr/lib/units
(Solaris: /usr/share/lib/unittab)
gives a complete
list of the units.
Use EOF to exit.
|
unix2dos | unix2dos [options] unixfile dosfile
Solaris only.
Convert files using
the ISO standard characters to their
DOS counterparts.
If unixfile and dosfile
are the same, the file is overwritten after the conversion is done.
See also dos2unix.
Options- -ascii
- Add extra carriage returns
for use under DOS.
- -iso
- Same as the default action.
- -7
- Convert 8-bit Solaris characters to 7-bit DOS characters.
|
unzip | unzip [options[modifiers]] zipfile ... [extraction options] unzip -Z [zipinfo options] zipfile ...
Solaris only.
(Many other modern Unix systems also have it.)
unzip prints information about or extracts files from
ZIP format archives.
The zipfile is a ZIP archive whose filename ends
in .zip.
The .zip can be omitted from the command line;
unzip supplies it.
zipfile may also be a shell-style wildcard pattern
(which should be quoted);
all matching files in the ZIP archive will be acted upon.
The behavior of options is affected by
the various modifiers.
In the second form, the options are taken to be
zipinfo options, and unzip
performs like that command.
See zipinfo for more information.
Options may also be included in the UNZIP environment variable,
to set a default behavior.
Options on the command line can override settings in $UNZIP
by preceding them with an extra minus.
See the Examples.
When extracting files, if a file exists already, unzip
prompts for an action.
You may to choose to overwrite or skip the existing file, overwrite or skip all files,
or rename the current file.
Notes
unzip and its companion program zip
(which is not included with Solaris)
are part of the InfoZIP project.
InfoZIP is an open collaborative compressed
archive format, and implementations exist for Unix,
Amiga,
Atari,
DEC VAX and Alpha VMS and OpenVMS,
MS-DOS,
Macintosh,
Minix,
OS/2,
Windows NT,
and many others.
It is the only similar
format one can expect to port to all
of these systems without difficulty.
The web home page is
http://www.cdrom.com/pub/infozip.
Unlike most Unix tar implementations,
zip removes leading
slashes when it creates a ZIP archive, so there is
never any problem unbundling it at another site.
The Java Archive format (.jar) is based on ZIP;
zip and unzip can process .jar
files with no trouble.
Extraction Options- -d dir
- Extract files in dir instead of in the current directory.
This option need not appear at the end of the command line.
- -x files
- Exclude. Do not extract archive members that match files.
Options- -A
- Print help for the shared library programming interface (API).
- -c
- Print files to standard
output (the CRT).
Similar to -p, but a header line is printed for each file,
it allows -a,
and automatically does ASCII to EBCDIC conversion.
Not in the unzip usage message.
- -f
- Freshen existing files.
Only files in the archive that are newer than existing disk files are extracted.
unzip queries before overwriting, unless -o
is used.
- -l
- List archived files, in short format (name, full size, modification time, and totals).
- -p
- Extract files to standard output (for piping).
Only the file data is printed.
No conversions are done.
- -t
- Test the archived files.
Each file is extracted in memory, and the extracted
file's CRC is compared to the stored CRC.
- -T
- Set the timestamp on the archive itself to be that of the newest file
in the archive.
- -u
- Same as -f, but also extract any files that don't
exist on disk yet.
- -v
- Be verbose or print diagnostic information.
-v is both an option and a modifier, depending upon the
other options.
By itself, it prints the unzip
ftp site
information, information
about how it was compiled, and what environment variable settings are in effect.
With a zipfile, it adds compression information to that
provided by -l.
- -z
- Only print the archive comment.
- -Z
- Run as zipinfo.
Remaining options are zipinfo options.
See zipinfo for more information.
Modifiers- -a[a]
- Convert text files.
Normally, files are extracted as binary files.
This option causes text files to be converted to the native format
(e.g., adding or removing CR characters in front of LF characters).
EBCDIC-to-ASCII conversion is also done as needed.
Use -aa to force all files to be extracted as text.
- -b
- Treat all files as binary.
- -B
- Save a backup copy of each overwritten file in file~.
Only available if compiled with UNIXBACKUP defined.
- -C
- Ignore case when matching filenames.
Useful on non-Unix systems where filesystems are not case-sensitive.
- -j
- “Junk” paths.
Extract all files in the current extraction directory, instead of
reproducing the directory tree structure stored in the archive.
- -L
- Convert filenames to lowercase from archives created on uppercase-only
systems.
By default, filenames are extracted exactly as stored in the archive.
- -M
- Pipe output through the internal pager, which is similar to more.
Press the Return key or spacebar at the --More-- prompt to see the
next screenful.
- -n
- Never overwrite existing files.
If a file already exists, don't extract it, just continue on
without prompting.
Normally, unzip prompts for an action.
- -o
- Overwrite existing files without prompting.
Often used together with -f.
Use with care.
ExamplesList the contents of a ZIP archive:
unzip -lv whizprog.zip
Extract C source files in the main directory,
but not in subdirectories:
unzip whizprog.zip '*.[ch]' -x '*/*'
|
uptime | uptime
Print the current time, amount of time the system
has been up, number of users logged in,
and the system-load averages. This output is also produced
by the first line of the w command.
|
users | /usr/ucb/users [file]
Display the currently logged-in users as a space-separated list.
Same as who -q.
Information is read from a system file
(default is /var/adm/utmp).
|
uudecode | uudecode [-p] [file]
Read a uuencoded file and recreate the original
file with the same mode and name (see uuencode).
Solaris provides the -p option,
which decodes the file to standard output.
This allows you to use uudecode in a pipeline.
|
uuencode | uuencode [file] name | mail remoteuser
Convert a binary file to a form which can be sent
to remoteuser
via mail.
The encoding uses only printing ASCII characters and includes
the mode and name of the file.
When file is reconverted via uudecode
on the remote system, output is sent to name.
(Therefore, when saving the encoded mail message to a file
on the remote system, don't store it in a file called name,
or you'll overwrite it!)
Note that uuencode can take standard
input, so a single argument is the name given to
the file when it is decoded.
The Solaris version does local character set translation
of the encoded characters.
Note: the uuencode format does not provide any
kind of checksumming or other data integrity checking.
It is advisable to first package files into an archive that does
provide checksumming of the data
(such as a .zip file), and then uuencode
the archive for sending in electronic mail.
|
vacation | vacation vacation [options] [user]
Automatically return a mail message to the sender announcing that you are on
vacation.
Solaris version, for use with sendmail.
(The SVR4 version is described in Appendix B.)
Use vacation with no options to initialize the
vacation mechanism. The process performs several steps.
Create a .forward file in your home
directory.
The .forward file contains:
\user, "|/usr/bin/vacation user"
user is your login name.
The action of this file is to actually deliver the
mail to user (i.e., you),
and to run the incoming mail through vacation.
Create the .vacation.pag
and .vacation.dir files.
These files keep track of who has sent you messages, so that they
only receive one “I'm on vacation” message
from you per week.
Start an editor to edit the contents of .vacation.msg.
The contents of this file are mailed back to whoever sends you mail.
Within its body, $SUBJECT is replaced with the contents
of the incoming message's Subject: line.
Remove or rename the .forward file to
disable vacation processing.
OptionsThe
-a,
-j,
and
-t
options are used within a .forward file;
see the Example.
- -a alias
- Mail addressed to alias is actually mail for
the user and should produce an automatic reply.
- -I
- Reinitialize the .vacation.pag
and .vacation.dir files.
Use this right before leaving for your next vacation.
- -j
- Do not verify that user appears in the
To: or Cc: headers.
- -t interval
- By default, no more than one message per week is sent to any sender.
This option changes that interval.
interval is a number with a trailing
s,
m,
h,
d,
or
w
indicating seconds, minutes, hours, days, or weeks, respectively.
ExampleSend no more than one reply every three weeks to any given sender:
$ cd
$ vacation -I
$ cat .forward
\jp, "|/usr/bin/vacation -t3w jp"
$ cat .vacation.msg
From: [email protected] (J. Programmer, via the vacation program)
Subject: I'm out of the office ...
Hi. I'm off on a well-deserved vacation after finishing
up whizprog 1.0. I will read and reply to your mail
regarding "$SUBJECT" when I return.
Have a nice day.
|
val | /usr/ccs/bin/val [options] file ...
An SCCS command. See Chapter 18.
|
vedit | vedit [options] [files]
Same as running vi,
but with the showmode and novice flags set,
the report flag set to 1, and magic turned off
(metacharacters have no special meaning). Intended for beginners.
|
vgrind | vgrind [options] files
Solaris only (from the BSD command).
Produce nicely formatted source code listings for use with
troff. vgrind formats
program source code so that it looks good when typeset with
troff. Comments are in italic, keywords in
bold, and each function's name is printed in the margin of the
page where it is defined. Definitions for each language are kept in
/usr/lib/vgrindefs. vgrind can format
a number of languages; see -l below.
vgrind has two modes of operation:
- Filter mode
- Similar to eqn, pic, and tbl.
Lines are passed through unchanged, except for those bracketed by .vS
and .vE.
In this mode, vgrind can be used in a pipeline with
other preprocessors.
- Regular mode
- vgrind processes all files named on the command line and
then invokes troff to print them.
Use – as a filename to mean the standard input.
Otherwise, vgrind will not read standard input.
OptionsSpacing between option characters and option arguments is specific.
Use the options exactly as shown here:
- -2
- Produce two-column output.
Implies -s8 and
the -L (landscape) option
for $TROFF.
(This option was specific to troff at UCB.)
- -d definitions
- Use definitions as the file with language
definitions, instead of the default file.
- -f
- Run in filter mode.
- -h header
- Place header in the top center of every output page.
- -llang
- Supported languages are:
Bourne shell | -lsh |
C | -lc |
C++ | -lc++ |
C shell | -lcsh |
emacs MLisp | -lml |
FORTRAN | -lf |
Icon | -lI |
ISP | -li |
LDL | -lLDL |
Model | -lm |
Modula-2 | -lm2 |
Pascal | -lp |
RATFOR | -lr |
Russel | -lrussell |
YACC | -lyacc |
The default is -lc (for C).
- -n
- Do not use bold for keywords.
- -ssize
- Use point size size
(same as troff's .ps request).
- -w
- Use a tab stop of four columns, instead of the default eight.
- -x
- Print the index.
If a file named index exists in the current directory,
vgrind writes the index into it.
This file can then be formatted and printed separately using
vgrind -x index.
Typesetter OptionsThe following options are passed to the program named by $TROFF,
or to troff if that environment variable is not set:
- -olist
- Output only the pages in list;
same as -o in troff.
- -Pprinter
- Send the output to printer.
- -t
- Same as -t for troff;
send formatted text to standard output.
- -Tdevice
- Format output for device.
- -W
- Use the wide Versatec printer instead of the narrow Varian.
(These refer to printers that existed at one time at the University of
California at Berkeley.
This option likely has no real effect under Solaris.)
|
vi | vi [options] [files]
A screen-oriented text editor based on ex.
See Chapter 8 and Chapter 9 for
more information on vi and ex.
Options
-c,
-C,
-L,
-r,
-R,
and
-t are the same as in ex.
Options- -c command
- Enter vi and execute the given vi command.
- -l
- Run in LISP mode for editing LISP programs.
- -L
- List filenames that were saved due to an editor or system crash.
- -r file
- Recover and edit file after an editor or system crash.
- -R
- Read-only mode. Files can't be changed.
- -S
- Use with -t to indicate that the
tag file may not be sorted and to use
a linear search.
Solaris only.
- -t tag
- Edit the file containing tag, and position the editor at its
definition (see ctags for more information).
- -wn
- Set default window size to n; useful when editing via
a slow dial-up line.
- -x
- Supply a key to encrypt or decrypt file using crypt.
(Note that the supplied key is visible to other users via
the ps command.)
- -C
- Same as -x, but assume file began in encrypted form.
- +
- Start vi on last line of file.
- +n
- Start vi on line n of file.
- +/pat
- Start vi on line containing pattern pat. This option fails if
nowrapscan is set in your .exrc file.
|
view | view [options] [files]
Same as vi -R.
|
volcheck | volcheck [options] [pathnames]
Solaris only.
Check one or more devices named by pathnames to see if
removable media has been inserted.
The default is to check every device being managed by volume management.
Most often used with floppies; volume management usually notices
when CD-ROMs have been inserted.
Note: use of the -i and -t
options, particularly with short intervals,
is not recommended for floppy-disk drives.
Options- -i nsec
- Check the device(s) every nsec seconds.
The default is every two seconds.
- -t nsecs
- Keep checking over the next nsecs seconds.
Maximum nsecs is 28,800 (eight hours).
- -v
- Be verbose.
|
w | w [options] [user]
Print summaries of system usage, currently logged-in users, and what
they are doing. w is essentially a combination of
uptime, who, and ps -a.
Display output for
one user by specifying user.
Options- -h
- Suppress headings and uptime information.
- -l
- Display in long format (the default).
- -s
- Display in short format.
- -u
- Print just the heading line.
Equivalent to uptime.
Solaris only.
- -w
- Same as -1. Solaris only.
|
wait | wait [n]
Wait for all background processes to complete and report their
termination status. Used in shell scripts. If n is specified,
wait only for the process with process ID n.
wait is a built-in command in the Bourne,
Korn, and C shells.
See Chapter 4 and Chapter 5 for more information.
|
wc | wc [options] [files]
Word count.
Print a character, word, and line count for files.
If multiple files, print totals as well.
If no files are given, read standard input.
See other examples under ls
and sort.
Options- -c
- Print byte count only.
- -C
- Print character count only.
This will be different than -c in
a multibyte character environment.
Solaris only.
- -l
- Print line count only.
- -m
- Same as -C.
Solaris only.
- -w
- Print word count only.
ExamplesCount the number of users logged in:
who | wc -l
Count the words in three essay files:
wc -w essay.[123]
Count lines in file
named by $file (don't display filename):
wc -l < $file
|
what | /usr/ccs/bin/what [option] files
An SCCS command. See Chapter 18.
|
whatis | whatis commands
Look up one or more commands in the online manpages,
and display a brief description.
Same as man -f.
The MANPATH environment variable can affect the results
obtained with this command.
See also apropos.
|
which | which [commands]
List which files are executed if the named commands
are run as a command.
which reads the user's
.cshrc file
(using the source built-in command),
checking aliases and searching
the path variable.
Users of the Bourne or Korn shells can use the built-in type
command as an alternative.
(See type, Chapter 4 and Chapter 5.)
Example$ which file ls
/usr/bin/file
ls: aliased to ls -sFC
|
who | who [options] [file]
Display information about the current status of the system.
With no options,
list the names of users currently logged in to the system.
An optional system file (default is /var/adm/utmp)
can be supplied to give additional information.
who is usually invoked without options, but useful options
include am i and -u.
For more examples,
see cut,
line,
paste, tee, and wc
Options- -a
- Use the
-b,
-d,
-l,
-p,
-r,
-t,
-T,
and
-u
options.
- -b
- Report information about the last reboot.
- -d
- Report expired processes.
- -H
- Print headings.
- -l
- Report inactive terminal lines.
- -m
- Report only about the current terminal.
Solaris only.
- -n x
- Display x users per line (works only with -q).
- -p
- Report previously spawned processes.
- -q
- “Quick.” Display only the usernames.
- -r
- Report the run level.
- -s
- List the name, line, and time fields
(the default behavior).
- -t
- Report the last change of the system clock (via date).
- -T
- Report whether terminals are writable (+),
not writable (-),
or unknown (?).
- -u
- Report terminal usage (idle time). A dot (.) means less than
one minute idle; old means more than 24 hours idle.
- am i
- Print the username of the invoking user.
(Similar to results from id.)
ExampleThis sample output was produced at 8 a.m. on April 17:
$ who -uH
NAME LINE TIME IDLE PID COMMENTS
martha ttyp3 Apr 16 08:14 16:25 2240
george ttyp0 Apr 17 07:33 . 15182
Since martha has been idle since yesterday afternoon
(16 hours), it appears that Martha isn't at work yet. She
simply left herself logged in. George's terminal is currently
in use. (He likes to beat the traffic.)
|
whoami | /usr/ucb/whoami
Print the username based on effective user ID.
This is usually the same as the standard SVR4 command logname.
However, when you're running an su session as another
user, whoami displays this user's name, but
logname still displays your name.
|
xargs | xargs [options] [command]
Execute command (with any initial arguments), but read remaining
arguments from standard input
instead of specifying them directly. xargs passes these arguments
in several bundles to command, allowing command
to process more arguments than it could normally handle at once.
The arguments are typically a long list of filenames
(generated by ls or find, for example)
that get passed to xargs via
a pipe.
Without a command, xargs behaves
similarly to echo, simply bundling the input lines into
output lines and printing them to standard output.
Options- -e[string]
- Stop passing arguments when argument string is encountered
(default is underscore).
An omitted string disables the logical EOF
capability.
- -E string
- Use string instead of underscore as the default
logical EOF string.
Solaris only.
- -i[string]
- Pass arguments to command, replacing
instances of {} on the command line with the current line of input.
With Solaris, the optional string can be used
instead of {}.
- -I string
- Same as -i, but string
is used instead of {}.
- -l[n]
- Execute command for n lines of arguments.
With Solaris, default n is 1
when -l is supplied.
- -L n
- Same as -l n.
Solaris only.
- -nn
- Execute command with up to n arguments.
- -p
- Prompt for a y to confirm each execution of command.
Implies -t.
- -sn
- Each argument list can contain up to n characters.
(Older systems limited n to 470.
The default is system-dependent.)
- -t
- Echo each command before executing.
- -x
- Exit if argument list exceeds n characters (from -s);
-x takes effect automatically with -i and -l.
Examplesgrep for pattern in all files on the system:
find / -print | xargs grep pattern > out &
Run diff on file pairs
(e.g., f1.a and f1.b, f2.a and f2.b ...):
echo $* | xargs -n2 diff
The previous line could be invoked as a shell script, specifying filenames
as arguments.
Display file, one word per line
(similar to deroff -w):
cat file | xargs -n1
Move files in olddir to newdir, showing each command:
ls olddir | xargs -i -t mv olddir/{} newdir/{}
|
xgettext | xgettext [options] files xgettext -h
Solaris only.
Extract messages (specially marked strings) from C and C++ source files.
Place them in a “portable object” file (file.po)
for translation and compilation by msgfmt.
By default, xgettext only extracts strings inside calls to the
gettext(3C) and dgettext(3C) functions.
Source files are named on the command line.
A filename of – indicates the standard input.
Options- -a
- Extract all strings, not just those in calls to gettext
or dgettext.
- -c tag
- Copy source file comments marked with tag
into the .po file as #-delimited comments.
- -d domain
- Use domain.po as the output file
instead of messages.po.
- -h
- Print a help message on the standard output.
- -j
- Join (merge) extracted messages with those in the current .po file.
Domain directives in the existing .po file are ignored.
- -m prefix
- Fill each msgstr with prefix.
Intended for debugging.
- -M suffix
- Fill each msgstr with suffix.
Intended for debugging.
- -n
- Add comments to the .po file indicating the
source filename and line number where each string is used.
- -p path
- Place output files in the directory path.
- -s
- Sort the output by msgid (original string),
with all duplicates removed.
- -x exfile
- exfile is a .po file with
msgid s that are not to be extracted (i.e., excluded).
|
yacc | /usr/ccs/bin/yacc [options] file
Given a file containing a context-free LALR(1) grammar,
convert it to tables for subsequent parsing
and send output to y.tab.c. This command name stands for
yet
another
compiler-compiler.
See also lex and lex & yacc, which is listed
in the Bibliography.
Options- -b prefix
- Use prefix instead of y for
the generated filenames.
Solaris only.
- -d
- Generate y.tab.h, producing #define statements
that relate yacc's token codes to the token names
declared by the user.
- -l
- Exclude #line constructs from code produced in y.tab.c.
(Use after debugging is complete.)
- -p prefix
- Use prefix instead of yy
for all external names in the generated parser.
Solaris only.
- -P parser
- Use parser instead of
/usr/ccs/bin/yaccpar.
Solaris only.
- -Qc
- Place version information about yacc in y.tab.c
(if c = y)
or suppress information (if c = n, the default).
- -t
- Compile runtime debugging code by default.
- -v
- Generate y.output, a file containing
diagnostics and notes about the parsing tables.
- -V
- Print the version of yacc on standard error.
|
zcat | zcat [files]
Uncompress one or more .Z files to the standard output,
leaving files unchanged. See compress.
|
zip | zip [options] zipfile [files]
Archive files in InfoZIP format.
These files can be retrieved using unzip.
The files are compressed as they are added to the archive.
Compression ratios of 2:1 to 3:1 are common for text files.
zip may also replace files in an
existing archive.
With no arguments, display the help information.
See also zipinfo
and unzip.
Default options may be placed in the ZIPOPT environment variable,
with the exceptions of -i and -x.
Multiple options may be included in ZIPOPT.
While zip is not distributed with SVR4 or Solaris,
source code is readily available from
http://www.cdrom.com/pub/infozip.
There are a number of important notes
in the unzip entry.
Go there for more information.
Options
- -b path
- Use path as the location to store the temporary
ZIP archive while updating an existing one.
When done, copy the temporary archive over the new one.
Useful primarily when there is not enough disk space on the filesystem containing the original archive.
- -c
- Add one-line comments for each file.
zip first performs any file operations and then
prompts you for a comment describing each file.
- -d
- Delete entries from a ZIP archive.
Filenames to be deleted must be entered in uppercase if the archive
was created by PKZIP on an MS-DOS system.
- -D
- Don't create entries in the archive for directories.
Usually entries are created, so that attributes for directories
may be restored upon extraction.
- -e
- Encrypt the archive.
zip prompts on the terminal for a password and
prompts twice, to avoid typing errors.
If standard error is not a terminal, zip
exits with an error.
- -f
- Freshen (replace) an existing entry in the ZIP archive if the file
has a more recent modification time than the one in the archive.
This doesn't add files that are not already in the archive: use
-u for that.
Run this command from the same directory where the ZIP
archive was created, since the archive stores relative path names.
- -F, -FF
- Fix the ZIP archive.
This option should be used with care; make a backup copy of the archive first.
The -FF version does not trust the compressed sizes
in the archive, and instead scans it for special “signatures”
that identify the boundaries of different archive members.
See the manpage for more information.
- -g
- Grow the archive (append files to it).
- -h
- Display the zip help information.
- -i files
- Include only the specified files, typically specified as
a quoted shell wildcard-style pattern.
- -j
- “Junk” the path; i.e., store just the name of the saved file, not any directory names.
The default is to store complete paths, although paths are always relative.
- -J
- Strip any prepended data (e.g., an SFX stub, for
self-extracting executables) from the archive.
- -k
- Create an archive that (attempts to) conform to the conventions used
under MS-DOS.
This makes it easier for PKUNZIP
to extract the archive.
- -l
- For text files only, translate the Unix newline into a CR-LF pair.
Primarily for archives extracted under MS-DOS.
- -ll
- For text files only, translate the MS-DOS CR-LF into a Unix newline.
- -L
- Display the zip license.
- -m
- “Move” the files into the ZIP archive.
This actually deletes the original files and/or directories
after the archive has been created successfully.
This is somewhat dangerous; use -T in
conjunction with this option.
- -n suffixlist
- Do not compress files with suffixes in suffixlist.
Useful for sound or image files that often have their own, specialized
compression method.
- -o
- Set the modified time of the ZIP archive to be that of the youngest file
(most recently modified)
in the archive.
- -q
- Quiet mode. Don't print informational messages and comment prompts.
Most useful in shell scripts.
- -r
- Recursively archive all files
and subdirectories of the named files.
The -i option is also useful in combination with this one.
- -t mmddyy
- Ignore files modified prior to the date given by mmddyy.
- -T
- Test the new ZIP archive's integrity.
If the test fails, an existing ZIP archive is not changed, and
with -m, no files are removed.
- -u
- Update existing entries in the ZIP archive if the named files
have modification dates that are newer than those in the archive.
Similar to -f, except that this option adds
files to the archive if they aren't already there.
- -v
- As the only argument, print help and version information, a pointer to
the home and distribution Internet sites, and information about how
zip was compiled.
When used with other options, cause those options to print progress
information and provide other diagnostic information.
- -x files
- Exclude the specified files, typically specified as
a quoted shell wildcard-style pattern.
- -X
- Do not save extra file attributes
(extended attributes on OS/2, user ID/group ID, and file times on Unix).
- -y
- Preserve symbolic links in the ZIP archive,
instead of archiving the file the link points to.
- -z
- Prompt for a (possibly multiline) comment describing the entire ZIP archive.
End the comment with line containing just a period, or EOF.
- -n
- Specify compression speed: n is a digit between
0 and 9. 0 indicates no compression, 1 indicates fast but minimal compression,
9 indicates slowest but maximal compression.
Default is -6.
- -@
- Read standard input for names of files to be archived.
Filenames containing spaces must be quoted using single quotes.
ExamplesArchive the current directory into source.zip,
including only C source files:
zip source -i '*.[ch]'
Archive the current directory into source.zip,
excluding the object files:
zip source -x '*.o'
Archive files in the current directory into source.zip,
but don't compress .tiff and .snd
files:
zip source -z '.tiff:.snd' *
Recursively archive the entire directory tree into one archive:
zip -r /tmp/dist.zip .
|
zipinfo | zipinfo [options] zipfile ... [exclusion option]
Solaris only.
zipinfo prints information about
ZIP format archives.
The zipfile is a ZIP archive whose filename ends
in .zip.
The .zip can be omitted from the command line;
zipinfo supplies it.
zipfile may also be a shell-style wildcard pattern
(which should be quoted to protect it from the shell);
all matching files in the ZIP archive will be acted upon.
See also zip
and unzip.
Exclusion Option- -x files
- Exclude. Do not extract archive members that match files.
Options- -1
- Only list filenames, one per line.
Nothing else is printed.
For use in shell scripts.
- -2
- Like -1, but also permit headers, trailers, and ZIP
archive comments (-h, -t,
-z).
- -h
- Print a header line with the archive name, size in bytes, and total number of files.
- -l
- Use “long” format.
Like -m, but also print the compressed size in
bytes, instead of the compression ratio.
- -m
- Use “Medium” format.
Like -s, but also include the compression factor
(as a percentage).
- -M
- Pipe output through the internal pager, which is similar to more.
Press the Return key or spacebar at the --More-- prompt to see the
next screenful.
- -s
- Use “short” format, similar to ls -l.
This is the default.
- -t
- Print totals for all files
(number of files, compressed and uncompressed sizes, overall compression factor).
- -T
- Print times and dates in a decimal format
(yymmdd.hhmmss)
that can be sorted.
- -v
- Use verbose, multipage format.
- -z
- Print the archive comment.
|