Solaris Users Commands
Solaris Users Commands
Commands
This product or document is protected by copyright and distributed under licenses restricting its use, copying, distribution, and decompilation. No
part of this product or document may be reproduced in any form by any means without prior written authorization of Sun and its licensors, if any.
Third-party software, including font technology, is copyrighted and licensed from Sun suppliers.
Parts of the product may be derived from Berkeley BSD systems, licensed from the University of California. UNIX is a registered trademark in the U.S.
and other countries, exclusively licensed through X/Open Company, Ltd.
Sun, Sun Microsystems, the Sun logo, docs.sun.com, AnswerBook, AnswerBook2, and Solaris are trademarks, registered trademarks, or service marks
of Sun Microsystems, Inc. in the U.S. and other countries. All SPARC trademarks are used under license and are trademarks or registered trademarks
of SPARC International, Inc. in the U.S. and other countries. Products bearing SPARC trademarks are based upon an architecture developed by Sun
Microsystems, Inc.
The OPEN LOOK and Sun™ Graphical User Interface was developed by Sun Microsystems, Inc. for its users and licensees. Sun acknowledges the
pioneering efforts of Xerox in researching and developing the concept of visual or graphical user interfaces for the computer industry. Sun holds a
non-exclusive license from Xerox to the Xerox Graphical User Interface, which license also covers Sun’s licensees who implement OPEN LOOK GUIs
and otherwise comply with Sun’s written license agreements.
U.S. Government Rights – Commercial software. Government users are subject to the Sun Microsystems, Inc. standard license agreement and
applicable provisions of the FAR and its supplements.
DOCUMENTATION IS PROVIDED “AS IS” AND ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES,
INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE
DISCLAIMED, EXCEPT TO THE EXTENT THAT SUCH DISCLAIMERS ARE HELD TO BE LEGALLY INVALID.
Copyright 2004 Sun Microsystems, Inc. 4150 Network Circle, Santa Clara, CA 95054 U.S.A. Tous droits réservés.
Ce produit ou document est protégé par un copyright et distribué avec des licences qui en restreignent l’utilisation, la copie, la distribution, et la
décompilation. Aucune partie de ce produit ou document ne peut être reproduite sous aucune forme, par quelque moyen que ce soit, sans
l’autorisation préalable et écrite de Sun et de ses bailleurs de licence, s’il y en a. Le logiciel détenu par des tiers, et qui comprend la technologie relative
aux polices de caractères, est protégé par un copyright et licencié par des fournisseurs de Sun.
Des parties de ce produit pourront être dérivées du système Berkeley BSD licenciés par l’Université de Californie. UNIX est une marque déposée aux
Etats-Unis et dans d’autres pays et licenciée exclusivement par X/Open Company, Ltd.
Sun, Sun Microsystems, le logo Sun, docs.sun.com, AnswerBook, AnswerBook2, et Solaris sont des marques de fabrique ou des marques déposées, ou
marques de service, de Sun Microsystems, Inc. aux Etats-Unis et dans d’autres pays. Toutes les marques SPARC sont utilisées sous licence et sont des
marques de fabrique ou des marques déposées de SPARC International, Inc. aux Etats-Unis et dans d’autres pays. Les produits portant les marques
SPARC sont basés sur une architecture développée par Sun Microsystems, Inc.
L’interface d’utilisation graphique OPEN LOOK et Sun™ a été développée par Sun Microsystems, Inc. pour ses utilisateurs et licenciés. Sun reconnaît
les efforts de pionniers de Xerox pour la recherche et le développement du concept des interfaces d’utilisation visuelle ou graphique pour l’industrie
de l’informatique. Sun détient une licence non exclusive de Xerox sur l’interface d’utilisation graphique Xerox, cette licence couvrant également les
licenciés de Sun qui mettent en place l’interface d’utilisation graphique OPEN LOOK et qui en outre se conforment aux licences écrites de Sun.
CETTE PUBLICATION EST FOURNIE “EN L’ETAT” ET AUCUNE GARANTIE, EXPRESSE OU IMPLICITE, N’EST ACCORDEE, Y COMPRIS DES
GARANTIES CONCERNANT LA VALEUR MARCHANDE, L’APTITUDE DE LA PUBLICATION A REPONDRE A UNE UTILISATION
PARTICULIERE, OU LE FAIT QU’ELLE NE SOIT PAS CONTREFAISANTE DE PRODUIT DE TIERS. CE DENI DE GARANTIE NE
S’APPLIQUERAIT PAS, DANS LA MESURE OU IL SERAIT TENU JURIDIQUEMENT NUL ET NON AVENU.
040116@7518
Contents
Preface 19
Introduction 25
Intro(1) 26
User Commands 29
acctcom(1) 30
adb(1) 33
addbib(1) 34
alias(1) 36
allocate(1) 39
amt(1) 41
answerbook2(1) 42
appcert(1) 43
apptrace(1) 50
apropos(1) 55
ar(1) 57
arch(1) 61
as(1) 62
asa(1) 66
at(1) 68
atq(1) 75
atrm(1) 76
audioconvert(1) 77
audioplay(1) 81
3
audiorecord(1) 83
auths(1) 86
awk(1) 88
banner(1) 93
basename(1) 94
basename(1B) 96
bc(1) 97
bdiff(1) 101
bfs(1) 102
biff(1B) 106
break(1) 107
cal(1) 109
calendar(1) 110
cancel(1) 112
cat(1) 114
cc(1B) 117
cd(1) 119
cdrw(1) 122
checknr(1) 128
chgrp(1) 129
chkey(1) 131
chmod(1) 133
chown(1) 139
chown(1B) 141
ckdate(1) 142
ckgid(1) 145
ckint(1) 147
ckitem(1) 149
ckkeywd(1) 152
ckpath(1) 154
ckrange(1) 157
ckstr(1) 160
cksum(1) 163
cktime(1) 165
ckuid(1) 167
ckyorn(1) 169
clear(1) 171
cmp(1) 172
Contents 5
echo(1) 311
echo(1B) 315
echo(1F) 316
ed(1) 317
edit(1) 329
egrep(1) 333
eject(1) 336
elfdump(1) 340
enable(1) 342
env(1) 344
eqn(1) 346
error(1) 351
ex(1) 355
exec(1) 365
exit(1) 367
expand(1) 369
exportfs(1B) 371
expr(1) 372
expr(1B) 375
exstr(1) 378
face(1) 382
factor(1) 383
fastboot(1B) 384
fdformat(1) 385
fgrep(1) 390
file(1) 392
file(1B) 394
filesync(1) 396
find(1) 403
finger(1) 410
fmlcut(1F) 413
fmlexpr(1F) 415
fmlgrep(1F) 418
fmli(1) 420
fmt(1) 423
fmtmsg(1) 424
fnattr(1) 429
fnbind(1) 432
Contents 7
indxbib(1) 550
install(1B) 551
ipcrm(1) 553
ipcs(1) 554
isainfo(1) 558
isalist(1) 560
jobs(1) 561
join(1) 568
kbd(1) 571
kdestroy(1) 574
keylogin(1) 575
keylogout(1) 577
kill(1) 578
kinit(1) 582
klist(1) 587
kpasswd(1) 589
ksh(1) 590
ktutil(1) 641
last(1) 643
lastcomm(1) 645
ld(1) 647
ld(1B) 659
ldap(1) 660
ldapdelete(1) 664
ldaplist(1) 667
ldapmodify(1) 671
ldapmodrdn(1) 675
ldapsearch(1) 678
ldd(1) 683
ld.so.1(1) 688
let(1) 695
lex(1) 696
limit(1) 708
line(1) 713
lint(1B) 714
list_devices(1) 716
listusers(1) 718
llc2_autoconfig(1) 719
Contents 9
mdb(1) 879
mesg(1) 920
message(1F) 921
mixerctl(1) 923
mkdir(1) 925
mkmsgs(1) 927
mkstr(1B) 929
more(1) 931
mp(1) 938
mpss.so.1(1) 946
msgfmt(1) 949
mt(1) 955
mv(1) 958
nawk(1) 961
nca(1) 982
ncab2clf(1) 984
ncakmod(1) 986
netscape(1) 987
newform(1) 992
newgrp(1) 995
news(1) 997
newtask(1) 998
nice(1) 1001
nis+(1) 1003
niscat(1) 1018
nischgrp(1) 1021
nischmod(1) 1023
nischown(1) 1026
nischttl(1) 1028
nisdefaults(1) 1030
niserror(1) 1033
nisgrpadm(1) 1034
nisln(1) 1038
nisls(1) 1040
nismatch(1) 1042
nismkdir(1) 1045
nisopaccess(1) 1048
nispasswd(1) 1051
Contents 11
postreverse(1) 1181
posttek(1) 1183
ppgsz(1) 1185
pr(1) 1188
praliases(1) 1193
prctl(1) 1194
preap(1) 1197
prex(1) 1199
print(1) 1211
printenv(1B) 1212
printf(1) 1213
priocntl(1) 1218
proc(1) 1229
prof(1) 1232
profiles(1) 1236
projects(1) 1238
ps(1) 1239
ps(1B) 1248
pvs(1) 1251
pwd(1) 1254
ranlib(1) 1255
rcapstat(1) 1256
rcp(1) 1260
rdist(1) 1262
read(1) 1267
readfile(1F) 1270
readonly(1) 1271
refer(1) 1272
regcmp(1) 1274
regex(1F) 1276
reinit(1F) 1278
renice(1) 1279
reset(1F) 1282
rlogin(1) 1283
rm(1) 1286
rmformat(1) 1290
roffbib(1) 1297
roles(1) 1299
Contents 13
sh(1) 1406
shell(1F) 1424
shell_builtins(1) 1425
shift(1) 1429
shutdown(1B) 1430
size(1) 1431
sleep(1) 1433
smart2cfg(1) 1435
soelim(1) 1437
solregis(1) 1438
sort(1) 1441
sortbib(1) 1448
sotruss(1) 1450
spell(1) 1452
spline(1) 1455
split(1) 1456
srchtxt(1) 1458
ssh(1) 1461
ssh-add(1) 1471
ssh-agent(1) 1473
ssh-http-proxy-connect(1) 1475
ssh-keygen(1) 1477
ssh-socks5-proxy-connect(1) 1480
strchg(1) 1482
strings(1) 1485
strip(1) 1487
stty(1) 1489
stty(1B) 1497
sum(1) 1504
sum(1B) 1505
suspend(1) 1506
symorder(1) 1507
sysV-make(1) 1508
tabs(1) 1515
tail(1) 1519
talk(1) 1522
tar(1) 1525
tbl(1) 1536
Contents 15
uucp(1C) 1648
uuencode(1C) 1652
uuglist(1C) 1655
uustat(1C) 1656
uuto(1C) 1660
uux(1C) 1663
vacation(1) 1667
vc(1) 1670
vgrind(1) 1674
vi(1) 1678
vipw(1B) 1688
volcancel(1) 1689
volcheck(1) 1690
volmissing(1) 1692
volrmmount(1) 1693
vsig(1F) 1695
w(1) 1696
wait(1) 1698
wc(1) 1701
what(1) 1703
whatis(1) 1705
whereis(1B) 1706
which(1) 1708
who(1) 1709
whoami(1B) 1712
whocalls(1) 1713
whois(1) 1714
write(1) 1715
xargs(1) 1718
xgettext(1) 1723
xstr(1) 1725
yacc(1) 1727
yes(1) 1731
ypcat(1) 1732
ypmatch(1) 1733
yppasswd(1) 1734
ypwhich(1) 1735
Contents 17
18 man pages section 1: User Commands • April 2004
Preface
Both novice users and those familar with the SunOS operating system can use online
man pages to obtain information about the system and its features. A man page is
intended to answer concisely the question “What does it do?” The man pages in
general comprise a reference manual. They are not intended to be a tutorial.
Overview
The following contains a brief description of each man page section and the
information it references:
■ Section 1 describes, in alphabetical order, commands available with the operating
system.
■ Section 1M describes, in alphabetical order, commands that are used chiefly for
system maintenance and administration purposes.
■ Section 2 describes all of the system calls. Most of these calls have one or more
error returns. An error condition is indicated by an otherwise impossible returned
value.
■ Section 3 describes functions found in various libraries, other than those functions
that directly invoke UNIX system primitives, which are described in Section 2.
■ Section 4 outlines the formats of various files. The C structure declarations for the
file formats are given where applicable.
■ Section 5 contains miscellaneous documentation such as character-set tables.
■ Section 6 contains available games and demos.
■ Section 7 describes various special files that refer to specific hardware peripherals
and device drivers. STREAMS software drivers, modules and the
STREAMS-generic set of system calls are also described.
19
■ Section 9 provides reference information needed to write device drivers in the
kernel environment. It describes two device driver interface specifications: the
Device Driver Interface (DDI) and the Driver⁄Kernel Interface (DKI).
■ Section 9E describes the DDI/DKI, DDI-only, and DKI-only entry-point routines a
developer can include in a device driver.
■ Section 9F describes the kernel functions available for use by device drivers.
■ Section 9S describes the data structures used by drivers to share information
between the driver and the kernel.
Below is a generic format for man pages. The man pages of each manual section
generally follow this order, but include only needed headings. For example, if there
are no bugs to report, there is no BUGS section. See the intro pages for more
information and detail about each section, and man(1) for more information about man
pages in general.
NAME This section gives the names of the commands or
functions documented, followed by a brief
description of what they do.
SYNOPSIS This section shows the syntax of commands or
functions. When a command or file does not exist
in the standard path, its full path name is shown.
Options and arguments are alphabetized, with
single letter arguments first, and options with
arguments next, unless a different argument order
is required.
Preface 21
one condition can cause the same error, each
condition is described in a separate paragraph
under the error code.
USAGE This section lists special rules, features, and
commands that require in-depth explanations. The
subsections listed here are used to explain built-in
functionality:
Commands
Modifiers
Variables
Expressions
Input Grammar
EXAMPLES This section provides examples of usage or of how
to use a command or function. Wherever possible a
complete example including command-line entry
and machine response is shown. Whenever an
example is given, the prompt is shown as
example%, or if the user must be superuser,
example#. Examples are followed by explanations,
variable substitution rules, or returned values. Most
examples illustrate concepts from the SYNOPSIS,
DESCRIPTION, OPTIONS, and USAGE sections.
ENVIRONMENT VARIABLES This section lists any environment variables that
the command or function affects, followed by a
brief description of the effect.
EXIT STATUS This section lists the values the command returns to
the calling program or shell and the conditions that
cause these values to be returned. Usually, zero is
returned for successful completion, and values
other than zero for various error conditions.
FILES This section lists all file names referred to by the
man page, files of interest, and files created or
required by commands. Each is followed by a
descriptive summary or explanation.
ATTRIBUTES This section lists characteristics of commands,
utilities, and device drivers by defining the
attribute type and its corresponding value. See
attributes(5) for more information.
SEE ALSO This section lists references to other man pages,
in-house documentation, and outside publications.
Preface 23
24 man pages section 1: User Commands • April 2004
Introduction
25
Intro(1)
NAME Intro – introduction to commands and application programs
DESCRIPTION This section describes, in alphabetical order, commands available with this operating
system.
OTHER See these sections of the man pages section 1M: System Administration Commands for
SECTIONS more information.
■ Section 1M in this manual for system maintenance commands.
■ Section 4 of this manual for information on file formats.
■ Section 5 of this manual for descriptions of publicly available files and
miscellaneous information pages.
■ Section 6 in this manual for computer demonstrations.
Manual Page Unless otherwise noted, commands described in the SYNOPSIS section of a manual
Command Syntax page accept options and other arguments according to the following syntax and
should be interpreted as explained below.
Command Syntax These command syntax rules are not followed by all current commands, but all new
Standard: Rules commands will obey them. getopts(1) should be used by all shell procedures to
parse positional parameters and to check for legal options. It supports Rules 3-10
below. The enforcement of the other rules must be done by the command itself.
1. Command names (name above) must be between two and nine characters long.
2. Command names must include only lower-case letters and digits.
3. Option names (option above) must be one character long.
4. All options must be preceded by “−”.
5. Options with no arguments may be grouped after a single “−”.
6. The first option-argument (optarg above) following an option must be preceded by
a tab or space character.
7. Option-arguments cannot be optional.
8. Groups of option-arguments following an option must either be separated by
commas or separated by tab or space character and quoted (−o xxx,z,yy or − o
"xxx z yy").
9. All options must precede operands (cmdarg above) on the command line.
10. “− −” may be used to indicate the end of the options.
11. The order of the options relative to one another should not matter.
12. The relative order of the operands (cmdarg above) may affect their significance in
ways determined by the command with which they appear.
13. “−” preceded and followed by a space character should only be used to mean
standard input.
ATTRIBUTES See attributes(5) for a discussion of the attributes listed in this section.
DIAGNOSTICS Upon termination, each command returns two bytes of status, one supplied by the
system and giving the cause for termination, and (in the case of “normal” termination)
one supplied by the program [see wait(3UCB) and exit(2)]. The former byte is 0 for
normal termination; the latter is customarily 0 for successful execution and non-zero
to indicate troubles such as erroneous parameters, or bad or inaccessible data. It is
called variously “exit code”, “exit status”, or “return code”, and is described only
where special conventions are involved.
Introduction 27
Intro(1)
WARNINGS Some commands produce unexpected results when processing files containing null
characters. These commands often treat text input lines as strings and therefore
become confused upon encountering a null character (the string terminator) within a
line.
29
acctcom(1)
NAME acctcom – search and print process accounting files
SYNOPSIS acctcom [-abfhikmqrtv] [-C sec] [-e time] [-E time] [-g group]
[-H factor] [-I chars] [-l line] [-n pattern] [-o output-file] [-O sec]
[-s time] [-S time] [-u user] [filename…]
DESCRIPTION The acctcom utility reads filenames, the standard input, or /var/adm/pacct, in the
form described by acct(3HEAD) and writes selected records to standard output. Each
record represents the execution of one process. The output shows the COMMAND NAME,
USER, TTYNAME, START TIME, END TIME, REAL (SEC), CPU (SEC), MEAN SIZE
(K), and optionally, F (the fork()/exec() flag: 1 for fork() without exec()),
STAT (the system exit status), HOG FACTOR, KCORE MIN, CPU FACTOR, CHARS
TRNSFD, and BLOCKS READ (total blocks read and written).
A ‘#’ is prepended to the command name if the command was executed with
super-user privileges. If a process is not associated with a known terminal, a ‘?’ is
printed in the TTYNAME field.
If any filename arguments are given, they are read in their respective order. Each file is
normally read forward, that is, in chronological order by process completion time. The
file /var/adm/pacct is usually the current file to be examined; a busy system may
need several such files of which all but the current file are found in
/var/adm/pacctincr.
Availability SUNWaccu
User Commands 31
acctcom(1)
CSI enabled
NOTES acctcom reports only on processes that have terminated; use ps(1) for active
processes.
DESCRIPTION The adb utility is an interactive, general-purpose debugger. It can be used to examine
files and provides a controlled environment for the execution of programs.
The adb utility is now implemented as a link to the mdb(1) utility in Solaris 9. mdb(1)
is a low-level debugging utility that can be used to examine user processes as well as
the live operating system or operating system crash dumps. The new mdb(1) utility
provides complete backwards compatibility with the existing syntax and features of
adb, including support for processing adb macro files. The Solaris Modular Debugger
Guide and mdb(1) man page describes the features of mdb, including its adb
compatibility mode. This mode will be activated by default when the adb link is
executed.
SUNWmdbx (64-bit)
User Commands 33
addbib(1)
NAME addbib – create or extend a bibliographic database
SYNOPSIS addbib [-a] [-p promptfile] database
DESCRIPTION When addbib starts up, answering y to the initial Instructions? prompt yields
directions. Typing n (or RETURN) skips the directions. addbib then prompts for
various bibliographic fields, reads responses from the terminal, and sends output
records to database. A null response (just RETURN) means to leave out that field. A ‘−’
(minus sign) means to go back to the previous field. A trailing backslash allows a field
to be continued on the next line. The repeating Continue? prompt allows the user
either to resume by typing y (or RETURN), to quit the current session by typing n or
q, or to edit database with any system editor (see vi(1), ex(1), ed(1)).
USAGE
Bibliography Key The most common key-letters and their meanings are given below. addbib insulates
Letters you from these key-letters, since it gives you prompts in English, but if you edit the
bibliography file later on, you will need to know this information.
%A Author’s name
%B Book containing article referenced
%C City (place of publication)
%D Date of publication
%E Editor of book containing article referenced
%F Footnote number or label (supplied by refer)
%G Government order number
%H Header commentary, printed before reference
%I Issuer (publisher)
%J Journal containing article
%K Keywords to use in locating reference
%L Label field used by -k option of refer
%M Bell Labs Memorandum (undefined)
%N Number within volume
%O Other commentary, printed at end of reference
Except for A, each field should be given just once. Only relevant fields should be
supplied.
%A Mark Twain
%T Life on the Mississippi
%I Penguin Books
%C New York
%D 1978
Availability SUNWdoc
SEE ALSO ed(1), ex(1), indxbib(1), lookbib(1), refer(1), roffbib(1), sortbib(1), vi(1),
attributes(5)
User Commands 35
alias(1)
NAME alias, unalias – create or remove a pseudonym or shorthand for a command or series
of commands
SYNOPSIS /usr/bin/alias [alias-name [= string…]]
/usr/bin/unalias alias-name…
/usr/bin/unalias -a
csh alias [name [def]]
unalias pattern
ksh alias [-tx] [name [= value]…]
unalias name…
DESCRIPTION The alias and unalias utilities create or remove a pseudonym or shorthand term
for a command or series of commands, with different functionality in the C-shell and
Korn shell environments.
/usr/bin/alias The alias utility creates or redefines alias definitions or writes the values of existing
alias definitions to standard output. An alias definition provides a string value that
replaces a command name when it is encountered.
An alias definition affects the current shell execution environment and the execution
environments of the subshells of the current shell. When used as specified by this
document, the alias definition will not affect the parent process of the current shell nor
any utility environment invoked by the shell.
/usr/bin/unalias The unalias utility removes the definition for each alias name specified. The aliases
are removed from the current shell execution environment.
csh alias assigns def to the alias name. def is a list of words that may contain escaped
history-substitution metasyntax. name is not allowed to be alias or unalias. If def is
omitted, the alias name is displayed along with its current definition. If both name and
def are omitted, all aliases are displayed.
unalias discards aliases that match (filename substitution) pattern. All aliases may be
removed by ‘unalias *’.
ksh alias with no arguments prints the list of aliases in the form name=value on standard
output. An alias is defined for each name whose value is given. A trailing space in
value causes the next word to be checked for alias substitution. The -t flag is used to
set and list tracked aliases. The value of a tracked alias is the full pathname
corresponding to the given name. The value becomes undefined when the value of
PATH is reset but the aliases remained tracked. Without the -t flag, for each name in
The aliases given by the list of names may be removed from the alias list with
unalias.
If no operands are given, all alias definitions will be written to standard output.
OUTPUT The format for displaying aliases (when no operands or only name operands are
specified) is:
The value string will be written with appropriate quoting so that it is suitable for
reinput to the shell.
This example specifies that the output of the ls utility is columnated and more
annotated:
example% alias ls="ls −CF"
This example creates a simple “redo” command to repeat previous entries in the
command history file:
example% alias r=’fc −s’
This example provides that the du utility summarize disk output in units of 1024
bytes:
User Commands 37
alias(1)
EXAMPLE 3 Specifying a command’s output options (Continued)
This example sets up the nohup utility so that it can deal with an argument that is
itself an alias name:
example% alias nohup="nohup "
ENVIRONMENT See environ(5) for descriptions of the following environment variables that affect the
VARIABLES execution of alias and unalias: LANG, LC_ALL, LC_CTYPE, LC_MESSAGES, and
NLSPATH.
Availability SUNWcsu
DESCRIPTION The allocate utility manages the ownership of devices through its allocation
mechanism. It ensures that each device is used by only one qualified user at a time.
The device argument specifies the device to be manipulated. To preserve the integrity
of the device’s owner, the allocate operation is executed on all the device special files
associated with that device.
The argument dev−type is the device type to be operated on and can only be used with
the -g option.
The default allocate operation allocates the device special files associated with device to
the uid of the current process.
If the -F option is specified, the device cleaning program is executed when allocation
is performed. This cleaning program is found in /etc/security/lib. The name of
this program is found in the device_allocate(4) entry for the device in the dev−exec
field.
Only authorized users may allocate a device. The required authorizations are specified
in device_allocate(4).
FILES /etc/security/device_allocate
/etc/security/device_maps
User Commands 39
allocate(1)
/etc/security/dev/*
/etc/security/lib/*
Availability SUNWcsu
NOTES The functionality described in this man page is available only if the Basic Security
Module (BSM) has been enabled. See bsmconv(1M) for more information.
DESCRIPTION The amt command is for use in a Common Criteria security certified system. The
command is used to verify that the low level functions necessary to enforce the object
reuse requirements of the Controlled Access Protection Profile are working correctly.
/usr/bin/amt is a shell script that executes tests specific to your system. For a 32–bit
system, the tests run as a 32–bit application. For a 64–bit system, the tests run twice;
once as a 32–bit application and once as a 64–bit application.
amt lists test results with a "pass" or "fail" for each test it performs, unless output is
suppressed with the -s option.
User Commands 41
answerbook2(1)
NAME answerbook2 – online documentation system
SYNOPSIS /usr/dt/bin/answerbook2 [-h]
DESCRIPTION The AnswerBook2 server product is no longer included with Solaris or the Solaris
Documentation CD products. Solaris docmentation is now provided in HTML and
PDF format on the Documentation CD and does not require the AnswerBook2 server
to be viewed.
The answerbook2 utility opens the default web browser and displays an HTML page
that shows a link to locally installed documentation, and, if the AnswerBook2 server
has been defined, a link to AnswerBook2 collections.
This functionality is also accessible through the AnswerBook2 option on the CDE front
panel Help menu.
If you need an AnswerBook2 server, you can download the AnswerBook2 server
software from http://www.sun.com.
Availability http://www.sun.com
NOTES Use the online Help system to find out more about the AnswerBook2 product, once
the web browser is opened and the AnswerBook2 library can be viewed.
DESCRIPTION The appcert utility examines an application’s conformance to the Solaris Application
Binary Interface (ABI). The Solaris ABI defines the runtime library interfaces in Solaris
that are safe and stable for application use. More specifically, appcert identifies any
dependencies on unstable runtime interfaces, as well as certain other risks that could
cause the product to fail to work on a subsequent release of Solaris.
An entire product can be readily examined by appcert (that is, if the product is a
collection of many programs and supporting shared objects) by referring appcert to
the directories where the product is installed.
To perform its task, appcert constructs a profile of interface dependencies for each
object file within the product (whether an executable object or shared object), to
determine all the Solaris system interfaces that are depended upon. (Notice that
appcert uses the Solaris runtime linker to make this determination.) These
dependency profiles are then compared to a definition of the Solaris ABI to identify
any interfaces that are Private (unsafe and unstable for application-level use).
appcert generates a simple roll-up report that indicates which of the product’s
components, if any, had liabilities and what those liabilities were. The report aids
developers who are examining their product’s release-to-release stability.
Notice that appcert produces complete interface dependency information, both the
Public (safe and stable) Solaris interfaces and the Private (non-ABI) interfaces. This
information can also be examined for each product component, if you want.
IMPORTANT: appcert must run in the same environment in which the application
being checked runs. See NOTES.
User Commands 43
appcert(1)
OPTIONS The following options are supported:
-B If appcert is run in "batch" mode, the output report will contain
one line per binary, beginning with PASS if no problems were
detected for the binary, FAIL if any problems were found, or INC
if the binary could not be completely checked. Do not interpret
these labels too literally. For example, PASS just means that none
of the appcert warnings were triggered. These strings are flush
left and so can be selected via grep ^FAIL ..., and so forth.
-f infile Specifies the file infile that contains a list of files (one per line) to
check. This list is appended to the list determined from the
command line operands (see OPERANDS below).
-h Prints out the usage information.
-L appcert examines your product for the presence of shared
objects. If it finds some, it appends the directories they reside in to
LD_LIBRARY_PATH. Use this flag to prevent appcert from doing
this.
-n When searching directories for binaries to check, this option does
not follow symbolic links. See find(1).
-S Appends Solaris library directories (that is,
/usr/openwin/lib:/usr/dt/lib) to LD_LIBRARY_PATH.
-w working_dir Identifies the directory in which to run the library components and
create temporary files (default is /tmp).
LIMITATIONS If the object file to be examined depends on libraries, those dependencies must be
recorded in it (by using the compiler’s -l switch).
If the object file to be examined depends on other shared libraries, those libraries must
be accessible via LD_LIBRARY_PATH or RPATH when appcert is run.
These are skipped. Shared objects without execute permission are not skipped.
■ Object files that are setuid root.
Due to limitations in ldd(1), these are skipped. Copy and/or change the
permissions to check them.
■ Non-ELF file executables such as shell scripts.
■ Non-C language interfaces to Solaris; for example, C++ and Java.
The code itself need not be in C as long as the calls to Solaris libaries are in C.
OUTPUT FILES appcert records its findings in the following files in the working directory
(/tmp/appcert.????? by default):
Index A mapping between checked binaries and the subdirectory in the
working directory in which the output specific to that binary can
be found.
Report A copy of the rollup report that was displayed on stdout when
appcert was run.
Skipped A list of binaries that appcert was asked to check but had to skip,
along with a brief reason why each was skipped.
User Commands 45
appcert(1)
check.dynamic.unbound A list of symbols not bound by the dynamic linker
when ldd -r was run. For convenience, ldd output
lines containing "file not found" are also included.
summary.dynamic A pretty-printed summary of dynamic bindings for the
objects examined, including tables of Public and
Private symbols used from each Solaris library.
OUTPUT
MESSAGES
Private Symbol Private symbols are functions or data variables in a Solaris library that are not
Use intended for developer or external use. These symbols are interfaces that the Solaris
libraries use to call and communicate with one another. They are marked in pvs(1)
output with the symbol version name "SUNWprivate".
Private symbols can change their semantic behavior or even disappear altogether
("demoted" or "deprecated" symbols), so your application should not depend upon
any of them.
Demoted Symbols Demoted symbols are functions or data variables in a Solaris library that were once
private to that library and have been removed (or possibly scoped local to the library)
in a later Solaris release. If your application directly calls one of these demoted
symbols, it will fail to run (relocation error) on the release in which the symbol was
removed and releases thereafter.
In some rare cases, a demoted symbol will return in a later release, but nevertheless
there are still some releases on which the application will not run.
Sun Microsystems Inc. performed most of the library scoping in the transition from
Solaris 2.5.1 to 2.6. This action was done to increase binary stability. By making these
completely internal interfaces invisible (that is, they cannot be dynamically linked
against), a developer cannot accidentally or intentionally call these interfaces. For
more information, see the Linker and Libraries Guide, in particular the chapter on
versioning. This document may be found online at http://docs.sun.com.
Unbound Symbols Unbound symbols are library symbols (that is, functions or data) referenced by the
application that the dynamic linker could not resolve when appcert was run. Note:
appcert does not actually run your application, so some aspect of the environment
that affects dynamic linking might not be set properly.
Unbound symbols might be due to LD_LIBRARY_PATH not being correctly set. Make
sure it is set, so that all of your binary objects can find all of the libraries they depend
on (either your product’s own libraries, Solaris libraries, or those of a third party).
Then re-run appcert.
Another common cause for unbound symbols is when a shared object under test has
not recorded its dynamic dependencies, that is, at build time the -l switch was not
supplied to the compiler and ld(1). So the shared object requires that the executables
that link against it have the correct dependencies recorded.
Notice that such a shared object can either be linked in the standard way (that is,
specified at an executable’s build time) or dynamically opened (for example, an
executable calls dlopen(3DL) on the shared object sometimes when running). Either
case can give rise to unbound symbols when appcert is run. The former can usually
be resolved by setting LD_LIBRARY_PATH appropriately before running appcert.
The latter (dlopen) is usually difficult to resolve. Under some circumstances, you
might be able to set LD_PRELOAD appropriately to preload the needed libraries, but
this procedure does not always work.
How do you know if the environment has been set up correctly so that there will be no
unbound symbols? It must be set up so that running ldd -r on the binary yields no
“file not found” or “symbol not found” errors. See ld.so.1(1) and ldd(1) for
more information on dynamic linking.
In any event, appcert flags unbound symbols as a warning in case they might
indicate a more serious problem. Unbound symbols can be an indicator of
dependencies on demoted symbols (symbols that have been removed from a library or
scoped local to it). Dependencies on demoted symbols will lead to serious binary
stability problems.
No Bindings appcert runs /bin/ldd -r on each binary object to be tested. It sets the
Found environment variable LD_DEBUG=“files,bindings”. (See ldd(1) and ld.so.1(1)
for more information). If that command fails for some reason, appcert will have no
dynamic symbol binding information and will find “no bindings”.
User Commands 47
appcert(1)
■ The binary object has no library dependency information recorded.
Other cases exist as well (for example, out of memory). In general, this flag means that
appcert could not completely examine the object due to permissions or environment.
Try to modify the permissions or environment so that the dynamic bindings can be
recorded.
Obsolete Library An obsolete library is one whose use is deprecated and that might, in some future
release, be removed from Solaris altogether. appcert flags these because applications
depending on them might not run in future releases of Solaris. All interfaces,
including Private ones, in an obsolete library are frozen and will not change.
Use of Direct use of the symbols sys_errlist or sys_nerr presents a risk in which
sys_errlist/sys_nerr reference might be made past the end of the sys_errlist array. These symbols are
deprecated in 32-bit versions of Solaris and are absent altogether in 64-bit versions.
Use strerror(3C) instead.
Use of Strong vs. The “strong” symbols (for example, _socket) associated with “weak” symbols (for
Weak Symbols example, socket ) are reserved as private (their behavior could change in the future).
Your application should only directly reference the weak symbol (usually the strong
symbols begin with “_”).
Note: Under certain build environments, the strong/private symbol dependency gets
recorded into your binary instead of the weak/public one, even though the source
code doesn’t appear to reference the private symbol. Nevertheless, steps should be
taken to trace down why this is occurring and fix the dependency.
NOTES appcert needs to run in the same environment in which the application being
checked runs. Otherwise it might not be able to resolve references correctly to
interfaces in the Solaris libraries. Take the following steps:
1. Make sure that LD_LIBRARY_PATH and any other aspects of the environment are
set to whatever settings are used when the application is run. Also make sure that
it contains the directories containing any non-Solaris shared objects that are part of
the product, so that they can be found when referenced.
2. Make sure that all the binaries to be checked:
■ Are dynamically linked ELF objects
■ Have execute permission set on executables (this is not necessary for shared
objects)
■ Are not SUID root (otherwise you will have to be root to check them; make
non-SUID copies and check those if necessary).
You might find it useful to write a shell script that sets up the environment correctly
and then runs appcert.
BUGS The use of the terms “public” and “private” as equivalent to “stable” and
“unstable” is unfortunately somewhat confusing. In particular, experimental or
evolving interfaces are public in the sense that they are documented and their use is
encouraged. But they are unstable, because an application built with them might not
run on subsequent releases. Thus, they are classified as private for appcert’s
purposes until they are no longer evolving. Conversely, obsolete interfaces will
eventually disappear, and so are unstable, even though they have been public and
stable in the past and are still treated as public by appcert. Fortunately, these two
situations are rare.
Availability SUNWapct
SEE ALSO cc(1), find(1), isalist(1), ld(1), ldd(1), ld.so.1(1), pvs(1), dlopen(3DL),
strerror(3C), intro(4), attributes(5)
User Commands 49
apptrace(1)
NAME apptrace – trace application function calls to Solaris shared libraries
SYNOPSIS apptrace [-f] [-F [!] tracefromlist] [-T [!] tracetolist] [-o outputfile]
[ [-tv] [!] call ,…] command [command arguments]
DESCRIPTION The apptrace utility runs the executable program specified by command and traces
all calls that the program command makes to the Solaris shared libraries. Tracing means
that for each call the program makes, apptrace reports the name of the library
interface called, the values of the arguments passed, and the return value.
By default, apptrace traces calls directly from the executable object to any of the
shared objects it depends on. Indirect calls (that is, calls made between shared objects
that the executable depends upon) are not reported by default.
Calls from or to additional shared objects may be traced using the -F or -T options
(see below).
The default reporting format is a single line per call, with no formatted printing of
arguments passed by reference or of data structures.
By default, every interface provided by a shared object is traced if called. However, the
set of interfaces to be traced can be restricted, using the -t and/or -v options.
Since it is generally possible to trace calls between any of the dynamic objects linked at
runtime (the executable object and any of the shared objects depended upon), the
report of each traced call gives the name of the object from which the call was made.
apptrace traces all of the procedure calls that occur between dynamic objects via the
procedure linkage table, so only those procedure calls which are bound via the table
will be traced. See the Linker and Libraries Guide.
User Commands 51
apptrace(1)
EXAMPLE 2 Tracing a specific set of interfaces with verbosity set (Continued)
41(opcom),14(sysadmin),211(test)
FILES Basic runtime support for apptrace is provided by the link auditing feature of the
Solaris runtime linker (ld.so.1(1)) and the apptrace command’s use of this facility
relies on an auditing object (apptrace.so.1) kept in /usr/lib/abi.
In order to perform formatted printing of arguments when tracing calls (as selected by
the -v option), apptrace needs to know the number and data types of the arguments
supplied to the called interface. Special runtime support shared objects are provided
which apptrace relies upon to perform formatted printing. A runtime support object
is provided for each Solaris shared library, which contains an "interceptor" function for
each interface within the shared library. These supporting shared objects are kept in
/usr/lib/abi. apptrace has a simple algorithm to map from the name of a library
interface to the name of an interceptor function in the library’s supporting
verbose-tracing shared object. If an interceptor is not found in the library’s supporting
tracing shared object, apptrace cannot determine either the number or data types of
the arguments for that interface. In this case, apptrace uses a default output format
for the call-tracing report (hex-formatted printing of the first three arguments).
LIMITATIONS In general, apptrace cannot trace calls to functions accepting variable argument lists.
There has been some clever coding in several specific cases to work around this
limitation, most notably in the printf and scanf families.
Functions that attempt to probe the stack or otherwise extract information about the
caller cannot be traced. Some examples are [gs]etcontext(), [sig]longjmp(),
[sig]setjmp(), and vfork().
Functions such as exit(2) that do not return may also produce strange output. Also,
functions that call other traced functions before returning will produce slightly
garbled output.
SUNWcstlx (64–bit)
User Commands 53
apptrace(1)
SEE ALSO ld.so.1(1), truss(1), vwprintw(3XCURSES), vwscanw(3XCURSES),
attributes(5), fnmatch(5)
DESCRIPTION The apropos utility displays the man page name, section number, and a short
description for each man page whose NAME line contains keyword. This information is
contained in the /usr/share/man/windex database created by catman(1M). If
catman(1M) was not run, or was run with the -n option, apropos fails. Each word is
considered separately and the case of letters is ignored. Words which are part of other
words are considered; for example, when looking for ‘compile’, apropos finds all
instances of ‘compiler’ also.
EXAMPLES EXAMPLE 1 To find a man page whose NAME line contains a keyword
Try
example% apropos password
and
example% apropos editor
Try
example% apropos format
and then
example% man -s 3s printf
Availability SUNWdoc
CSI Enabled
User Commands 55
apropos(1)
DIAGNOSTICS /usr/share/man/windex: No such file or directory
This database does not exist. catman(1M) must be run to create it.
DESCRIPTION The ar utility maintains groups of files combined into a single archive file. Its main
use is to create and update library files. However, it can be used for any similar
purpose. The magic string and the file headers used by ar consist of printable ASCII
characters. If an archive is composed of printable files, the entire archive is printable.
When ar creates an archive, it creates headers in a format that is portable across all
machines. The portable archive format and structure are described in detail in
ar(3HEAD). The archive symbol table (described in ar(3HEAD)) is used by the link
editor ld(1) to effect multiple passes over libraries of object files in an efficient manner.
An archive symbol table is only created and maintained by ar when there is at least
one object file in the archive. The archive symbol table is in a specially named file that
is always the first file in the archive. This file is never mentioned or accessible to the
user. Whenever the ar command is used to create or update the contents of such an
archive, the symbol table is rebuilt. The -s option described below will force the
symbol table to be rebuilt.
User Commands 57
ar(1)
-C Prevents extracted files from replacing like-named files in the file system.
This option is useful when -T is also used to prevent truncated file names
from replacing files with the same prefix.
-d Deletes one or more files from archive.
-i Positions new files in archive before the file named by the posname operand
(equivalent to -b).
-m Moves files. If -a, -b, or -i with the posname operand are specified, moves
files to the new position; otherwise, moves files to the end of archive.
-p Prints the contents of files in archive to standard output. If no files are
specified, the contents of all files in archive will be written in the order of
the archive.
-q Quickly appends files to the end of archive. Positioning options -a, -b, and
-i are invalid. The command does not check whether the added files are
already in archive. This option is useful to avoid quadratic behavior when
creating a large archive piece-by-piece.
-r Replaces or adds files in archive. If archive does not exist, a new archive file
will be created and a diagnostic message will be written to standard error
(unless the -c option is specified). If no files are specified and the archive
exists, the results are undefined. Files that replace existing files will not
change the order of the archive. If the -u option is used with the -r option,
then only those files with dates of modification later than the archive files
are replaced. If the -a, -b, or -i option is used, then the posname argument
must be present and specifies that new files are to be placed after (-a) or
before (-b or -i) posname; otherwise the new files are placed at the end.
-s Forces the regeneration of the archive symbol table even if ar is not
invoked with an option that will modify the archive contents. This
command is useful to restore the archive symbol table after the strip(1)
command has been used on the archive.
-t Prints a table of contents of archive. The files specified by the file operands
will be included in the written list. If no file operands are specified, all files
in archive will be included in the order of the archive.
-T Allows file name truncation of extracted files whose archive names are
longer than the file system can support. By default, extracting a file with a
name that is too long is an error; a diagnostic message will be written and
the file will not be extracted.
-u Updates older files. When used with the -r option, files within archive will
be replaced only if the corresponding file has a modification time that is at
least as new as the modification time of the file within archive.
-V Prints its version number on standard error.
/usr/ccs/bin/ar -v Gives verbose output. When used with the option characters -d, -r, or -x,
writes a detailed file-by-file description of the archive creation and the
ENVIRONMENT See environ(5) for descriptions of the following environment variables that affect the
VARIABLES execution of ar: LANG, LC_ALL, LC_CTYPE, LC_MESSAGES, LC_TIME, and NLSPATH.
TMPDIR Determine the pathname that overrides the default directory for
temporary files, if any.
TZ Determine the timezone used to calculate date and time strings
written by ar -tv. If TZ is unset or null, an unspecified default
timezone shall be used.
User Commands 59
ar(1)
/usr/ccs/bin/ar ATTRIBUTE TYPE ATTRIBUTE VALUE
Availability SUNWbtool
Availability SUNWxcu4
SEE ALSO basename(1), cc(1B), cpio(1), ld(1), lorder(1), strip(1), tar(1), ar(3HEAD),
a.out(4), attributes(5), environ(5), standards(5)
NOTES If the same file is mentioned twice in an argument list, it may be put in the archive
twice.
DESCRIPTION arch displays the application architecture of the current host system. Due to extensive
historical use of this command without any options, all SunOS 5.x SPARC based
systems will return "sun4" as their application architecture. Use of this command is
discouraged; see NOTES section below.
Systems can be broadly classified by their architectures, which define what executables
will run on which machines. A distinction can be made between kernel architecture
and application architecture (or, commonly, just “architecture”). Machines that run
different kernels due to underlying hardware differences may be able to run the same
application programs.
OPTIONS -k Display the kernel architecture, such as sun4m, sun4c, and so forth. This
defines which specific SunOS kernel will run on the machine, and has
implications only for programs that depend on the kernel explicitly (for
example, ps(1)).
Availability SUNWcsu
NOTES This command is provided for compatibility with previous releases and its use is
discouraged. Instead, the uname command is recommended. See uname(1) for usage
information.
User Commands 61
as(1)
NAME as – assembler
SYNOPSIS
Sparc as [-b] [-K PIC] [-L] [-m] [-n] [-o outfile] [-P] [-Dname] [-Dname=def]
[-Ipath] [-Uname…] [-q] [-Qy | n] [-s] [-S [a | b | c | l | A | B
| C | L]] [-T] [-V]
[-xarch=v7 | -xarch=v8 | -xarch=v8a | -xarch=v8plus | -xarch=v8plusa | -xarc
[-xF] filename…
x86 as [-b] [-K PIC] [-L] [-m] [-n] [-o outfile] [-P] [-Dname] [-Dname=def]
[-Ipath] [-Uname…] [-Qy | n] [-s] [-S [a | b | c | l | A | B | C
| L]] [-T] [-V] filename…
DESCRIPTION The as command creates object files from assembly language source files.
OPTIONS
Common Options The following flags are common to both SPARC and x86. They may be specified in any
order:
-b Generates extra symbol table information for the Sun
SourceBrowser.
-K PIC Generates position-independent code.
-L Saves all symbols, including temporary labels that are
normally discarded to save space, in the ELF symbol
table.
-m Runs the m4(1) macro processor on the input to the
assembler.
-n Suppresses all the warnings while assembling.
-o outfile Puts the output of the assembly in outfile. By default,
the output file name is formed by removing the .s
suffix, if there is one, from the input file name and
appending a .o suffix.
-P Runs cpp(1), the C preprocessor, on the files being
assembled. The preprocessor is run separately on each
input file, not on their concatenation. The preprocessor
output is passed to the assembler.
-Dname
-Dname=def When the -P option is in effect, these options are
passed to the cpp(1) preprocessor without
interpretation by the as command; otherwise, they are
ignored.
User Commands 63
as(1)
Options for -q Performs a quick assembly. When the -q option is
SPARC only used, many error checks are not performed. Note: This
option disables many error checks. Use of this option to
assemble handwritten assembly language is not
recommended.
-xarch=v7 This option instructs the assembler to accept
instructions defined in the SPARC version 7 (V7)
architecture. The resulting object code is in ELF format.
-xarch=v8 This option instructs the assembler to accept
instructions defined in the SPARC-V8 architecture, less
the quad-precision floating-point instructions. The
resulting object code is in ELF format.
-xarch=v8a This option instructs the assembler to accept
instructions defined in the SPARC-V8 architecture, less
the quad-precision floating-point instructions and less
the fsmuld instruction. The resulting object code is in
ELF format. This is the default choice of the
-xarch=options.
-xarch=v8plus This option instructs the assembler to accept
instructions defined in the SPARC-V9 architecture, less
the quad-precision floating-point instructions. The
resulting object code is in ELF format. It will not
execute on a Solaris V8 system (a machine with a V8
processor). It will execute on a Solaris V8+ system. This
combination is a SPARC 64–bit processor and a 32–bit
OS.
-xarch=v8plusa This option instructs the assembler to accept
instructions defined in the SPARC-V9 architecture, less
the quad-precision floating-point instructions, plus the
instructions in the Visual Instruction Set (VIS). The
resulting object code is in V8+ ELF format. It will not
execute on a Solaris V8 system (a machine with a V8
processor). It will execute on a Solaris V8+ system
-xarch=v9 This option limits the instruction set to the SPARC-V9
architecture. The resulting .o object files are in 64-bit
ELF format and can only be linked with other object
files in the same format. The resulting executable can
only be run on a 64-bit SPARC processor running 64-bit
Solaris with the 64–bit kernel.
-xarch=v9a This option limits the instruction set to the SPARC-V9
architecture, adding the Visual Instruction Set (VIS)
and extensions specific to UltraSPARC processors. The
resulting .o object files are in 64-bit ELF format and can
Availability SUNWsprot
SEE ALSO cc(1B), cpp(1),ld(1), m4(1), nm(1), strip(1), tmpnam(3C), a.out(4), attributes(5)
NOTES If the -m option, which invokes the m4(1) macro processor, is used, keywords for m4
cannot be used as symbols (variables, functions, labels) in the input file, since m4
cannot determine which keywords are assembler symbols and which keywords are
real m4 macros.
User Commands 65
asa(1)
NAME asa – convert FORTRAN carriage-control output to printable form
SYNOPSIS asa [-f] [file…]
DESCRIPTION The asa utility will write its input files to standard output, mapping carriage-control
characters from the text files to line-printer control sequences.
The first character of every line will be removed from the input, and the following
actions will be performed.
For any other character in the first column of an input line, asa skips the character
and prints the rest of the line unchanged.
converts output from a.out to conform with conventional printers and directs it
through a pipe to the printer.
The command
asa output
Page 1:
Blank
ZeroPlus
Page 2:
One
ENVIRONMENT See environ(5) for descriptions of the following environment variables that affect the
VARIABLES execution of asa: LANG, LC_ALL, LC_CTYPE, LC_MESSAGES, and NLSPATH.
Availability SUNWcsu
User Commands 67
at(1)
NAME at, batch – execute commands at a later time
SYNOPSIS at [-c | -k | -s] [-m] [-f file] [-p project] [-q queuename] -t time
at [-c | -k | -s] [-m] [-f file] [-p project] [-q queuename] timespec…
at -l [-p project] [-q queuename] [at_job_id. ..]
at -r at_job_id. ..
batch [-p project]
DESCRIPTION
at The at utility reads commands from standard input and groups them together as an
at-job, to be executed at a later time.
The at-job will be executed in a separate invocation of the shell, running in a separate
process group with no controlling terminal, except that the environment variables,
current working directory, file creation mask (see umask(1)), and system resource
limits (for sh and ksh only, see ulimit(1)) in effect when the at utility is executed
will be retained and used when the at-job is executed.
When the at-job is submitted, the at_job_id and scheduled time are written to standard
error. The at_job_id is an identifier that will be a string consisting solely of
alphanumeric characters and the period character. The at_job_id is assigned by the
system when the job is scheduled such that it uniquely identifies a particular job.
User notification and the processing of the job’s standard output and standard error
are described under the -m option.
Users are permitted to use at and batch (see below) if their name appears in the file
/usr/lib/cron/at.allow. If that file does not exist, the file
/usr/lib/cron/at.deny is checked to determine if the user should be denied
access to at. If neither file exists, only a user with the solaris.jobs.user
authorization is allowed to submit a job. If only at.deny exists and is empty, global
usage is permitted. The at.allow and at.deny files consist of one user name per
line.
cron and at jobs will be not be executed if the user’s account is locked. Only accounts
which are not locked as defined in shadow(4) will have their job or process executed.
batch The batch utility reads commands to be executed at a later time. It is the equivalent
of the command:
at −q b −m now
where queue b is a special at queue, specifically for batch jobs. Batch jobs will be
submitted to the batch queue for immediate execution.
OPTIONS The following options are supported. If the -c, -k, or -s options are not specified, the
SHELL environment variable by default determines which shell to use.
-c C shell. csh(1) is used to execute the at-job.
If -m is not used, the job’s standard output and standard error will
be provided to the user by means of mail, unless they are
redirected elsewhere; if there is no such output to provide, the user
is not notified of the job’s completion.
-p project Specifies under which project the at or batch job will be run.
When used with the -l option, limits the search to that particular
project. Values for project will be interpreted first as a project name,
and then as a possible project ID, if entirely numeric. By default,
the user’s current project is used.
-q queuename Specifies in which queue to schedule a job for submission. When
used with the -l option, limits the search to that particular queue.
Values for queuename are limited to the lower case letters a through
z. By default, at-jobs will be scheduled in queue a. In contrast,
queue b is reserved for batch jobs. Since queue c is reserved for
cron jobs, it can not be used with the -q option.
-r at_job_id Removes the jobs with the specified at_job_id operands that were
previously scheduled by the at utility.
-t time Submits the job to be run at the time specified by the time
option-argument, which must have the format as specified by the
touch(1) utility.
User Commands 69
at(1)
interpreted as being in the timezone of the user (as determined by
the TZ variable), unless a timezone name appears as part of time
below.
In the "C" locale, the following describes the three parts of the time
specification string. All of the values from the LC_TIME categories
in the "C" locale are recognized in a case-insensitive manner.
time The time can be specified as one, two or four
digits. One- and two-digit numbers are taken
to be hours, four-digit numbers to be hours
and minutes. The time can alternatively be
specified as two numbers separated by a colon,
meaning hour:minute. An AM/PM indication
(one of the values from the am_pm keywords in
the LC_TIME locale category) can follow the
time; otherwise, a 24-hour clock time is
understood. A timezone name of GMT, UCT, or
ZULU (case insensitive) can follow to specify
that the time is in Coordinated Universal Time.
Other timezones can be specified using the TZ
environment variable. The time field can also
be one of the following tokens in the "C" locale:
midnight Indicates the time 12:00 am (00:00).
noon Indicates the time 12:00 pm.
now Indicate the current day and time.
Invoking at now will submit an
at-job for potentially immediate
execution (that is, subject only to
unspecified scheduling delays).
date An optional date can be specified as either a
month name (one of the values from the mon
or abmon keywords in the LC_TIME locale
category) followed by a day number (and
possibly year number preceded by a comma)
or a day of the week (one of the values from
the day or abday keywords in the LC_TIME
locale category). Two special days are
recognized in the "C" locale:
today Indicates the current day.
tomorrow Indicates the day following the
current day.
USAGE The format of the at command line shown here is guaranteed only for the "C" locale.
Other locales are not supported for midnight, noon, now, mon, abmon, day, abday,
today, tomorrow, minutes, hours, days, weeks, months, years, and next.
Since the commands run in a separate shell invocation, running in a separate process
group with no controlling terminal, open file descriptors, traps and priority inherited
from the invoking environment are lost.
EXAMPLES
To have a job reschedule itself, at can be invoked from within the at-job. For example,
this "daily-processing" script named my.daily will run every day (although
crontab is a more appropriate vehicle for such work):
User Commands 71
at(1)
EXAMPLE 3 Self-rescheduling a job (Continued)
The spacing of the three portions of the "C" locale timespec is quite flexible as long as
there are no ambiguities. Examples of various times and operand presentations
include:
at 0815am Jan 24
at 8 :15amjan24
at now "+ 1day"
at 5 pm FRIday
at ’17
utc+
30minutes’
ENVIRONMENT See environ(5) for descriptions of the following environment variables that affect the
VARIABLES execution of at and batch: LANG, LC_ALL, LC_CTYPE, LC_MESSAGES, NLSPATH, and
LC_TIME.
DATEMSK If the environment variable DATEMSK is set, at will use its value as
the full path name of a template file containing format strings. The
strings consist of format specifiers and text characters that are used
to provide a richer set of allowable date formats in different
languages by appropriate settings of the environment variable
LANG or LC_TIME. The list of allowable format specifiers is located
in the getdate(3C) manual page. The formats described in the
OPERANDS section for the time and date arguments, the special
names noon, midnight, now, next, today, tomorrow, and the
increment argument are not recognized when DATEMSK is set.
Availability SUNWcsu
Availability SUNWesu
CSI Enabled
SEE ALSO auths(1), crontab(1), csh(1), date(1), ksh(1), sh(1), touch(1), ulimit(1),
umask(1), cron(1M), getdate(3C), auth_attr(4), shadow(4), attributes(5),
environ(5), standards(5)
NOTES Regardless of queue used, cron(1M) has a limit of 100 jobs in execution at any time.
User Commands 73
at(1)
There can be delays in cron at job execution. In some cases, these delays can
compound to the point that cron job processing appears to be hung. All jobs will be
executed eventually. When the delays are excessive, the only workaround is to kill and
restart cron.
DESCRIPTION The atq utility displays the at jobs queued up for the current user. at(1) is a utility
that allows users to execute commands at a later date. If invoked by a user with the
solaris.jobs.admin authorization, atq will display all jobs in the queue.
If no options are given, the jobs are displayed in chronological order of execution.
When an authorized user invokes atq without specifying username, the entire queue is
displayed; when a username is specified, only those jobs belonging to the named user
are displayed.
Availability SUNWcsu
User Commands 75
atrm(1)
NAME atrm – remove jobs spooled by at or batch
SYNOPSIS atrm [-afi] [ [job #] [user…]]
DESCRIPTION The atrm utility removes delayed-execution jobs that were created with the at(1)
command, but have not yet executed. The list of these jobs and associated job numbers
can be displayed by using atq(1).
atrm removes each job-number you specify, and/or all jobs belonging to the user you
specify, provided that you own the indicated jobs.
You can only remove jobs belonging to other users if you have
solaris.jobs.admin privileges.
Availability SUNWcsu
DESCRIPTION audioconvert converts audio data between a set of supported audio encodings and
file formats. It can be used to compress and decompress audio data, to add audio file
headers to raw audio data files, and to convert between standard data encodings, such
as -law and linear PCM.
If no filenames are present, audioconvert reads the data from the standard input
stream and writes an audio file to the standard output. Otherwise, input files are
processed in order, concatenated, and written to the output file.
Input files are expected to contain audio file headers that identify the audio data
format. If the audio data does not contain a recognizable header, the format must be
specified with the -i option, using the rate, encoding, and channels keywords to
identify the input data format.
The output file format is derived by updating the format of the first input file with the
format options in the -f specification. If -p is not specified, all subsequent input files
are converted to this resulting format and concatenated together. The output file will
contain an audio file header, unless format=raw is specified in the output format
options.
Input files may be converted in place by using the -p option. When -p is in effect, the
format of each input file is modified according to the -f option to determine the
output format. The existing files are then overwritten with the converted data.
The file(1) command decodes and prints the audio data format of Sun audio files.
User Commands 77
audioconvert(1)
-i infmt Input Format: This option is used to specify the data encoding of
raw input files. Ordinarily, the input data format is derived from
the audio file header. This option is required when converting
audio data that is not preceded by a valid audio file header. If -i
is specified for an input file that contains an audio file header, the
input format string will be ignored, unless -F is present. The
format specification syntax is the same as the -f output file
format.
Format The syntax for the input and output format specification is:
Specification
keyword=value[,keyword=value . . . ]
USAGE See largefile(5) for the description of the behavior of audioconvert when
encountering files greater than or equal to 2 Gbyte ( 231 bytes).
User Commands 79
audioconvert(1)
EXAMPLE 2 Concatenating two audio files
Concatenate two Sun format audio files, regardless of their data format, and output an
8-bit ulaw, 16 kHz, mono file:
example% audioconvert -f ulaw,rate=16k,mono -o outfile.au infile1 infile2
Convert a directory containing raw voice data files, in place, to Sun format (adds a file
header to each file):
example% audioconvert -p -i voice -f sun *.au
Availability SUNWauda
NOTES The algorithm used for converting multi-channel data to mono is implemented by
simply summing the channels together. If the input data is perfectly in phase (as
would be the case if a mono file is converted to stereo and back to mono), the resulting
data may contain some distortion.
DESCRIPTION The audioplay utility copies the named audio files (or the standard input if no
filenames are present) to the audio device. If no input file is specified and standard
input is a tty, the port, volume, and balance settings specified on the command line
will be applied and the program will exit.
The input files must contain a valid audio file header. The encoding information in
this header is matched against the capabilities of the audio device and, if the data
formats are incompatible, an error message is printed and the file is skipped.
Compressed ADPCM (G.721) monaural audio data is automatically uncompressed
before playing.
Minor deviations in sampling frequency (that is, less than 1%) are ordinarily ignored.
This allows, for instance, data sampled at 8012 Hz to be played on an audio device
that only supports 8000 Hz. If the -V option is present, such deviations are flagged
with warning messages.
User Commands 81
audioplay(1)
-d dev
Device: The dev argument specifies an alternate audio device to which output
should be directed. If the -d option is not specified, the AUDIODEV environment
variable is consulted (see below). Otherwise, /dev/audio is used as the default
audio device.
−\?
Help: Prints a command line usage message.
OPERANDS file File Specification: Audio files named on the command line are played
sequentially. If no filenames are present, the standard input stream (if it is
not a tty) is played (it, too, must contain an audio file header). The special
filename ‘−’ may be used to read the standard input stream instead of a file.
If a relative path name is supplied, the AUDIOPATH environment variable is
consulted (see below).
USAGE See largefile(5) for the description of the behavior of audioplay when
encountering files greater than or equal to 2 Gbyte ( 231 bytes).
ENVIRONMENT AUDIODEV The full path name of the audio device to write to, if no -d
VARIABLES argument is supplied. If the AUDIODEV variable is not set,
/dev/audio is used.
AUDIOPATH A colon-separated list of directories in which to search for audio
files whose names are given by relative pathnames. The current
directory (".") may be specified explicitly in the search path. If the
AUDIOPATH variable is not set, only the current directory will be
searched.
Availability SUNWauda
BUGS audioplay currently supports a limited set of audio format conversions. If the audio
file is not in a format supported by the audio device, it must first be converted. For
example, to convert to voice format on the fly, use the command:
example% audioconvert -f voice myfile | audioplay
The format conversion will not always be able to keep up with the audio output. If
this is the case, you should convert to a temporary file before playing the data.
DESCRIPTION The audiorecord utility copies audio data from the audio device to a named audio
file (or the standard output if no filename is present). If no output file is specified and
standard output is a tty, the volume, balance, monitor volume, port, and audio format
settings specified on the command line will be applied and the program will exit.
By default, monaural audio data is recorded at 8 kHz and encoded in -law format. If
the audio device supports additional configurations, the -c, -s, and -e options may
be used to specify the data format. The output file is prefixed by an audio file header
that identifies the format of the data encoded in the file.
Recording begins immediately and continues until a SIGINT signal (for example,
Ctrl-C) is received. If the -t option is specified, audiorecord stops when the
specified quantity of data has been recorded.
If the audio device is unavailable (that is, another process currently has read access),
audiorecord prints an error message and exits immediately.
User Commands 83
audiorecord(1)
allows a directly connected input source to be heard on the output speaker while
recording is in-progress. If this argument is not specified, the monitor volume will
remain at the level most recently set by any process.
-p mic | line | internal-cd
Input Port: Selects the mic, line, or internal-cd input as the source of the audio
output signal. If this argument is not specified, the input port will remain
unchanged. Please note: Some systems will not support all possible input ports. If
the named port does not exist, this option is ignored.
-c channels
Channels: Specifies the number of audio channels (1 or 2). The value may be
specified as an integer or as the string mono or stereo. The default value is mono.
-s rate
Sample Rate: Specifies the sample rate, in samples per second. If a number is
followed by the letter k, it is multiplied by 1000 (for example, 44.1k = 44100). The
default sample rate is 8 kHz.
-e encoding
Encoding: Specifies the audio data encoding. This value may be one of ulaw, alaw,
or linear. The default encoding is ulaw.
-t time
Time: The time argument specifies the maximum length of time to record. Time can
be specified as a floating-point value, indicating the number of seconds, or in the
form: hh:mm:ss.dd, where the hour and minute specifications are optional.
-i info
Information: The ‘information’ field of the output file header is set to the string
specified by the info argument. This option cannot be specified in conjunction with
the -a argument.
-d dev
Device: The dev argument specifies an alternate audio device from which input
should be taken. If the -d option is not specified, the AUDIODEV environment
variable is consulted (see below). Otherwise, /dev/audio is used as the default
audio device.
-\?
Help: Prints a command line usage message.
OPERANDS file File Specification: The named audio file is rewritten (or appended). If no
filename is present (and standard output is not a tty), or if the special
filename ‘−’ is specified, output is directed to the the standard output.
USAGE See largefile(5) for the description of the behavior of audiorecord when
encountering files greater than or equal to 2 Gbyte ( 231 bytes).
ENVIRONMENT AUDIODEV The full path name of the audio device to record from, if no -d
VARIABLES argument is supplied. If the AUDIODEV variable is not set,
/dev/audio is used.
Availability SUNWauda
User Commands 85
auths(1)
NAME auths – print authorizations granted to a user
SYNOPSIS auths [ user …]
DESCRIPTION The auths command prints on standard output the authorizations that you or the
optionally-specified user or role have been granted. Authorizations are rights that are
checked by certain privileged programs to determine whether a user may execute
restricted functionality.
Each user may have zero or more authorizations. Authorizations are represented by
fully-qualified names, which identify the organization that created the authorization
and the functionality that it controls. Following the Java convention, the hierarchical
components of an authorization are separated by dots (.), starting with the reverse
order Internet domain name of the creating organization, and ending with the specific
function within a class of authorizations.
Notice that there is no space after the comma separating the authorization names in
tester01.
FILES /etc/user_attr
/etc/security/auth_attr
/etc/security/policy.conf
/etc/security/prof_attr
Availability SUNWcsu
User Commands 87
awk(1)
NAME awk – pattern scanning and processing language
SYNOPSIS /usr/bin/awk [-f progfile] [-F c] [’ prog ’] [parameters] [filename…]
/usr/xpg4/bin/awk [-F ERE] [-v assignment…] ’program’ -f progfile…
[argument…]
The /usr/bin/awk utility scans each input filename for lines that match any of a set
of patterns specified in prog. The prog string must be enclosed in single quotes ( ´) to
protect it from the shell. For each pattern in prog there may be an associated action
performed when a line of a filename matches the pattern. The set of pattern-action
statements may appear literally as prog or in a file specified with the -f progfile option.
Input files are read in order; if there are no files, the standard input is read. The file
name ’−’ means the standard input.
USAGE
Input Lines Each input line is matched against the pattern portion of every pattern-action
statement; the associated action is performed for each matched pattern. Any filename of
the form var=value is treated as an assignment, not a filename, and is executed at the
time it would have been opened if it were a filename. Variables assigned in this manner
are not available inside a BEGIN rule, and are assigned after previously specified files
have been read.
An input line is normally made up of fields separated by white spaces. (This default
can be changed by using the FS built-in variable or the -Fc option.) The default is to
ignore leading blanks and to separate fields by blanks and/or tab characters.
However, if FS is assigned a value that does not include any of the white spaces, then
leading blanks are not ignored. The fields are denoted $1, $2, . . . ; $0 refers to the
entire line.
Either pattern or action may be omitted. If there is no action, the matching line is
printed. If there is no pattern, the action is performed on every input line.
Pattern-action statements are separated by newlines or semicolons.
Patterns are arbitrary Boolean combinations ( !, ||, &&, and parentheses) of relational
expressions and regular expressions. A relational expression is one of the following:
where a relop is any of the six relational operators in C, and a matchop is either ~
(contains) or !~ (does not contain). An expression is an arithmetic expression, a
relational expression, the special expression
var in array
The special patterns BEGIN and END may be used to capture control before the first
input line has been read and after the last input line has been read respectively. These
keywords do not combine with any other patterns.
User Commands 89
awk(1)
Statements are terminated by semicolons, newlines, or right braces. An empty
expression-list stands for the whole input line. Expressions take on string or numeric
values as appropriate, and are built using the operators +, −, *, /, %, ^ and
concatenation (indicated by a blank). The operators ++, −−, +=, −=, *=, /=, %=, ^=, >,
>=, <, <=, ==, !=, and ?: are also available in expressions. Variables may be scalars,
array elements (denoted x[i]), or fields. Variables are initialized to the null string or
zero. Array subscripts may be any string, not necessarily numeric; this allows for a
form of associative memory. String constants are quoted (""), with the usual C escapes
recognized within.
The print statement prints its arguments on the standard output, or on a file if
>expression is present, or on a pipe if ’|cmd’ is present. The output resulted from the
print statement is terminated by the output record separator with each argument
separated by the current output field separator. The printf statement formats its
expression list according to the format (see printf(3C)).
Large File See largefile(5) for the description of the behavior of awk when encountering files
Behavior greater than or equal to 2 Gbyte ( 231 bytes).
EXAMPLE 3 Same, with input fields separated by comma and/or blanks and tabs
example% BEGIN { FS = ",[ \t]*|[ \t]+" }
{ print $2, $1 }
EXAMPLE 7 Printing all lines whose first field is different from the previous one
example% $1 != prev { print; prev = $1 }
User Commands 91
awk(1)
EXAMPLE 9 Printing a file and numbering its pages, starting at 5
Assuming this program is in a file named prog, the following command line prints
the file input numbering its pages starting at 5:
example% awk -f prog n=5 input
ENVIRONMENT See environ(5) for descriptions of the following environment variables that affect the
VARIABLES execution of awk: LANG, LC_ALL, LC_COLLATE, LC_CTYPE, LC_MESSAGES, NLSPATH,
and PATH.
LC_NUMERIC Determine the radix character used when interpreting numeric
input, performing conversions between numeric and string values
and formatting numeric output. Regardless of locale, the period
character (the decimal-point character of the POSIX locale) is the
decimal-point character recognized in processing awk programs
(including assignments in command-line arguments).
Availability SUNWesu
CSI Enabled
Availability SUNWxcu4
CSI Enabled
NOTES Input white space is not preserved on output if fields are involved.
There are no explicit conversions between numbers and strings. To force an expression
to be treated as a number, add 0 to it. To force an expression to be treated as a string,
concatenate the null string ("") to it.
DESCRIPTION banner prints its arguments (each up to 10 characters long) in large letters on the
standard output.
Availability SUNWesu
User Commands 93
basename(1)
NAME basename, dirname – deliver portions of path names
SYNOPSIS /usr/bin/basename string [suffix]
/usr/xpg4/bin/basename string [suffix]
dirname string
DESCRIPTION The basename utility deletes any prefix ending in / and the suffix (if present in string)
from string, and prints the result on the standard output. It is normally used inside
substitution marks (‘ ‘) within shell procedures.
/usr/xpg4/bin The suffix is a string with no special significance attached to any of the characters it
contains.
The dirname utility delivers all but the last level of the path name in string.
ENVIRONMENT See environ(5) for descriptions of the following environment variables that affect the
VARIABLES execution of basename and dirname: LANG, LC_ALL, LC_CTYPE, LC_MESSAGES,
and NLSPATH.
Availability SUNWcsu
Availability SUNWxcu4
User Commands 95
basename(1B)
NAME basename – display portions of pathnames
SYNOPSIS /usr/ucb/basename string [suffix]
DESCRIPTION The basename utility deletes any prefix ending in ‘/’ and the suffix, if present in string.
It directs the result to the standard output, and is normally used inside substitution
marks (‘ ‘) within shell procedures. The suffix is a string with no special significance
attached to any of the characters it contains.
This shell procedure invoked with the argument /usr/src/bin/cat.c compiles the
named file and moves the output to cat in the current directory:
example% cc $1
example% mv a.out ‘basename $1 .c‘
Availability SUNWscpu
DESCRIPTION The bc utility implements an arbitrary precision calculator. It takes input from any
files given, then reads from the standard input. If the standard input and standard
output to bc are attached to a terminal, the invocation of bc is interactive, causing
behavioral constraints described in the following sections. bc processes a language
that resembles C and is a preprocessor for the desk calculator program dc, which it
invokes automatically unless the -c option is specified. In this case the dc input is
sent to the standard output instead.
Other Operands Arbitrarily long numbers with optional sign and decimal point. Strings of fewer than
BC_STRING_MAX characters, between double quotes ("). ( E )
sqrt ( E ) Square root
length ( E ) Number of significant decimal digits.
scale ( E ) Number of digits right of decimal point.
L ( E , ... , E )
Operators + − * / % ^
(% is remainder; ^ is power)
++ −−
(prefix and postfix; apply to names)
== <= >= != < >
= =+ =− =* =/ =% =^
Statements E
{ S ;. . . ; S }
if ( E ) S
User Commands 97
bc(1)
while ( E ) S
for ( E ; E ; E ) S
null statement
break
quit
.string
Function define L ( L ,. . . , L ) {
Definitions auto L ,. . . , L
S ;. . . S
return ( E )
}
Functions in -l s(x) sine
Math Library
c(x) cosine
e(x) exponential
l(x) log
a(x) arctangent
j(n,x) Bessel function
The value of a statement that is an expression is printed unless the main operator is an
assignment. Either semicolons or new-lines may separate statements. Assignment to
scale influences the number of digits to be retained on arithmetic operations in the
manner of dc. Assignments to ibase or obase set the input and output number radix
respectively.
The same letter may be used as an array, a function, and a simple variable
simultaneously. All variables are global to the program. auto variables are stacked
during function calls. When using arrays as function arguments or defining them as
automatic variables, empty square brackets must follow the array name.
In the shell, the following assigns an approximation of the first ten digits of n to the
variable x:
x=$(printf "%s\n" ’scale = 10; 104348/33215’ | bc)
Prints approximate values of the exponential function of the first ten integers:
for(i=1; i<=10; i++) e(i)
or
for (i = 1; i <= 10; ++i) { e(i) }
ENVIRONMENT See environ(5) for descriptions of the following environment variables that affect the
VARIABLES execution of bc: LANG, LC_ALL, LC_CTYPE, LC_MESSAGES, and NLSPATH.
User Commands 99
bc(1)
Availability SUNWesu
NOTES The bc command does not recognize the logical operators && and | |.
100 man pages section 1: User Commands • Last Revised 28 Mar 1995
bdiff(1)
NAME bdiff – big diff
SYNOPSIS bdiff filename1 filename2 [n] [-s]
DESCRIPTION bdiff is used in a manner analogous to diff to find which lines in filename1 and
filename2 must be changed to bring the files into agreement. Its purpose is to allow
processing of files too large for diff. If filename1 (filename2) is −, the standard input is
read.
bdiff ignores lines common to the beginning of both files, splits the remainder of
each file into n-line segments, and invokes diff on corresponding segments. If both
optional arguments are specified, they must appear in the order indicated above.
The output of bdiff is exactly that of diff, with line numbers adjusted to account
for the segmenting of the files (that is, to make it look as if the files had been processed
whole). Note: Because of the segmenting of the files, bdiff does not necessarily find a
smallest sufficient set of file differences.
OPTIONS n The number of line segments. The value of n is 3500 by default. If the
optional third argument is given and it is numeric, it is used as the value
for n. This is useful in those cases in which 3500-line segments are too large
for diff, causing it to fail.
-s Specifies that no diagnostics are to be printed by bdiff (silent option).
Note: However, this does not suppress possible diagnostic messages from
diff, which bdiff calls.
USAGE See largefile(5) for the description of the behavior of bdiff when encountering
files greater than or equal to 2 Gbyte ( 231 bytes).
FILES /tmp/bd?????
Availability SUNWesu
CSI enabled
DESCRIPTION The bfs command is (almost) like ed(1) except that it is read-only and processes
much larger files. Files can be up to 1024K bytes and 32K lines, with up to 512
characters, including new-line, per line (255 for 16-bit machines). bfs is usually more
efficient than ed(1) for scanning a file, since the file is not copied to a buffer. It is most
useful for identifying sections of a large file where csplit(1) can be used to divide it
into more manageable pieces for editing.
Normally, the size of the file being scanned is printed, as is the size of any file written
with the w (write) command. The optional − suppresses printing of sizes. Input is
prompted with * if P and a carriage return are typed, as in ed(1). Prompting can be
turned off again by inputting another P and carriage return. Note that messages are
given in response to errors if prompting is turned on.
All address expressions described under ed(1) are supported. In addition, regular
expressions may be surrounded with two symbols besides / and ?:
> indicates downward search without wrap-around, and
< indicates upward search without wrap-around.
There is a slight difference in mark names; that is, only the letters a through z may be
used, and all 26 marks are remembered.
bfs Commands The e, g, v, k, p, q, w, =, !, and null commands operate as described under ed(1).
Commands such as −−−, +++−, +++=, −12, and +4p are accepted. Note that 1,10p
and 1,10 will both print the first ten lines. The f command only prints the name of
the file being scanned; there is no remembered file name. The w command is
independent of output diversion, truncation, or crunching (see the xo, xt, and xc
commands, below). The following additional commands are available:
xf file
Further commands are taken from the named file. When an end-of-file is reached,
an interrupt signal is received or an error occurs, reading resumes with the file
containing the xf. The xf commands may be nested to a depth of 10.
xn
List the marks currently in use (marks are set by the k command).
xo [ file ]
Further output from the p and null commands is diverted to the named file,
which, if necessary, is created mode 666 (readable and writable by everyone), unless
your umask setting (see umask(1)) dictates otherwise. If file is missing, output is
diverted to the standard output. Note that each diversion causes truncation or
creation of the file.
102 man pages section 1: User Commands • Last Revised 20 May 1996
bfs(1)
: label
This positions a label in a command file. The label is terminated by new-line, and
blanks between the : (colon) and the start of the label are ignored. This command
may also be used to insert comments into a command file, since labels need not be
referenced.
( . , . )xb/regular expression/label
A jump (either upward or downward) is made to label if the command succeeds. It
fails under any of the following conditions:
1. Either address is not between 1 and $.
2. The second address is less than the first.
3. The regular expression does not match at least one line in the specified range,
including the first and last lines.
On success, . (dot) is set to the line matched and a jump is made to label. This
command is the only one that does not issue an error message on bad addresses, so
it may be used to test whether addresses are bad before other commands are
executed. Note that the command, xb/^/ label, is an unconditional jump.
The xb command is allowed only if it is read from someplace other than a terminal.
If it is read from a pipe, only a downward jump is possible.
xt number
Output from the p and null commands is truncated to, at most, number characters.
The initial number is 255.
xv[digit] [spaces] [value]
The variable name is the specified digit following the xv. The commands xv5100 or
xv5 100 both assign the value 100 to the variable 5. The command xv61,100p
assigns the value 1,100p to the variable 6. To reference a variable, put a % in front
of the variable name. For example, using the above assignments for variables 5 and
6:
1,%5p
1,%5
%6
g/%5/p
would globally search for the characters 100 and print each line containing a
match. To escape the special meaning of %, a \ must precede it.
g/".*\%[cds]/p
would put the current line into variable 35, print it, and increment the variable 36
by one. To escape the special meaning of ! as the first character of value, precede it
with a \.
xv7\!date
Example 2:
xv45
: l
/size/
xv4!expr %4 − 1
!if 0%4 = 0 exit 2
xbz l
xc [switch]
If switch is 1, output from the p and null commands is crunched; if switch is 0,
it is not. Without an argument, xc reverses switch. Initially, switch is set for no
crunching. Crunched output has strings of tabs and blanks reduced to one blank
and blank lines suppressed.
104 man pages section 1: User Commands • Last Revised 20 May 1996
bfs(1)
filename Any file up to 1024K bytes and 32K lines, with up to 512
characters, including new-line, per line (255 for 16-bit machines).
filename can be a section of a larger file which has been divided
into more manageable sections for editing by the use of
csplit(1).
Availability SUNWesu
DIAGNOSTICS Message is ? for errors in commands, if prompting is turned off. Self-explanatory error
messages are displayed when prompting is on.
DESCRIPTION biff turns mail notification on or off for the terminal session. With no arguments,
biff displays the current notification status for the terminal.
If notification is allowed, the terminal rings the bell and displays the header and the
first few lines of each arriving mail message. biff operates asynchronously. For
synchronized notices, use the MAIL variable of sh(1) or the mail variable of csh(1).
Availability SUNWscpu
106 man pages section 1: User Commands • Last Revised 14 Sep 1992
break(1)
NAME break, continue – shell built-in functions to escape from or advance within a
controlling while, for, foreach, or until loop
sh break [n]
continue [n]
csh break
continue
ksh *break [n]
*continue [n]
DESCRIPTION
sh break exits from the enclosing for or while loop, if any. If n is specified, break n
levels.
continue resumes the next iteration of the enclosing for or while loop. If n is
specified, resume at the n-th enclosing loop.
csh break resumes execution after the end of the nearest enclosing foreach or while
loop. The remaining commands on the current line are executed. This allows
multilevel breaks to be written as a list of break commands, all on one line.
continue continues execution of the next iteration of the nearest enclosing while or
foreach loop.
ksh break exits from the enclosed for, while, until, or select loop, if any. If n is
specified then break n levels.
continue resumes the next iteration of the enclosed for, while, until, or select
loop. If n is specified then resume at the n-th enclosed loop.
On this man page, ksh(1) commands that are preceded by one or two * (asterisks) are
treated specially in the following ways:
1. Variable assignment lists preceding the command remain in effect when the
command completes.
2. I/O redirections are processed after variable assignments.
3. Errors cause a script that contains them to abort.
4. Words, following a command preceded by ** that are in the format of a variable
assignment, are expanded with the same rules as a variable assignment. This
means that tilde substitution is performed after the = sign and word splitting and
file name generation are not performed.
Availability SUNWcsu
108 man pages section 1: User Commands • Last Revised 15 Apr 1994
cal(1)
NAME cal – display a calendar
SYNOPSIS cal [ [month] year]
DESCRIPTION The cal utility writes a Gregorian calendar to standard output. If the year operand is
specified, a calendar for that year is written. If no operands are specified, a calendar
for the current month is written.
ENVIRONMENT See environ(5) for descriptions of the following environment variables that affect the
VARIABLES execution of cal: LANG, LC_ALL, LC_CTYPE, LC_TIME, LC_MESSAGES, and
NLSPATH.
TZ Determine the timezone used to calculate the value of the current month.
Availability SUNWesu
NOTES An unusual calendar is printed for September 1752. That is the month 11 days were
skipped to make up for lack of leap year adjustments. To see this calendar, type:
cal 9 1752
DESCRIPTION The calendar utility consults the file calendar in the current directory and writes
lines that contain today’s or tomorrow’s date anywhere in the line to standard output.
Most reasonable month-day dates such as Aug. 24, august 24, 8/24, and so forth,
are recognized, but not 24 August or 24/8. On Fridays and weekends “tomorrow”
extends through Monday. calendar can be invoked regularly by using the
crontab(1) or at(1) commands.
When the optional argument - is present, calendar does its job for every user who
has a file calendar in his or her login directory and sends them any positive results
by mail(1). Normally this is done daily by facilities in the UNIX operating system
(seecron(1M)).
If the environment variable DATEMSK is set, calendar will use its value as the full
path name of a template file containing format strings. The strings consist of
conversion specifications and text characters and are used to provide a richer set of
allowable date formats in different languages by appropriate settings of the
environment variable LANG or LC_TIME; see environ(5). Seestrftime(3C) for the
list of allowable conversion specifications.
%B represents the full month name, %e the day of month and %Y the year (4 digits).
If DATEMSK is set to this template, the following calendar file would be valid:
March 7th of the year 1989 <Reminder>
ENVIRONMENT See environ(5) for descriptions of the following environment variables that affect the
VARIABLES execution of calendar: LC_CTYPE, LC_TIME, LC_MESSAGES, NLSPATH, and TZ.
EXIT STATUS 0 Successful completion.
>0 An error occurred.
FILES /etc/passwd system password file
/tmp/cal* temporary files used by calendar
/usr/lib/calprog program used to determine dates for today and
tomorrow
110 man pages section 1: User Commands • Last Revised 1 Feb 1995
calendar(1)
ATTRIBUTES See attributes(5) for descriptions of the following attributes:
Availability SUNWesu
NOTES Appropriate lines beginning with white space will not be printed.
Your calendar must be public information for you to get reminder service.
The - argument works only on calendar files that are local to the machine; calendar
is intended not to work on calendar files that are mounted remotely with NFS. Thus,
‘calendar -’ should be run only on diskful machines where home directories exist;
running it on a diskless client has no effect.
calendar is no longer in the default root crontab. Because of the network burden
‘calendar -’ can induce, it is inadvisable in an environment running ypbind(1M)
with a large passwd.byname map. If, however, the usefulness of calendar outweighs
the network impact, the super-user may run ‘crontab -e’ to edit the root crontab.
Otherwise, individual users may wish to use ‘crontab -e’ to edit their own crontabs
to have cron invoke calendar without the - argument, piping output to mail
addressed to themselves.
DESCRIPTION The cancel utility cancels print requests. There are two forms of the cancel
command.
The first form of cancel has two optional arguments: print requests (request-ID) and
destinations (destination). Specifying request-ID with destination cancels request-ID on
destination. Specifying only the destination cancels the current print request on
destination. If destination is not specified, cancel cancels the requested print request on
all destinations.
The second form of cancel cancels a user’s print requests on specific destinations.
Users can only cancel print requests associated with their username. By default, users
can only cancel print requests on the host from which the print request was submitted.
If a super-user has set user-equivalence=true in /etc/printers.conf on the
print server, users can cancel print requests associated with their username on any
host. Super-users can cancel print requests on the host from which the print request
was submitted. Super-users can also cancel print requests from the print server.
The print client commands locate destination information using the “printers”
database in the name service switch. See nsswitch.conf(4), printers(4), and
printers.conf(4) for details.
112 man pages section 1: User Commands • Last Revised 12 Apr 1999
cancel(1)
EXIT STATUS The following exit values are returned:
0 Successful completion.
non-zero An error occurred.
FILES /var/spool/print/* LP print queue.
$HOME/.printers User-configurable printer database.
/etc/printers.conf System printer configuration database.
printers.conf.byname NIS version of /etc/printers.conf.
printers.org_dir NIS+ version of /etc/printers.conf.
fns.ctx_dir.domain FNS version of /etc/printers.conf.
Availability SUNWpcu
SEE ALSO lp(1), lpq(1B), lpr(1B), lprm(1B), lpstat(1), lpadmin( 1M), nsswitch.conf(4),
printers(4), printers.conf(4), attributes(5), standards(5)
DESCRIPTION The cat utility reads each file in sequence and writes it on the standard output. Thus:
example% cat file
prints file on your terminal, and:
example% cat file1 file2 >file3
concatenates file1 and file2, and writes the results in file3. If no input file is given, cat
reads from the standard input file.
When used with the -v option, the following options may be used:
-e A $ character will be printed at the end of each line (prior to the new-line).
-t Tabs will be printed as ^I’s and formfeeds to be printed as ^L’s.
USAGE See largefile(5) for the description of the behavior of cat when encountering files
greater than or equal to 2 Gbyte ( 231 bytes).
114 man pages section 1: User Commands • Last Revised 1 Feb 1995
cat(1)
EXAMPLE 1 Concatenating a file (Continued)
The command:
example% cat start - middle - end > file
when standard input is a terminal, gets two arbitrary pieces of input from the terminal
with a single invocation of cat. Note, however, that if standard input is a regular file,
this would be equivalent to the command:
cat start - middle /dev/null end > file
because the entire contents of the file would be consumed by cat the first time ‘ − ’
was used as a file operand and an end-of-file condition would be detected immediately
when ‘ − ’ was referenced the second time.
ENVIRONMENT See environ(5) for descriptions of the following environment variables that affect the
VARIABLES execution of cat: LANG, LC_ALL, LC_CTYPE, LC_MESSAGES, and NLSPATH.
Availability SUNWcsu
CSI enabled
NOTES Redirecting the output of cat onto one of the files being read will cause the loss of the
data originally in the file being read. For example,
116 man pages section 1: User Commands • Last Revised 1 Feb 1995
cc(1B)
NAME cc – C compiler
SYNOPSIS /usr/ucb/cc [options]
Availability SUNWscpu
NOTES The -Y P, dir option may have unexpected results and should not be used.
118 man pages section 1: User Commands • Last Revised 24 Feb 1998
cd(1)
NAME cd, chdir, pushd, popd, dirs – change working directory
SYNOPSIS /usr/bin/cd [directory]
sh cd [argument]
chdir [argument]
csh cd [dir]
chdir [dir]
pushd [+n | dir]
popd [+n]
dirs [-l]
ksh cd [arg]
cd old new
DESCRIPTION
/usr/bin/cd The /usr/bin/cd utility changes the current directory in the context of the cd utility
only. This is in contrast to the version built into the shell, as described below.
/usr/bin/cd has no effect on the invoking process but can be used to determine
whether or not a given directory can be set as the current directory.
sh The Bourne shell built-in cd changes the current directory to argument. The shell
parameter HOME is the default argument. The shell parameter CDPATH defines the
search path for the directory containing argument. Alternative directory names are
separated by a colon (:). The default path is <null> (specifying the current
directory). Note: The current directory is specified by a null path name, which can
appear immediately after the equal sign or between the colon delimiters anywhere
else in the path list. If argument begins with ‘/’, ‘.’, or ‘. . ’, the search path is not
used. Otherwise, each directory in the path is searched for argument. cd must have
execute (search) permission in argument. Because a new process is created to execute
each command, cd would be ineffective if it were written as a normal command;
therefore, it is recognized by and is internal to the shell. (See pwd(1), sh(1), and
chdir(2)).
csh If dir is not specified, the C shell built-in cd uses the value of shell parameter HOME as
the new working directory. If dir specifies a complete path starting with ‘ / ’, ‘ . ’, or
‘ . . ’, dir becomes the new working directory. If neither case applies, cd tries to find
the designated directory relative to one of the paths specified by the CDPATH shell
variable. CDPATH has the same syntax as, and similar semantics to, the PATH shell
variable. cd must have execute (search) permission in dir. Because a new process is
created to execute each command, cd would be ineffective if it were written as a
normal command; therefore, it is recognized by and is internal to the C-shell. (See
pwd(1), sh(1), and chdir(2)).
pushd will push a directory onto the directory stack. With no arguments, exchange
the top two elements.
+n Rotate the n’th entry to the top of the stack and cd to it.
dir Push the current working directory onto the stack and change to dir.
popd pops the directory stack and cd to the new top directory. The elements of the
directory stack are numbered from 0 starting at the top.
+n Discard the n’th entry in the stack.
dirs will print the directory stack, most recent to the left; the first directory shown is
the current directory. With the -l argument, produce an unabbreviated printout; use
of the ~ notation is suppressed.
ksh The Korn shell built-in cd command can be in either of two forms. In the first form it
changes the current directory to arg. If arg is − the directory is changed to the previous
directory. The shell variable HOME is the default arg. The variable PWD is set to the
current directory. The shell variable CDPATH defines the search path for the directory
containing arg. Alternative directory names are separated by a colon (:). The default
path is <null> (specifying the current directory). Note that the current directory is
specified by a null path name, which can appear immediately after the equal sign or
between the colon delimiters anywhere else in the path list. If arg begins with a ‘ / ’, ‘
. ’, or ‘ . . ’, then the search path is not used. Otherwise, each directory in the path
is searched for arg.
The second form of cd substitutes the string new for the string old in the current
directory name, PWD and tries to change to this new directory.
The cd command may not be executed by rksh. Because a new process is created to
execute each command, cd would be ineffective if it were written as a normal
command; therefore, it is recognized by and is internal to the Korn shell. (See pwd(1),
sh(1), and chdir(2)).
OUTPUT If a non-empty directory name from CDPATH is used, an absolute pathname of the new
working directory will be written to the standard output as follows:
120 man pages section 1: User Commands • Last Revised 26 Mar 2001
cd(1)
Otherwise, there will be no output.
ENVIRONMENT See environ(5) for descriptions of the following environment variables that affect the
VARIABLES execution of cd: LANG, LC_ALL, LC_CTYPE, LC_MESSAGES, and NLSPATH.
CDPATH A colon-separated list of pathnames that refer to directories. If the
directory operand does not begin with a slash ( / ) character, and
the first component is not dot or dot-dot, cd will search for
directory relative to each directory named in the CDPATH variable,
in the order listed. The new working directory will be set to the
first matching directory found. An empty string in place of a
directory pathname represents the current directory. If CDPATH is
not set, it will be treated as if it were an empty string.
HOME The name of the home directory, used when no directory operand is
specified.
OLDPWD A pathname of the previous working directory, used by cd-.
PWD A pathname of the current working directory, set by cd after it has
changed to that directory.
Availability SUNWcsu
SEE ALSO csh(1), ksh(1), pwd(1), sh(1), chdir(2), attributes(5), environ(5), standards(5)
DESCRIPTION The cdrw command provides the ability to create data and audio CDs. It also provides
the ability to extract audio tracks from an audio CD. Any MMC-compliant CD-R or
CD-RW drive can be used with cdrw.
cdrw will search for a CD writer device connected to the system, unless the user
specifies a device with the -d option. If it finds a single such writer device, it will use
that as the default CD writer device for the command.
When more than one CD writer is connected to the system, use the -d option to
indicate which device is desired. The device name can be specified in one of the
following ways: /dev/rdsk/cNtNdNsN, cNtNdNsN, cNtNdN, or a symbolic name
used by volume manager, such as cdrom or cdrom1. The -l option will provide a list
of CD writers.
Creating Data CDs When creating data CDs, cdrw uses the track-at-once mode of writing. With the -i
option, the user will specify a file that contains the data to write on CD media. In the
absence of such a file, cdrw will read data from standard input.
In either case, the data will typically first have been prepared by using the
mkisofs(1M) command to convert the file and file information into the High Sierra
format used on CDs. See the examples that include use of this command.
Creating Audio For creating an audio CD, using the -a option, single or multiple audio files can be
CDs specified. All of the audio files should be in the supported audio formats. Currently
approved formats are:
sun Sun .au files with data in Red Book CDDA form
wav RIFF (.wav) files with data in Red Book CDDA form
cda .cda files having raw CD audio data (that is, 16 bit PCM stereo at 44.1 KHz
sample rate in little-endian byteorder)
122 man pages section 1: User Commands • Last Revised 21 Aug 2001
cdrw(1)
aur .aur files having raw CD data in big-endian byteorder
If no audio format is specified, cdrw tries to understand the audio file format based on
the file extension. The case of the characters in the extension is ignored. If a format is
specified using the -T option, it will be assumed as the audio file type for all the files
specified. Also, -cdrw will close the session after writing the audio tracks. Therefore,
the tracks to be written should be specified in a single command line.
Extracting Audio cdrw can also be used for extracting audio data from an audio CD with the -x option.
The CD should have tracks in Red Book CDDA form. By default, the output format is
based on the file extension. A user can specify a sun, wav, cda, or aur output format
using the -T option.
Copying CDs cdrw can be used to copy single session data CD-ROMs and Red Book audio CDs. For
copying a CD, cdrw looks for a specified source device. If no source device is specified
when using the -c option, the current CD writing device is assumed to be the source.
cdrw will extract the track or tracks into a temporary file and will look for a blank
writable CD-R/RW media in the current CD writing device. If no such media is found,
the user will be asked to insert a blank writable CD media in the current CD writing
device. If enough space is not available in the default temporary directory, an
alternative directory can be specified using the -m option.
Erasing CD-RW Users have to erase the CD-RW media before it can be re-written. With the -b option,
Media the following flavors of erasing are currently supported:
session Erase the last session.
all Erase the entire media.
If the session erasing type is used, cdrw will erase the last session. If there is only
one session recorded on the CD-RW (for example, a data/audio CD-RW created by
this tool), then session erasing is useful as it will only erase the portion that is
recorded, leaving behind a blank disk. This is faster than erasing the entire media.
The all erasing type should be used if it is a multisession disk, or the last session is
not closed, or disk status is unknown, and the user wishes to erase the disk. With this
type of erase, cdrw will erase the entire disk.
Checking The user can get a list of CD writing devices currently present in the system with the
device-list or -l option. Also, for a particular media, the user can get the blanking status and table
media-status of contents through the -M option. The -M option also prints information about the last
session start address and the next writable address. This information, along with the
-O option, can be used to create multisession CDs. Please refer to mkisofs(1M) for
more information.
124 man pages section 1: User Commands • Last Revised 21 Aug 2001
cdrw(1)
-S Simulation mode. In this mode, cdrw will do everything with the drive
laser turned off, so nothing will be written to the media. This can be used
to verify if the system can provide data at a rate good enough for CD
writing.
-T Audio format to use extracting audio files or reading audio files for audio
CD creation. The audio-type can be sun, wav, cda, or aur.
-v Verbose mode.
-x Extracts audio data from an audio track.
This example checks if the system can provide data to a CD-RW drive at a rate
sufficient for the write operation:
This example runs cdrw at a higher priority (for root user only):
example# priocntl –e –p 60 cdrw –i /home/foo/iso-image
Create the first session image using mkisofs(1M) and record it onto the disk without
closing the disk:
example% cdrw -O -i /home/foo/iso-image
Availability SUNWcdrw
NOTES The CD writing process requires data to be supplied at a constant rate to the drive. It
is advised to keep I/O activity to a minimum and shut down the related applications
while writing CDs.
When making copies or extracting audio tracks, it is better to use an MMC compliant
source CD-ROM drive. The CD writing device can be used for this purpose.
126 man pages section 1: User Commands • Last Revised 21 Aug 2001
cdrw(1)
Before writing a CD, ensure that the media is blank by using the -M option and use the
-S simulation mode to test the system to make sure it can provide data at the required
rate. In case the system is not able to provide data at the required rate, try simulation
with a slower write speed set through the -p option. Users can also try to run cdrw at
a higher priority using the priocntl(1) command.
The -p option is provided for users who are aware of the CD-R/RW drive and its
capabilities to operate at different write speeds. Some commercially available drives
handle the drive speed setting command differently, so use this option judiciously.
Most commercially available drives allow writing beyond 74 minutes as long as the
media has the capacity (such as 80–minute media). However, such capability of
writing beyond 74 minutes might not be supported by the drive in use. If the drive
being used supports such capability, then use the -C option to indicate that the tool
should rely on the capacity indicated by the media.
The cdrw command uses rbac(5) to control user access to the devices. By default,
cdrw is accessible to all users but can be restricted to individual users. Please refer to
"Administering CD-R/CD-RW devices" in the System Administration Guide: Basic
Administration for more information.
DESCRIPTION checknr checks a list of nroff(1) or troff(1) input files for certain kinds of errors
involving mismatched opening and closing delimiters and unknown commands. If no
files are specified, checknr checks the standard input. Delimiters checked are:
■ Font changes using \fx . . . \fP.
■ Size changes using \sx . . . \s0.
■ Macros that come in open . . . close forms, for example, the .TS and .TE macros
which must always come in pairs.
Availability SUNWdoc
BUGS There is no way to define a one-character macro name using the -a option.
128 man pages section 1: User Commands • Last Revised 14 Sep 1992
chgrp(1)
NAME chgrp – change file group ownership
SYNOPSIS chgrp [-fhR] group file…
DESCRIPTION The chgrp utility will set the group ID of the file named by each file operand to the
group ID specified by the group operand.
For each file operand, it will perform actions equivalent to the chown(2) function,
called with the following arguments:
■ The file operand will be used as the path argument.
■ The user ID of the file will be used as the owner argument.
■ The specified group ID will be used as the group argument.
Unless chgrp is invoked by a process with appropriate privileges, the set-user-ID and
set-group-ID bits of a regular file will be cleared upon successful completion; the
set-user-ID and set-group-ID bits of other file types may be cleared.
USAGE See largefile(5) for the description of the behavior of chgrp when encountering
files greater than or equal to 2 Gbyte (231 bytes).
ENVIRONMENT See environ(5) for descriptions of the following environment variables that affect the
VARIABLES execution of chgrp: LANG, LC_ALL, LC_CTYPE, LC_MESSAGES, and NLSPATH.
Availability SUNWcsu
130 man pages section 1: User Commands • Last Revised 20 Dec 1996
chkey(1)
NAME chkey – change user’s secure RPC key pair
SYNOPSIS chkey [-p] [-s nisplus | nis | files | ldap] [-m <mechanism>]
DESCRIPTION chkey is used to change a user’s secure RPC public key and secret key pair. chkey
prompts for the old secure-rpc password and verifies that it is correct by decrypting
the secret key. If the user has not already used keylogin(1) to decrypt and store the
secret key with keyserv(1M), chkey registers the secret key with the local
keyserv( 1M) daemon. If the secure-rpc password does not match the login
password, chkey prompts for the login password. chkey uses the login password to
encrypt the user’s secret Diffie-Hellman (192 bit) cryptographic key. chkey can also
encrypt other Diffie-Hellman keys for authentication mechanisms configured using
nisauthconf(1M).
chkey ensures that the login password and the secure-rpc password(s) are kept the
same, thus enabling password shadowing. See shadow(4).
The key pair can be stored in the /etc/publickey file (see publickey(4)), the NIS
publickey map, or the NIS+ cred.org_dir table. If a new secret key is generated,
it will be registered with the local keyserv(1M) daemon. However, only NIS+ can
store Diffie-Hellman keys other than 192-bits.
Keys for specific mechanisms can be changed or reencrypted using the -m option
followed by the authentication mechanism name. Multiple -m options can be used to
change one or more keys. However, only mechanisms configured using
nisauthconf(1M) can be changed with chkey.
If the source of the publickey is not specified with the -s option, chkey consults the
publickey entry in the name service switch configuration file. See
nsswitch.conf(4). If the publickey entry specifies one and only one source, then
chkey will change the key in the specified name service. However, if multiple name
services are listed, chkey can not decide which source to update and will display an
error message. The user should specify the source explicitly with the -s option.
Non root users are not allowed to change their key pair in the files database.
Availability SUNWcsu
NOTES NIS+ might not be supported in future releases of the Solaris™ Operating
Environment. Tools to aid the migration from NIS+ to LDAP are available in the
Solaris 9 operating environment. For more information, visit
http://www.sun.com/directory/nisplus/transition.html.
132 man pages section 1: User Commands • Last Revised 24 Jan 2002
chmod(1)
NAME chmod – change the permissions mode of a file
SYNOPSIS chmod [-fR] absolute-mode file…
chmod [-fR] symbolic-mode-list file…
DESCRIPTION The chmod utility changes or assigns the mode of a file. The mode of a file specifies its
permissions and other attributes. The mode may be absolute or symbolic.
Operations are performed in the order given. Multiple permissions letters following a
single operator cause the corresponding operations to be performed simultaneously.
who zero or more of the characters u, g, o, and a specifying whose
permissions are to be changed or assigned:
u user’s permissions
g group’s permissions
o others’ permissions
a all permissions (user, group, and other)
134 man pages section 1: User Commands • Last Revised 4 Dec 2000
chmod(1)
= Assign permissions absolutely.
This example (user, group, and others all have permission to read,
write, and execute a given file) demonstrates two categories for
granting permissions: the access class and the permissions
themselves.
USAGE See largefile(5) for the description of the behavior of chmod when encountering
files greater than or equal to 2 Gbyte ( 231 bytes).
136 man pages section 1: User Commands • Last Revised 4 Dec 2000
chmod(1)
EXAMPLE 2 Allowing only read permission to everyone
example% chmod 444 file
EXAMPLE 3 Making a file readable and writable by the group and others
example% chmod go+rw file
example% chmod 066 file
EXAMPLE 5 Allowing everyone to read, write, and execute the file and turn on the set
group-ID
example% chmod a=rwx,g+s file
example% chmod 2777 file
ENVIRONMENT See environ(5) for descriptions of the following environment variables that affect the
VARIABLES execution of chmod: LANG, LC_ALL, LC_CTYPE, LC_MESSAGES, and NLSPATH.
Availability SUNWcsu
CSI enabled
NOTES Absolute changes do not work for the set-group-ID bit of a directory. You must use
g+s or g-s.
chmod permits you to produce useless modes so long as they are not illegal (for
instance, making a text file executable). chmod does not check the file type to see if
mandatory locking is meaningful.
If the filesystem is mounted with the nosuid option, setuid execution is not allowed.
138 man pages section 1: User Commands • Last Revised 4 Dec 2000
chown(1)
NAME chown – change file ownership
SYNOPSIS chown [-fhR] owner [: group] file…
DESCRIPTION The chown utility will set the user ID of the file named by each file to the user ID
specified by owner, and, optionally, will set the group ID to that specified by group.
If chown is invoked by other than the super-user, the set-user-ID bit is cleared.
Only the owner of a file (or the super-user) may change the owner of that file.
USAGE See largefile(5) for the description of the behavior of chown when encountering
files greater than or equal to 2 Gbyte ( 231 bytes).
To change ownership of all files in the hierarchy, including symbolic links, but not the
targets of the links:
example% chown −R −h owner[:group] file...
ENVIRONMENT See environ(5) for descriptions of the following environment variables that affect the
VARIABLES execution of chown: LANG, LC_ALL, LC_CTYPE, LC_MESSAGES, and NLSPATH.
Availability SUNWcsu
NOTES chown is CSI-enabled except for the owner and group names.
DESCRIPTION chown changes the owner of the filenames to owner. The owner may be either a decimal
user ID (UID) or a login name found in the password file. An optional group may also
be specified. The group may be either a decimal group ID (GID) or a group name
found in the GID file.
Only the super-user can change owner, in order to simplify accounting procedures.
OPTIONS -f Do not report errors.
-R Recursively descend into directories setting the ownership of all files in
each directory encountered. When symbolic links are encountered, their
ownership is changed, but they are not traversed.
USAGE See largefile(5) for the description of the behavior of chown when encountering
files greater than or equal to 2 Gbyte ( 231 bytes).
FILES /etc/passwd password file
Availability SUNWscpu
DESCRIPTION The ckdate utility prompts a user and validates the response. It defines, among other
things, a prompt message whose response should be a date, text for help and error
messages, and a default value (which will be returned if the user responds with a
RETURN). The user response must match the defined format for a date.
All messages are limited in length to 70 characters and are formatted automatically.
Any white space used in the definition (including newline) is stripped. The -W option
cancels the automatic formatting. When a tilde is placed at the beginning or end of a
message definition, the default text will be inserted at that point, allowing both
custom text and the default text to be displayed.
If the prompt, help or error message is not defined, the default message (as defined
under NOTES) will be displayed.
Three visual tool modules are linked to the ckdate command. They are errdate
(which formats and displays an error message), helpdate (which formats and
displays a help message), and valdate (which validates a response). These modules
should be used in conjunction with FML objects. In this instance, the FML object
defines the prompt. When format is defined in the errdate and helpdate
modules, the messages will describe the expected format.
142 man pages section 1: User Commands • Last Revised 14 Sep 1992
ckdate(1)
%y = year within century (for instance, 89)
%Y = year as CCYY (for instance, 1989)
-h help Defines the help messages as help.
-k pid Specifies that process ID pid is to be sent a signal if the user
chooses to abort.
-p prompt Defines the prompt message as prompt.
-Q Specifies that quit will not be allowed as a valid response.
-s signal Specifies that the process ID pid defined with the -k option is to be
sent signal signal when quit is chosen. If no signal is specified,
SIGTERM is used.
-W width Specifies that prompt, help and error messages will be formatted
to a line length of width.
Availability SUNWcsu
144 man pages section 1: User Commands • Last Revised 14 Sep 1992
ckgid(1)
NAME ckgid, errgid, helpgid, valgid – prompts for and validates a group id
SYNOPSIS ckgid [-Q] [-W width] [-m] [-d default] [-h help] [-e error] [-p prompt]
[-k pid [-s signal]]
/usr/sadm/bin/errgid [-W width] [-e error]
/usr/sadm/bin/helpgid [-W width] [-m] [-h help]
/usr/sadm/bin/valgid input
DESCRIPTION ckgid prompts a user and validates the response. It defines, among other things, a
prompt message whose response should be an existing group ID, text for help and
error messages, and a default value (which will be returned if the user responds with a
carriage return).
All messages are limited in length to 70 characters and are formatted automatically.
Any white space used in the definition (including newline) is stripped. The -W option
cancels the automatic formatting. When a tilde is placed at the beginning or end of a
message definition, the default text will be inserted at that point, allowing both
custom text and the default text to be displayed.
If the prompt, help or error message is not defined, the default message (as defined
under NOTES) will be displayed.
Three visual tool modules are linked to the ckgid command. They are errgid
(which formats and displays an error message), helpgid (which formats and displays
a help message), and valgid (which validates a response). These modules should be
used in conjunction with FML objects. In this instance, the FML object defines the
prompt.
Availability SUNWcsu
When the quit option is chosen (and allowed), q is returned along with the return code
3. The valgid module will not produce any output. It returns 0 for success and
non-zero for failure.
146 man pages section 1: User Commands • Last Revised 14 Sep 1992
ckint(1)
NAME ckint, errint, helpint, valint – display a prompt; verify and return an integer value
SYNOPSIS ckint [-Q] [-W width] [-b base] [-d default] [-h help] [-e error]
[-p prompt] [-k pid [-s signal]]
/usr/sadm/bin/errint [-W width] [-b base] [-e error]
/usr/sadm/bin/helpint [-W width] [-b base] [-h help]
/usr/sadm/bin/valint [-b base] input
DESCRIPTION The ckint utility prompts a user, then validates the response. It defines, among other
things, a prompt message whose response should be an integer, text for help and error
messages, and a default value (which will be returned if the user responds with a
carriage return).
All messages are limited in length to 70 characters and are formatted automatically.
Any white space used in the definition (including newline) is stripped. The -W option
cancels the automatic formatting. When a tilde is placed at the beginning or end of a
message definition, the default text will be inserted at that point, allowing both
custom text and the default text to be displayed.
If the prompt, help or error message is not defined, the default message (as defined
under NOTES) will be displayed.
Three visual tool modules are linked to the ckint command. They are errint
(which formats and displays an error message), helpint (which formats and displays
a help message), and valint (which validates a response). These modules should be
used in conjunction with FML objects. In this instance, the FML object defines the
prompt. When base is defined in the errint and helpint modules, the messages
will include the expected base of the input.
Availability SUNWcsu
The messages are changed from "integer" to "base base integer" if the base is set to a
number other than 10.
When the quit option is chosen (and allowed), q is returned along with the return code
3. The valint module will not produce any output. It returns 0 for success and
non-zero for failure.
148 man pages section 1: User Commands • Last Revised 14 Sep 1992
ckitem(1)
NAME ckitem, erritem, helpitem – build a menu; prompt for and return a menu item
SYNOPSIS ckitem [-Q] [-W width] [-uno] [-f filename] [-l label] [ [-i invis] [,…]]
[-m max] [-d default] [-h help] [-e error] [-p prompt] [-k pid
[-s signal]] [choice [...]]
/usr/sadm/bin/erritem [-W width] [-e error] [choice [..]]
/usr/sadm/bin/helpitem [-W width] [-h help] [choice [..]]
DESCRIPTION The ckitem utility builds a menu and prompts the user to choose one item from a
menu of items. It then verifies the response. Options for this command define, among
other things, a prompt message whose response will be a menu item, text for help and
error messages, and a default value (which will be returned if the user responds with a
carriage return).
By default, the menu is formatted so that each item is prepended by a number and is
printed in columns across the terminal. Column length is determined by the longest
choice. Items are alphabetized.
All messages are limited in length to 70 characters and are formatted automatically.
Any white space used in the definition (including newline) is stripped. The -W option
cancels the automatic formatting. When a tilde is placed at the beginning or end of a
message definition, the default text will be inserted at that point, allowing both
custom text and the default text to be displayed.
If the prompt, help or error message is not defined, the default message (as defined
under NOTES) will be displayed.
Two visual tool modules are linked to the ckitem command. They are erritem
(which formats and displays an error message) and helpitem (which formats and
displays a help message). These modules should be used in conjunction with FML
objects. In this instance, the FML object defines the prompt. When choice is defined in
these modules, the messages will describe the available menu choice (or choices).
Availability SUNWcsu
150 man pages section 1: User Commands • Last Revised 14 Sep 1992
ckitem(1)
NOTES The user may input the number of the menu item if choices are numbered or as much
of the string required for a unique identification of the item. Long menus are paged
with 10 items per page.
When menu entries are defined both in a file (by using the -f option) and also on the
command line, they are usually combined alphabetically. However, if the -n option is
used to suppress alphabetical ordering, then the entries defined in the file are shown
first, followed by the options defined on the command line.
One question mark will give a help message and then redisplay the prompt. Two
question marks will give a help message and then redisplay the menu label, the menu
and the prompt.
When the quit option is chosen (and allowed), q is returned along with the return code
3.
DESCRIPTION ckkeywd prompts a user and validates the response. It defines, among other things, a
prompt message whose response should be one of a list of keywords, text for help and
error messages, and a default value (which will be returned if the user responds with a
carriage return). The answer returned from this command must match one of the
defined list of keywords.
All messages are limited in length to 70 characters and are formatted automatically.
Any white space used in the definition (including newline) is stripped. The -W option
cancels the automatic formatting. When a tilde is placed at the beginning or end of a
message definition, the default text will be inserted at that point, allowing both
custom text and the default text to be displayed.
If the prompt, help or error message is not defined, the default message (as defined
under NOTES) will be displayed.
152 man pages section 1: User Commands • Last Revised 14 Sep 1992
ckkeywd(1)
3 User termination (quit).
Availability SUNWcsu
When the quit option is chosen (and allowed), q is returned along with the return code
3.
DESCRIPTION The ckpath utility prompts a user and validates the response. It defines, among other
things, a prompt message whose response should be a pathname, text for help and
error messages, and a default value (which is returned if the user responds with a
RETURN).
The pathname must obey the criteria specified by the first group of options. If no
criteria is defined, the pathname must be for a normal file that does not yet exist. If
neither -a (absolute) or -l (relative) is given, then either is assumed to be valid.
All messages are limited in length to 79 characters and are formatted automatically.
Tabs and newlines are removed after a single white space character in a message
definition, but spaces are not removed. When a tilde is placed at the beginning or end
of a message definition, the default text is inserted at that point, allowing both custom
text and the default text to be displayed.
If the prompt, help or error message is not defined, the default message (as defined
under EXAMPLES) is displayed.
Three visual tool modules are linked to the ckpath command. They are errpath
(which formats and displays an error message on the standard output), helppath
(which formats and displays a help message on the standard output), and valpath
(which validates a response). These modules should be used in conjunction with
Framed Access Command Environment (FACE) objects. In this instance, the FACE
object defines the prompt.
154 man pages section 1: User Commands • Last Revised 14 Sep 1992
ckpath(1)
-h help Defines the help message as help.
-k pid Specifies that process ID pid is to be sent a signal if the user
chooses to quit.
-l Pathname must be a relative path.
-n Pathname must not exist (must be new).
-o Pathname must exist (must be old).
-p prompt Defines the prompt message as prompt.
-Q Specifies that quit is not allowed as a valid response.
-r Pathname must be readable.
-s signal Specifies that the process ID pid defined with the -k option is to be
sent signal signal when quit is chosen. If no signal is specified,
SIGTERM is used.
-t Pathname must be creatable (touchable). Pathname will be created
if it does not already exist.
-w Pathname must be writable.
-W width Specify that prompt, help and error messages be formatted to a
line length of width.
-x Pathname must be executable.
-y Pathname must be a directory.
-z Pathname must have a file having a size greater than zero bytes.
EXAMPLES The text of the default messages for ckpath depends upon the criteria options that
have been used.
When the quit option is chosen (and allowed), q is returned along with the return code
3. Quit input gets a trailing newline.
The valpath module will produce a usage message on stderr. It returns 0 for success
and non-zero for failure.
example% /usr/sadm/bin/valpath
usage: valpath [-[a|l][b|c|f|y][n|[o|z]]rtwx] input
.
.
.
Availability SUNWcsu
156 man pages section 1: User Commands • Last Revised 14 Sep 1992
ckrange(1)
NAME ckrange, errange, helprange, valrange – prompts for and validates an integer
SYNOPSIS ckrange [-Q] [-W width] [-l lower] [-u upper] [-b base] [-d default]
[-h help] [-e error] [-p prompt] [-k pid [-s signal]]
/usr/sadm/bin/errange [-W width] [-e error] [-l lower] [-u upper]
[-b base]
/usr/sadm/bin/helprange [-W width] [-h help] [-l lower] [-u upper]
[-b base]
/usr/sadm/bin/valrange [-l lower] [-u upper] [-b base] input
DESCRIPTION The ckrange utility prompts a user for an integer between a specified range and
determines whether this response is valid. It defines, among other things, a prompt
message whose response should be an integer in the range specified, text for help and
error messages, and a default value (which is returned if the user responds with a
RETURN).
This command also defines a range for valid input. If either the lower or upper limit is
left undefined, then the range is bounded on only one end.
All messages are limited in length to 79 characters and are formatted automatically.
Tabs and newlines are removed after a single whitespace character in a message
definition, but spaces are not removed. When a tilde is placed at the beginning or end
of a message definition, the default text will be inserted at that point, allowing both
custom text and the default text to be displayed.
If the prompt, help or error message is not defined, the default message (as defined
under EXAMPLES) is displayed.
Three visual tool modules are linked to the ckrange command. They are errange
(which formats and displays an error message on the standard output), helprange
(which formats and displays a help message on the standard output), and valrange
(which validates a response). These modules should be used in conjunction with
Framed Access Command Environment (FACE) objects. In this instance, the FACE
object defines the prompt.
158 man pages section 1: User Commands • Last Revised 14 Sep 1992
ckrange(1)
EXAMPLE 4 Changing messages for a base other than 10
The messages are changed from ‘‘integer’’ to ‘‘base base integer’’ if the base is set to a
number other than 10. For example,
example% /usr/sadm/bin/helprange -b 36
When the quit option is chosen (and allowed), q is returned along with the return code
3. Quit input gets a trailing newline.
The valrange module will produce a usage message on stderr. It returns 0 for
success and non-zero for failure.
example% /usr/sadm/bin/valrange
usage: valrange [-l lower] [-u upper] [-b base] input
Availability SUNWcsu
DESCRIPTION The ckstr utility prompts a user and validates the response. It defines, among other
things, a prompt message whose response should be a string, text for help and error
messages, and a default value (which are returned if the user responds with a
RETURN).
The answer returned from this command must match the defined regular expression
and be no longer than the length specified. If no regular expression is given, valid
input must be a string with a length less than or equal to the length defined with no
internal, leading or trailing white space. If no length is defined, the length is not
checked.
All messages are limited in length to 79 characters and are formatted automatically.
Tabs and newlines are removed after a single white space character in a message
definition, but spaces are not removed. When a tilde is placed at the beginning or end
of a message definition, the default text will be inserted at that point, allowing both
custom text and the default text to be displayed.
If the prompt, help or error message is not defined, the default message (as defined
under EXAMPLES) is displayed.
Three visual tool modules are linked to the ckstr command. They are errstr
(which formats and displays an error message on the standard output), helpstr
(which formats and displays a help message on the standard output), and valstr
(which validates a response). These modules should be used in conjunction with
Framed Access Command Environment (FACE) objects. In this instance, the FACE
object defines the prompt.
160 man pages section 1: User Commands • Last Revised 14 Sep 1992
ckstr(1)
-p prompt Defines the prompt message as prompt.
-Q Specifies that quit will not be allowed as a valid response.
-r regexp Specifies a regular expression, regexp, against which the input
should be validated. May include white space. If multiple
expressions are defined, the answer need match only one of them.
-s signal Specifies that the process ID pid defined with the -k option is to be
sent signal signal when quit is chosen. If no signal is specified,
SIGTERM is used.
-W width Specifies that prompt, help and error messages will be formatted
to a line length of width.
The default error message is dependent upon the type of validation involved. The user
will be told either that the length or the pattern matching failed. The default error
message is:
example% /usr/sadm/bin/errstr
ERROR: Please enter a string which contains no embedded,
leading or trailing spaces or tabs.
The default help message is also dependent upon the type of validation involved. If a
regular expression has been defined, the message is:
example% /usr/sadm/bin/helpstr -r regexp
Please enter a string which matches the following pattern:
regexp
Other messages define the length requirement and the definition of a string.
When the quit option is chosen (and allowed), q is returned along with the return code
3. Quit input gets a trailing newline.
The valstr module will produce a usage message on stderr. It returns 0 for success
and non-zero for failure.
example% /usr/sadm/bin/valstr
usage: valstr [-l length] [[-r regexp] [ . . . ]] input
Availability SUNWcsu
162 man pages section 1: User Commands • Last Revised 14 Sep 1992
cksum(1)
NAME cksum – write file checksums and sizes
SYNOPSIS cksum [file…]
DESCRIPTION The cksum command calculates and writes to standard output a cyclic redundancy
check (CRC) for each input file, and also writes to standard output the number of
octets in each file.
For each file processed successfully, cksum will write in the following format:
If no file operand was specified, the path name and its leading space will be omitted.
The CRC used is based on the polynomial used for CRC error checking in the
referenced Ethernet standard.
The encoding for the CRC checksum is defined by the generating polynomial:
USAGE The cksum command is typically used to quickly compare a suspect file against a
trusted version of the same, such as to ensure that files transmitted over noisy media
arrive intact. However, this comparison cannot be considered cryptographically
secure. The chances of a damaged file producing the same CRC as the original are
astronomically small; deliberate deception is difficult, but probably not impossible.
See largefile(5) for the description of the behavior of cksum when encountering
files greater than or equal to 2 Gbyte ( 231 bytes).
ENVIRONMENT See environ(5) for descriptions of the following environment variables that affect the
VARIABLES execution of cksum: LANG, LC_ALL, LC_CTYPE, LC_MESSAGES, and NLSPATH.
Availability SUNWcsu
164 man pages section 1: User Commands • Last Revised 1 Feb 1995
cktime(1)
NAME cktime, errtime, helptime, valtime – display a prompt; verify and return a time of day
SYNOPSIS cktime [-Q] [-W width] [-f format] [-d default] [-h help] [-e error]
[-p prompt] [-k pid [-s signal]]
/usr/sadm/bin/errtime [-W width] [-e error] [-f format]
/usr/sadm/bin/helptime [-W width] [-h help] [-f format]
/usr/sadm/bin/valtime [-f format] input
DESCRIPTION The cktime utility prompts a user and validates the response. It defines, among other
things, a prompt message whose response should be a time, text for help and error
messages, and a default value (which is returned if the user responds with a
RETURN). The user response must match the defined format for the time of day.
All messages are limited in length to 70 characters and are formatted automatically.
Any white space used in the definition (including NEWLINE) is stripped. The -W
option cancels the automatic formatting. When a tilde is placed at the beginning or
end of a message definition, the default text is inserted at that point, allowing both
custom text and the default text to be displayed.
If the prompt, help or error message is not defined, the default message (as defined
under NOTES) is displayed.
Three visual tool modules are linked to the cktime command. They are errtime
(which formats and displays an error message), helptime (which formats and
displays a help message), and valtime (which validates a response). These modules
should be used in conjunction with FML objects. In this instance, the FML object
defines the prompt. When format is defined in the errtime and helptime
modules, the messages will describe the expected format.
Availability SUNWcsu
When the quit option is chosen (and allowed), q is returned along with the return code
3. The valtime module will not produce any output. It returns 0 for success and
non-zero for failure.
166 man pages section 1: User Commands • Last Revised 14 Sep 1992
ckuid(1)
NAME ckuid, erruid, helpuid, valuid – prompts for and validates a user ID
SYNOPSIS ckuid [-Q] [-W width] [-m] [-d default] [-h help] [-e error] [-p prompt]
[-k pid [-s signal]]
/usr/sadm/bin/erruid [-W width] [-e error]
/usr/sadm/bin/helpuid [-W width] [-m] [-h help]
/usr/sadm/bin/valuid input
DESCRIPTION The ckuid utility prompts a user and validates the response. It defines, among other
things, a prompt message whose response should be an existing user ID, text for help
and error messages, and a default value (which are returned if the user responds with
a RETURN).
All messages are limited in length to 70 characters and are formatted automatically.
Any white space used in the definition (including NEWLINE) is stripped. The -W
option cancels the automatic formatting. When a tilde is placed at the beginning or
end of a message definition, the default text is inserted at that point, allowing both
custom text and the default text to be displayed.
If the prompt, help or error message is not defined, the default message (as defined
under NOTES) is displayed.
Three visual tool modules are linked to the ckuid command. They are erruid
(which formats and displays an error message), helpuid (which formats and displays
a help message), and valuid (which validates a response). These modules should be
used in conjunction with FML objects. In this instance, the FML object defines the
prompt.
Availability SUNWcsu
When the quit option is chosen (and allowed), q is returned along with the return code
3. The valuid module will not produce any output. It returns 0 for success and
non-zero for failure.
168 man pages section 1: User Commands • Last Revised 14 Sep 1992
ckyorn(1)
NAME ckyorn, erryorn, helpyorn, valyorn – prompts for and validates yes/no
SYNOPSIS ckyorn [-Q] [-W width] [-d default] [-h help] [-e error] [-p prompt]
[-k pid [-s signal]]
/usr/sadm/bin/erryorn [-W width] [-e error]
/usr/sadm/bin/helpyorn [-W width] [-h help]
/usr/sadm/bin/valyorn input
DESCRIPTION ckyorn prompts a user and validates the response. It defines, among other things, a
prompt message for a yes or no answer, text for help and error messages, and a
default value (which is returned if the user responds with a RETURN).
All messages are limited in length to 70 characters and are formatted automatically.
Any white space used in the definition (including newline) is stripped. The -W option
cancels the automatic formatting. When a tilde is placed at the beginning or end of a
message definition, the default text is inserted at that point, allowing both custom text
and the default text to be displayed.
If the prompt, help or error message is not defined, the default message (as defined
under NOTES) is displayed.
Three visual tool modules are linked to the ckyorn command. They are erryorn
(which formats and displays an error message), helpyorn (which formats and
displays a help message), and valyorn (which validates a response). These modules
should be used in conjunction with FACE objects. In this instance, the FACE object
defines the prompt.
Availability SUNWcsu
When the quit option is chosen (and allowed), q is returned along with the return code
3. The valyorn module will not produce any output. It returns 0 for success and
non-zero for failure.
170 man pages section 1: User Commands • Last Revised 14 Sep 1992
clear(1)
NAME clear – clear the terminal screen
SYNOPSIS clear [term]
DESCRIPTION The clear utility clears the terminal screen if this is possible. It looks in the
environment for the terminal type, if this is not already specified by the term operand,
and then looks up the terminfo database to figure out how to clear the screen.
OPERANDS term Indicates the type of terminal. Normally, this operand is unnecessary
because the default is taken from the environment variable TERM.
Availability SUNWcsu
DESCRIPTION The cmp utility compares two files. cmp will write no output if the files are the same.
Under default options, if they differ, it writes to standard output the byte and line
numbers at which the first difference occurred. Bytes and lines are numbered
beginning with 1. If one file is an initial subsequence of the other, that fact is noted.
skip1 and skip2 are initial byte offsets into file1 and file2 respectively, and may be either
octal or decimal; a leading 0 denotes octal.
If both file1 and file2 refer to standard input or refer to the same FIFO special, block
special or character special file, an error results.
USAGE See largefile(5) for the description of the behavior of cmp when encountering files
greater than or equal to 2 Gbyte (231 bytes).
does a byte for byte comparison of file1 and file2. It skips the first 1024 bytes in file2
before starting the comparison.
ENVIRONMENT See environ(5) for descriptions of the following environment variables that affect the
VARIABLES execution of cmp: LANG, LC_ALL, LC_CTYPE, LC_MESSAGES, and NLSPATH.
172 man pages section 1: User Commands • Last Revised 1 Feb 1995
cmp(1)
ATTRIBUTES See attributes(5) for descriptions of the following attributes:
Availability SUNWcsu
CSI enabled
DESCRIPTION The col utility reads from the standard input and writes to the standard output. It
performs the line overlays implied by reverse line-feeds, and by forward and reverse
half-line-feeds. Unless -x is used, all blank characters in the input will be converted to
tab characters wherever possible. col is particularly useful for filtering multi-column
output made with the .rt command of nroff(1) and output resulting from use of the
tbl(1) preprocessor.
The ASCII control characters SO and SI are assumed by col to start and end text in an
alternative character set. The character set to which each input character belongs is
remembered, and on output SI and SO characters are generated as appropriate to
ensure that each character is written in the correct character set.
On input, the only control characters accepted are space, backspace, tab,
carriage-return and newline characters, SI, SO, VT, reverse line-feed, forward
half-line-feed and reverse half-line-feed. The VT character is an alternative form of full
reverse line-feed, included for compatibility with some earlier programs of this type.
The only other characters to be copied to the output are those that are printable.
The ASCII codes for the control functions and line-motion sequences mentioned above
are as given in the table below. ESC stands for the ASCII escape character, with the
octal code 033; ESC− means a sequence of two characters, ESC followed by the
character x.
OPTIONS -b Assume that the output device in use is not capable of backspacing. In this
case, if two or more characters are to appear in the same place, only the last
one read will be output.
-f Although col accepts half-line motions in its input, it normally does not
emit them on output. Instead, text that would appear between lines is
moved to the next lower full-line boundary. This treatment can be
suppressed by the -f (fine) option; in this case, the output from col may
contain forward half-line-feeds (ESC-9), but will still never contain either
kind of reverse line motion.
174 man pages section 1: User Commands • Last Revised 1 Feb 1995
col(1)
-p Normally, col will ignore any escape sequences unknown to it that are
found in its input; the -p option may be used to cause col to output these
sequences as regular characters, subject to overprinting from reverse line
motions. The use of this option is highly discouraged unless the user is
fully aware of the textual position of the escape sequences.
-x Prevent col from converting blank characters to tab characters on output
wherever possible. Tab stops are considered to be at each column position n
such that n modulo 8 equals 1.
ENVIRONMENT See environ(5) for descriptions of the following environment variables that affect the
VARIABLES execution of col: LC_CTYPE, LC_MESSAGES, and NLSPATH.
Availability SUNWesu
CSI enabled
NOTES The input format accepted by col matches the output produced by nroff with either
the -T37 or -Tlp options. Use -T37 (and the -f option of col) if the ultimate
disposition of the output of col will be a device that can interpret half-line motions,
and -Tlp otherwise.
col cannot back up more than 128 lines or handle more than 800 characters per line.
Local vertical motions that would result in backing up over the first line of the
document are ignored. As a result, the first line must not have any superscripts.
DESCRIPTION The comm utility will read file1 and file2, which should be ordered in the current
collating sequence, and produce three text columns as output: lines only in file1; lines
only in file2; and lines in both files.
If the input files were ordered according to the collating sequence of the current locale,
the lines written will be in the collating sequence of the original lines. If not, the
results are unspecified.
USAGE See largefile(5) for the description of the behavior of comm when encountering files
greater than or equal to 2 Gbyte ( 231 bytes).
would print a list of utilities in file1 not specified by either of the other files. The entry:
example% comm -12 file1 file2 | comm -12 - file3
would print a list of utilities specified by all three files. And the entry:
example% comm -12 file2 file3 | comm -23 -file1
would print a list of utilities specified by both file2 and file3, but not specified in file1.
ENVIRONMENT See environ(5) for descriptions of the following environment variables that affect the
VARIABLES execution of comm: LANG, LC_ALL, LC_COLLATE, LC_CTYPE, LC_MESSAGES, and
NLSPATH.
176 man pages section 1: User Commands • Last Revised 21 Feb 1996
comm(1)
>0 An error occurred.
Availability SUNWesu
CSI enabled
DESCRIPTION The command utility causes the shell to treat the arguments as a simple command,
suppressing the shell function lookup.
If the command_name is the same as the name of one of the special built-in utilities, the
special properties will not occur. In every other respect, if command_name is not the
name of a function, the effect of command will be the same as omitting command.
The command utility also provides information concerning how a command name will
be interpreted by the shell; see -v and -V.
178 man pages section 1: User Commands • Last Revised 1 Feb 1995
command(1)
■ Shell reserved words will be identified as reserved words.
EXAMPLES EXAMPLE 1 Make a version of cd that always prints out the new working directory exactly
once:
cd() {
command cd "$@" >/dev/null
pwd
}
EXAMPLE 2 Start off a ‘‘secure shell script’’ in which the script avoids being spoofed by its
parent:
IFS=’
’
# The preceding value should be <space><tab><newline>.
# Set IFS to its default value.
\unalias -a
# Unset all possible aliases.
# Note that unalias is escaped to prevent an alias
# being used for unalias.
unset -f command
# Ensure command is not a user function.
PATH="$(command -p getconf _CS_PATH):$PATH"
# Put on a reliable PATH prefix.
# . . .
At this point, given correct permissions on the directories called by PATH, the script
has the ability to ensure that any utility it calls is the intended one. It is being very
cautious because it assumes that implementation extensions may be present that
would allow user functions to exist when it is invoked. This capability is not specified
by this document, but it is not prohibited as an extension. For example, the ENV
variable precedes the invocation of the script with a user startup script. Such a script
could define functions to spoof the application.
ENVIRONMENT See environ(5) for descriptions of the following environment variables that affect the
VARIABLES execution of command: LANG, LC_ALL, LC_CTYPE, LC_MESSAGES, and NLSPATH.
PATH Determine the search path used during the command search, except as
described under the -p option.
EXIT STATUS When the -v or -V options are specified, the following exit values are returned:
0 Successful completion.
>0 The command_name could not be found or an error occurred.
Otherwise, the exit status of command will be that of the simple command specified by
the arguments to command.
Availability SUNWcsu
180 man pages section 1: User Commands • Last Revised 1 Feb 1995
compress(1)
NAME compress, uncompress, zcat – compress, uncompress files or display expanded files
SYNOPSIS compress [-fv] [-b bits] [file…]
compress [-cfv] [-b bits] [file]
uncompress [-cfv] [file…]
zcat [file…]
DESCRIPTION
compress The compress utility will attempt to reduce the size of the named files by using
adaptive Lempel-Ziv coding. Except when the output is to the standard output, each
file will be replaced by one with the extension .Z, while keeping the same ownership
modes, change times and modification times. If appending the .Z to the file pathname
would make the pathname exceed 1023 bytes, the command will fail. If no files are
specified, the standard input will be compressed to the standard output.
The amount of compression obtained depends on the size of the input, the number of
bits per code, and the distribution of common substrings. Typically, text such as source
code or English is reduced by 50−60%. Compression is generally much better than that
achieved by Huffman coding (as used in pack(1)) and it takes less time to compute.
The bits parameter specified during compression is encoded within the compressed
file, along with a magic number to ensure that neither decompression of random data
nor recompression of compressed data is subsequently allowed.
uncompress The uncompress utility will restore files to their original state after they have been
compressed using the compress utility. If no files are specified, the standard input
will be uncompressed to the standard output.
This utility supports the uncompressing of any files produced by compress. For files
produced by compress on other systems, uncompress supports 9- to 16-bit
compression (see -b).
zcat The zcat utility will write to standard output the uncompressed form of files that
have been compressed using compress. It is the equivalent of uncompress -c.
Input files are not affected.
USAGE See largefile(5) for the description of the behavior of compress, uncompress,
and zcat when encountering files greater than or equal to 2 Gbyte ( 231 bytes).
ENVIRONMENT See environ(5) for descriptions of the following environment variables that affect the
VARIABLES execution of compress, uncompress, and zcat: LANG, LC_ALL, LC_CTYPE,
LC_MESSAGES, and NLSPATH.
Availability SUNWesu
CSI Enabled
182 man pages section 1: User Commands • Last Revised 9 Sep 1999
compress(1)
file: not in compressed format
The file specified to uncompress has not been compressed.
file: compressed with xxbits, can only handle yybits
file was compressed by a program that could deal with more bits than the
compress code on this machine. Recompress the file with smaller bits.
file: already has . Z suffix -- no change
The file is assumed to be already compressed. Rename the file and try again.
file: already exists; do you wish to overwrite (y or n)?
Respond y if you want the output file to be replaced; n if not.
uncompress: corrupt input
A SIGSEGV violation was detected, which usually means that the input file is
corrupted.
Compression: xx.xx%
Percentage of the input saved by compression. (Relevant only for -v.)
– – not a regular file: unchanged
When the input file is not a regular file, (such as a directory), it is left unaltered.
– – has xx other links: unchanged
The input file has links; it is left unchanged. See ln(1) for more information.
– – file unchanged
No savings are achieved by compression. The input remains uncompressed.
filename too long to tack on .Z
The path name is too long to append the .Z suffix.
NOTES Although compressed files are compatible between machines with large memory, -b
12 should be used for file transfer to architectures with a small process data space
(64KB or less).
DESCRIPTION These co-processing functions provide a flexible means of interaction between FMLI
and an independent process; especially, they enable FMLI to be responsive to
asynchronous activity.
The cosend function sends string to the co-process identified by proc_id via the pipe
set up by cocreate (optionally wpath), where proc_id can be either the command or id
specified in cocreate. By default, cosend blocks, waiting for a response from the
co-process. Also by default, FMLI does not send a send_string and does not expect an
expect_string (except a newline). That is, it reads only one line of output from the
co-process. If -e expect_string was not defined when the pipe was created, then the
output of the co-process is any single string followed by a newline: any other lines of
output remain on the pipe. If the -e option was specified when the pipe was created,
cosend reads lines from the pipe until it reads a line starting with expect_string. All
lines except the line starting with expect_string become the output of cosend.
The cocheck function determines if input is available from the process identified by
proc_id, where proc_id can be either the command or id specified in cocreate. It
returns a Boolean value, which makes cocheck useful in if statements and in other
backquoted expressions in Boolean descriptors. cocheck receives no input from the
co-process; it simply indicates if input is available from the co-process. You must use
coreceive to actually accept the input. The cocheck function can be called from a
reread descriptor to force a frame to update when new data is available. This is
useful when the default value of a field in a form includes coreceive.
The coreceive function is used to read input from the co-process identified by
proc_id, where proc_id can be either the command or id specified in cocreate. It should
only be used when it has been determined, using cocheck, that input is actually
available. If the -e option was used when the co-process was created, coreceive will
continue to return lines of input until expect_string is read. At this point, coreceive
will terminate. The output of coreceive is all the lines that were read excluding the
184 man pages section 1: User Commands • Last Revised 5 Jul 1990
coproc(1F)
line starting with expect_string . If the -e option was not used in the cocreate, each
invocation of coreceive will return exactly one line from the co-process. If no input
is available when coreceive is invoked, it will simply terminate without producing
output.
The codestroy function terminates the read/write pipes to proc-id, where proc_id can
be either the command or id specified in cocreate. It generates a SIGPIPE signal to
the (child) co-process. This kills the co-process, unless the co-process ignores the
SIGPIPE signal. If the co-process ignores the SIGPIPE, it will not die, even after the
FMLI process terminates (the parent process id of the co-process will be 1).
The optional argument string is sent to the co-process before the co-process dies. If
string is not supplied, a NULL string is passed, followed by the normal send_string
(newline by default). That is, codestroy will call cosend proc_id string: this implies
that codestroy will write any output generated by the co-process to stdout. For
example, if an interactive co-process is written to expect a "quit" string when the
communication is over, the close descriptor could be defined; close=‘codestroy
ID ’quit’ | message‘ and any output generated by the co-process when the
string quit is sent to it via codestroy (using cosend) would be redirected to the
message line.
The codestroy function should usually be given the -R option, since you may have
more than one process with the same name, and you do not want to kill the wrong
one. codestroy keeps track of the number of refnames you have assigned to a process
with cocreate, and when the last instance is killed, it kills the process (id) for you.
codestroy is typically called as part of a close descriptor because close is
evaluated when a frame is closed. This is important because the co-process will
continue to run if codestroy is not issued.
When writing programs to use as co-processes, the following tips may be useful. If the
co-process program is written in C language, be sure to flush output after writing to
the pipe. (Currently, awk(1) and sed(1) cannot be used in a co-process program
because they do not flush after lines of output.) Shell scripts are well-mannered, but
slow. C language is recommended. If possible, use the default send_string, rpath and
wpath. In most cases, expect_string will have to be specified. This, of course, depends
on the co-process.
186 man pages section 1: User Commands • Last Revised 5 Jul 1990
coproc(1F)
EXAMPLES EXAMPLE 1 Sample commands
.
.
.
init=‘cocreate -i BIGPROCESS initialize‘
close=‘codestroy BIGPROCESS‘
.
.
.
reread=‘cocheck BIGPROCESS‘
Availability SUNWcsu
NOTES If cosend is used without the -n option, a co-process that does not answer will cause
FMLI to permanently hang.
DESCRIPTION In the first synopsis form, neither source_file nor target_file are directory files, nor can
they have the same name. The cp utility will copy the contents of source_file to the
destination path named by target_file. If target_file exists, cp will overwrite its contents,
but the mode (and ACL if applicable), owner, and group associated with it are not
changed. The last modification time of target_file and the last access time of source_file
are set to the time the copy was made. If target_file does not exist, cp creates a new file
named target_file that has the same mode as source_file except that the sticky bit is not
set unless the user is super-user. In this case, the owner and group of target_file are
those of the user, unless the setgid bit is set on the directory containing the newly
created file. If the directory’s setgid bit is set, the newly created file will have the
group of the containing directory rather than of the creating user. If target_file is a link
to another file, cp will overwrite the link destination with the contents of source_file;
the link(s) from target_file will remain.
In the second synopsis form, one or more source_files are copied to the directory
specified by target. For each source_file specified, a new file with the same mode (and
ACL if applicable), is created in target; the owner and group are those of the user
making the copy. It is an error if any source_file is a file of type directory, if target either
does not exist or is not a directory.
In the third synopsis form, one or more directories specified by source_dir are copied to
the directory specified by target. Either -r or -R must be specified. For each source_dir,
cp will copy all files and subdirectories.
OPTIONS The following options are supported for both /usr/bin/cp and
/usr/xpg4/bin/cp:
-f Unlink. If a file descriptor for a destination file cannot be obtained, attempt
to unlink the destination file and proceed.
-i Interactive. cp will prompt for confirmation whenever the copy would
overwrite an existing target. A y answer means that the copy should
proceed. Any other answer prevents cp from overwriting target.
-r Recursive. cp will copy the directory and all its files, including any
subdirectories and their files to target.
-R Same as -r, except pipes are replicated, not read from.
188 man pages section 1: User Commands • Last Revised 6 Jun 2001
cp(1)
-@ Preserves extended attributes. cp will attempt to copy all of the source
file’s extended attributes along with the file data to the destination file.
In order to preserve the owner and group id, permission modes, and
modification and access times, users must have the appropriate file access
permissions. This includes being superuser or the same owner id as the
destination file.
In order to preserve the owner and group id, permission modes, and
modification and access times, users must have the appropriate file access
permissions. This includes being superuser or the same owner id as the
destination file.
USAGE See largefile(5) for the description of the behavior of cp when encountering files
greater than or equal to 2 Gbyte ( 231 bytes).
example% ls goodies*
goodies goodies.old
EXAMPLE 3 Copying a directory, first to a new, and then to an existing destination directory
example% ls ~/bkup
/usr/example/fred/bkup not found
example% ls -R ~/bkup
x.c y.c z.sh
example% ls -R ~/bkup
src x.c y.c z.sh
src:
x.c y.c z.s
ENVIRONMENT See environ(5) for descriptions of the following environment variables that affect the
VARIABLES execution of cp: LANG, LC_ALL, LC_COLLATE, LC_CTYPE, LC_MESSAGES, and
NLSPATH.
Availability SUNWcsu
CSI Enabled
Availability SUNWxcu4
190 man pages section 1: User Commands • Last Revised 6 Jun 2001
cp(1)
CSI Enabled
NOTES The permission modes of the source file are preserved in the copy.
A -- permits the user to mark the end of any command line options explicitly, thus
allowing cp to recognize filename arguments that begin with a -.
DESCRIPTION The cpio command copies files into and out of a cpio archive. The cpio archive may
span multiple volumes. The -i, -o, and -p options select the action to be performed.
The following list describes each of the actions. These actions are mutually exclusive.
Copy In Mode cpio -i (copy in) extracts files from the standard input, which is assumed to be the
product of a previous cpio -o command. Only files with names that match one of the
patterns are selected. See sh(1) and OPERANDS for more information about pattern.
Extracted files are conditionally copied into the current directory tree, based on the
options described below. The permissions of the files will be those of the previous
cpio -o command. The owner and group will be the same as the current user, unless
the current user is the super-user. If this is the case, owner and group will be the same
as those resulting from the previous cpio -o command. Notice that if cpio -i tries
to create a file that already exists and the existing file is the same age or younger
(newer), cpio will output a warning message and not replace the file. The -u option
can be used to unconditionally overwrite the existing file.
Copy Out Mode cpio -o (copy out) reads a list of file path names from the standard input and copies
those files to the standard output, together with path name and status information in
the form of a cpio archive. Output is padded to an 8192-byte boundary by default or
to the user-specified block size (with the -B or -C options) or to some
device-dependent block size where necessary (as with the CTC tape).
Pass Mode cpio -p (pass) reads a list of file path names from the standard input and
conditionally copies those files into the destination directory tree, based on the options
described below.
If, when writing to a character device (-o) or reading from a character device (-i),
cpio reaches the end of a medium (such as the end of a diskette), and the -O and -I
options are not used, cpio prints the following message:
To continue, type device/file name when ready.
To continue, you must replace the medium and type the character special device name
(/dev/rdiskette for example) and press RETURN. You may want to continue by
directing cpio to use a different device. For example, if you have two floppy drives
you may want to switch between them so cpio can proceed while you are changing
the floppies. Press RETURN to cause the cpio process to exit.
192 man pages section 1: User Commands • Last Revised 22 Oct 2001
cpio(1)
-i (copy in) Reads an archive from the standard input and
conditionally extracts the files contained in it and places them into
the current directory tree.
-o (copy out) Reads a list of file path names from the standard input
and copies those files to the standard output in the form of a cpio
archive.
-p (pass) Reads a list of file path names from the standard input and
conditionally copies those files into the destination directory tree.
The following options can be appended in any sequence to the -i, -o, or -p options:
-a Resets access times of input files after they have been copied,
making cpio’s access invisible. Access times are not reset for
linked files when cpio -pla is specified.
-A Appends files to an archive. The -A option requires the -O option.
Valid only with archives that are files, or that are on floppy
diskettes or hard disk partitions. The effect on files that are linked
in the existing portion of the archive is unpredictable.
-b Reverses the order of the bytes within each word. Use only with
the -i option.
-B Blocks input/output 5120 bytes to the record. The default buffer
size is 8192 bytes when this and the -C options are not used. -B
does not apply to the -p (pass) option.
-c Reads or writes header information in ASCII character form for
portability. There are no UID or GID restrictions associated with
this header format. Use this option between SVR4-based machines,
or the -H odc option between unknown machines. The -c option
implies the use of expanded device numbers, which are only
supported on SVR4-based systems. When transferring files
between SunOS 4 or Interactive UNIX and the Solaris 2.6
Operating environment or compatible versions, use -H odc.
-C bufsize Blocks input/output bufsize bytes to the record, where bufsize is
replaced by a positive integer. The default buffer size is 8192 bytes
when this and -B options are not used. -C does not apply to the
-p (pass) option.
-d Creates directories as needed.
-E file Specifies an input file (file) that contains a list of filenames to be
extracted from the archive (one filename per line).
-f Copies in all files except those in patterns. See OPERANDS for a
description of pattern.
Files with UIDs and GIDs greater than the limit stated above will
be archived with the UID and GID of 60001. To transfer a large
file (8 Gb — 1 byte), the header format can be tar|TAR,
ustar|USTAR, or odc only.
-I file Reads the contents of file as an input archive, instead of the
standard input. If file is a character special device, and the current
194 man pages section 1: User Commands • Last Revised 22 Oct 2001
cpio(1)
medium has been completely read, replace the medium and press
RETURN to continue to the next medium. This option is used only
with the -i option.
-k Attempts to skip corrupted file headers and I/O errors that may be
encountered. If you want to copy files from a medium that is
corrupted or out of sequence, this option lets you read only those
files with good headers. For cpio archives that contain other cpio
archives, if an error is encountered, cpio may terminate
prematurely. cpio will find the next good header, which may be
one for a smaller archive, and terminate when the smaller
archive’s trailer is encountered. Use only with the -i option.
-l In pass mode, makes hard links between the source and
destination whenever possible. If the -L option is also specified,
the hard link will be to the file referred to by the symbolic link.
Otherwise, the hard link will be to the symbolic link itself. Use
only with the -p option.
-L Follows symbolic links. If a symbolic link to a directory is
encountered, archives the directory referred to by the link, using
the name of the link. Otherwise, archives the file referred to by the
link, using the name of the link.
-m Retains previous file modification time. This option is ineffective
on directories that are being copied.
-M message Defines a message to use when switching media. When you use the
-O or -I options and specify a character special device, you can
use this option to define the message that is printed when you
reach the end of the medium. One %d can be placed in message to
print the sequence number of the next medium needed to
continue.
-O file Directs the output of cpio to file, instead of the standard output. If
file is a character special device and the current medium is full,
replace the medium and type a carriage return to continue to the
next medium. Use only with the -o option.
-P Preserves ACLs. If the option is used for output, existing ACLs are
written along with other attributes, except for extended attributes,
to the standard output. ACLs are created as special files with a
special file type. If the option is used for input, existing ACLs are
extracted along with other attributes from standard input. The
option recognizes the special file type. Notice that errors will occur
if a cpio archive with ACLs is extracted by previous versions of
cpio. This option should not be used with the -c option, as ACL
support may not be present on all systems, and hence is not
portable. Use ASCII headers for portability.
196 man pages section 1: User Commands • Last Revised 22 Oct 2001
cpio(1)
? Matches any single character.
[ . . . ]Matches any one of the enclosed characters. A pair of
characters separated by ‘−’ matches any symbol
between the pair (inclusive), as defined by the system
default collating sequence. If the first character
following the opening ‘[’ is a ‘!’, the results are
unspecified.
! The ! (exclamation point) means not. For example, the
!abc* pattern would exclude all files that begin with
abc.
USAGE See largefile(5) for the description of the behavior of cpio when encountering files
greater than or equal to 2 Gbyte ( 231 bytes).
When standard input is directed through a pipe to cpio -o, as in the example above,
it groups the files so they can be directed (>) to a single file (../newfile). The -c
option insures that the file will be portable to other machines (as would the -H
option). Instead of ls(1), you could use find(1), echo(1), cat(1), and so on, to pipe a
list of names to cpio. You could direct the output to a device instead of a file.
In this example, cpio -i uses the output file of cpio -o (directed through a pipe
with cat), extracts those files that match the patterns (memo/a1, memo/b*), creates
directories below the current directory as needed (-d option), and places the files in
the appropriate directories. The -c option is used if the input file was created with a
portable header. If no patterns were given, all files from newfile would be placed in
the directory.
In this example, cpio -p takes the file names piped to it and copies or links (-l
option) those files to another directory, newdir. The -d option says to create
directories as needed. The -m option says to retain the modification time. (It is
important to use the -depth option of find(1) to generate path names for cpio. This
eliminates problems that cpio could have trying to create files under read-only
directories.) The destination directory, newdir, must exist.
Notice that when you use cpio in conjunction with find, if you use the -L option
with cpio, you must use the -follow option with find and vice versa. Otherwise,
there will be undesirable results.
For multi-reel archives, dismount the old volume, mount the new one, and continue to
the next tape by typing the name of the next device (probably the same as the first
reel). To stop, type a RETURN and cpio will end.
ENVIRONMENT See environ(5) for descriptions of the following environment variables that affect the
VARIABLES execution of cpio: LC_COLLATE, LC_CTYPE, LC_MESSAGES, LC_TIME, TZ, and
NLSPATH.
TMPDIR cpio creates its temporary file in /var/tmp by default.
Otherwise, it uses the directory specified by TMPDIR.
Availability SUNWcsu
CSI Enabled
SEE ALSO ar(1), cat(1), echo(1), find(1), ls(1), setfacl(1), sh( 1), tar(1), vold(1M),
archives(4), attributes(5), environ(5), fsattr(5), largefile(5),
standards(5)
NOTES The maximum path name length allowed in a cpio archive is determined by the
header type involved. The following table shows the proper value for each supported
archive header type.
198 man pages section 1: User Commands • Last Revised 22 Oct 2001
cpio(1)
When the command line options “-o -H tar” are specified, the archive created is of
type USTAR. This means that it is an error to read this same archive using the
command line options “-i -H tar”. The archive should be read using the command
line options “-i -H ustar”. The options "-i -H tar" refer to an older tar archive format.
An error message is output for files whose UID or GID are too large to fit in the
selected header format. Use -H crc or -c to create archives that allow all UID or GID
values.
If a file has 000 permissions, contains more than 0 characters of data, and the user is
not root, the file will not be saved or restored.
You must use the same blocking factor when you retrieve or copy files from the tape to
the hard disk as you did when you copied files from the hard disk to the tape.
Therefore, you must specify the -B or -C option.
During -p and -o processing, cpio buffers the file list presented on stdin in a
temporary file.
DESCRIPTION cpp is the C language preprocessor. It is invoked as the first pass of any C compilation
started with the cc(1B) command. However, cpp can also be used as a first-pass
preprocessor for other Sun compilers.
Although cpp can be used as a macro processor, this is not normally recommended, as
its output is geared toward that which would be acceptable as input to a compiler’s
second pass. Thus, the preferred way to invoke cpp is through the cc(1B) command,
or some other compilation command. For general-purpose macro-processing, see
m4(1).
cpp optionally accepts two filenames as arguments. input-file and output-file are,
respectively, the input and output files for the preprocessor. They default to the
standard input and the standard output.
200 man pages section 1: User Commands • Last Revised 1 Nov 1999
cpp(1)
-Dname Defines name as 1 (one). This is the same as if a -Dname=1 option
appeared on the cpp command line, or as if a
#define name 1
The symbols sun, sparc and unix are defined for all Sun
systems.
-Ydirectory Uses directory in place of the standard list of directories when
searching for #include files.
USAGE
Directives All cpp directives start with a hash symbol (#) as the first character on a line. White
space (SPACE or TAB characters) can appear after the initial # for proper indentation.
The precedence of these operators is the same as that for C. In addition, the unary
operator defined, can be used in constant-expression in these two forms: ‘defined
( name )’ or ‘defined name’. This allows the effect of #ifdef and #ifndef
directives (described below) in the #if directive. Only these operators, integer
constants, and names that are known by cpp should be used within
constant-expression. In particular, the size of operator is not available.
#ifdef name
Subsequent lines up to the matching #else, #elif, or #endif appear in the
output only if name has been defined, either with a #define directive or a -D
option, and in the absence of an intervening #undef directive. Additional tokens
after name on the directive line will be silently ignored.
202 man pages section 1: User Commands • Last Revised 1 Nov 1999
cpp(1)
#ifndef name
Subsequent lines up to the matching #else, #elif, or #endif appear in the
output only if name has not been defined, or if its definition has been removed with
an #undef directive. No additional tokens are permitted on the directive line after
name.
#elif constant-expression
Any number of #elif directives may appear between an #if, #ifdef, or
#ifndef directive and a matching #else or #endif directive. The lines following
the #elif directive appear in the output only if all of the following conditions
hold:
■ The constant-expression in the preceding #if directive evaluated to zero, the
name in the preceding #ifdef is not defined, or the name in the preceding
#ifndef directive was defined.
■ The constant-expression in all intervening #elif directives evaluated to zero.
■ The current constant-expression evaluates to non-zero.
Macros Formal parameters for macros are recognized in #define directive bodies, even when
they occur inside character constants and quoted strings. For instance, the output
from:
#define abc(a)| ‘|a|
abc(xyz)
is:
# 1 ""
| ‘|xyz |
The second line is a NEWLINE. The last seven characters are ‘‘|‘|xyz|’’ (vertical-bar,
backquote, vertical-bar, x, y, z, vertical-bar). Macro names are not recognized within
character constants or quoted strings during the regular scan. Thus:
#define abc xyz
printf("abc");
produces abc. The token appearing immediately after an #ifdef or #ifndef is not
expanded.
Macros are not expanded during the scan which determines the actual parameters to
another macro call. Thus:
#define reverse(first,second)second first
#define greeting hello
reverse(greeting,
#define greeting goodbye
)
Output Output consists of a copy of the input file, with modifications, plus lines of the form:
#lineno " filename" "level"
indicating the original source line number and filename of the following output line
and whether this is the first such line after an include file has been entered (level=1),
the first such line after an include file has been exited (level=2), or any other such line
(level is empty).
Directory Search #include files are searched for in the following order:
Order
1. The directory of the file that contains the #include request (that is, #include is
relative to the file being scanned when the request is made).
2. The directories specified by -I options, in left-to-right order.
3. The standard directory(s) (/usr/include on UNIX systems).
Special Names Two special names are understood by cpp. The name _ _LINE_ _ is defined as the
current line number (a decimal integer) as known by cpp, and _ _FILE_ _ is defined
as the current filename (a C string) as known by cpp. They can be used anywhere
(including in macros) just as any other defined name.
Newline Characters A NEWLINE character terminates a character constant or quoted string. An escaped
NEWLINE (that is, a backslash immediately followed by a NEWLINE) may be used in
the body of a #define statement to continue the definition onto the next line. The
escaped NEWLINE is not included in the macro value.
204 man pages section 1: User Commands • Last Revised 1 Nov 1999
cpp(1)
Comments Comments are removed (unless the -C option is used on the command line).
Comments are also ignored, except that a comment terminates a token.
Availability SUNWsprot
DIAGNOSTICS The error messages produced by cpp are intended to be self-explanatory. The line
number and filename where the error occurred are printed along with the diagnostic.
NOTES When NEWLINE characters were found in argument lists for macros to be expanded,
some previous versions of cpp put out the NEWLINE characters as they were found
and expanded. The current version of cpp replaces them with SPACE characters.
Because the standard directory for included files may be different in different
environments, this form of #include directive:
#include <file.h>
While the compiler allows 8-bit strings and comments, 8-bits are not allowed
anywhere else.
DESCRIPTION The cputrack utility allows CPU performance counters to be used to monitor the
behavior of a process or family of processes running on the system. If interval is
specified with the -T option, cputrack samples activity every interval seconds,
repeating forever. If a count is specified with the -N option, the statistics are repeated
count times for each process tracked. If neither are specified, an interval of one second
is used. If command and optional args are specified, cputrack runs the command with
the arguments given while monitoring the specified CPU performance events.
Alternatively, the process ID of an existing process can be specified using the -p
option.
206 man pages section 1: User Commands • Last Revised 10 Jul 2002
cputrack(1)
-o outfile Specifies file to be used for the cputrack output.
-p pid Interprets the argument as the process ID of an existing process to
which process counter context should be attached and monitored.
-t Prints an additional column of processor cycle counts, if available
on the current architecture.
-T interval Specifies the interval between CPU performance counter samples
in seconds. Very small intervals may cause some samples to be
skipped. See WARNINGS.
-v Enables more verbose output.
USAGE The operating system enforces certain restrictions on the tracing of processes. In
particular, a command whose object file cannot be read by a user cannot be tracked by
that user; set-uid and set-gid commands can only be tracked by a privileged user.
Unless it is run by a privileged user, cputrack loses control of any process that
performs an exec() of a set-id or unreadable object file. Such processes continue
normally, though independently of cputrack, from the point of the exec().
The system may run out of per-user process slots when the -f option is used, since
cputrack runs one controlling process for each process being tracked.
The times printed by cputrack correspond to the wallclock time when the hardware
counters were actually sampled, instead of when the program told the kernel to
sample them. The time is derived from the same timebase as gethrtime(3C).
The cputrack utility attaches performance counter context to each process that it
examines. The presence of this context allows the performance counters to be
multiplexed between different processes on the system, but it cannot be used at the
same time as the cpustat(1M) utility.
Once an instance of the cpustat utility is running, further attempts to run cputrack
will fail until all instances of cpustat terminate.
The processor cycle counts enabled by the -t option always apply to both user and
system modes, regardless of the settings applied to the performance counter registers.
EXAMPLES
This example shows more verbose output while following the fork() and exec() of
a simple shell script on an UltraSPARC machine. The counters are measuring the
number of external cache references and external cache hits. Notice that the explicit
pic0 and pic1 names can be omitted where there are no ambiguities.
example% cputrack –fev –c EC_ref,EC_hit /bin/ulimit –c
time pid lwp event pic0 pic1
0.032 101200 1 init_lwp 0 0
0.106 101200 1 fork # 101201
0.115 101201 1 init_lwp 0 0
0.179 101201 1 fini_lwp 5934 5031
0.179 101201 1 exec 5934 5031
0.399 101201 1 exec # ’basename /bin/ulimit’
0.413 101201 1 init_lwp 0 0
0.435 101201 1 fini_lwp 19780 17234
0.435 101201 1 exit 19780 17234 unlimited
0.454 101200 1 fini_lwp 63025 54583
0.454 101200 1 exit 63025 54583
208 man pages section 1: User Commands • Last Revised 10 Jul 2002
cputrack(1)
x86 EXAMPLE 3 Counting instructions
This example shows how many instructions were executed in the application and in
the kernel to print the date on a Pentium machine:
example% cputrack –c inst_retired,inst_retired,nouser1,sys1 date
time lwp event pic0 pic1
Fri Aug 20 20:03:08 PDT 1999
0.072 1 exit 246725 339666
WARNINGS By running any instance of the cpustat(1M) utility, all existing performance counter
context is forcibly invalidated across the machine. This may in turn cause all
invocations of the cputrack command to exit prematurely with unspecified errors.
This error message implies that cpc_access() has failed and is documented in
cpc_access(3CPC). Review this documentation for more information about the
problem and possible solutions.
If a short interval is requested, cputrack may not be able to keep up with the desired
sample rate. In this case, some samples may be dropped.
SUNWcpcux (64-bit)
SEE ALSO nawk(1), perl(1), proc(1), truss(1), prstat(1M), cpustat(1M), exec(2), exit(2),
fork(2), setuid(2), vfork(2), gethrtime(3C), cpc(3CPC), cpc_access(3CPC),
cpc_count_usr_events(3CPC), cpc_strtoevent(3CPC), libcpc(3LIB),
libpctx(3LIB), proc(4), attributes(5)
DESCRIPTION The crle utility provides for the creation and display of a runtime linking
configuration file. Without any arguments, or with just the -c option, crle displays
the contents of a configuration file, any system defaults and the command-line
required to regenerate the configuration file. When used with any other options, a new
configuration file is created or updated. The configuration file is read and interpreted
by the runtime linker, ld.so.1(1), during process start-up.
210 man pages section 1: User Commands • Last Revised 10 Oct 2001
crle(1)
runtime. These alternate objects may be supplied by
the user, or can be created by crle as copies of shared
objects fixed to known memory locations. These fixed
alternative objects can require less processing at
runtime than their original shared object counterpart.
Environment Variables Any environment variable interpreted by the runtime
linker can be specified within the configuration file.
The directory cache and crle generated alternate objects can provide a means of
reducing the runtime start-up overhead of applications that require many
dependencies, or whose dependencies are expensive to relocate (this may be the case
when shared objects contain position-dependent code).
When alternate objects generated by crle are specified within a configuration file,
ld.so.1(1) performs some minimal consistency verification of the alternative objects
against their originating objects. This verification is intended to avert application
failure should an applications configuration information become out-of-sync with the
underlying system components. When this situation arises the flexibility offered by
dynamic linking system components may be compromised, and diagnosing the
application failure may be difficult. Note: No verification of directory cache
information is performed. Any changes to the directory structure will not be seen by a
process until the cache is rebuilt.
System shared objects are often well tuned and may have no benefit being cached. The
directory cache and alternative object features are typically applicable to user
applications and shared objects.
crle creates alternate objects for the shared objects discovered when using the -I and
-G options by calls to dldump(3DL). The alternate object is created in the directory
specified by the preceding -o option, or defaults to the directory in which the
configuration file is created. The flags used for the dldump() are specified using the
-f option, or default to RTLD_REL_RELATIVE.
212 man pages section 1: User Commands • Last Revised 10 Oct 2001
crle(1)
environment definition. Any definition established in a
configuration file can not be suppressed by a null-value
process environment definition.
214 man pages section 1: User Commands • Last Revised 10 Oct 2001
crle(1)
Use of this option replaces the system default trusted
directories, and thus it is normally required that a -s
option be used to specify the original system default in
relation to any new directories being applied. However,
if the -u option is in effect, and a configuration file
does not exist, the system defaults are added to the new
configuration file before the new directories specified
with the -s option.
-t ELF | AOUT This option toggles the object type applicable to any -l
or -s options that follow. The default object type is
ELF.
-u This option requests that a configuration file be
updated, possibly with the addition of new
information. Without other options any existing
configuration file is inspected and its contents
recomputed. Additional arguments allow information
to be appended to the recomputed contents. See
NOTES.
EXAMPLES EXAMPLE 1 Update (and display) of a new default search path for ELF objects
example% crle -u -l /local/lib
example% crle
Command line:
crle -l /usr/lib:/local/lib
example% crle -u -l /usr/local/lib
example% crle
Command line:
crle -l /usr/lib:/local/lib:/usr/local/lib
In this example, the default configuration file initially did not exist, and thus the new
search path /local/lib is appended to the system default. The next update appends
the search path /usr/local/lib to those already established in the configuration
file.
EXAMPLE 2 Creation (and display) of a new default search path and new trusted directory
for ELF objects
example% crle -l /local/lib -l /usr/lib -s /local/lib
example% crle
Command line:
crle -l /local/lib:/usr/lib -s /local/lib
With this configuration, third party applications may be installed in /local/bin and
their associated dependencies in /local/lib. The default search path allows the
applications to locate their dependencies without the need to set LD_LIBRARY_PATH.
Note: The system default trusted directory has been replaced with this example.
216 man pages section 1: User Commands • Last Revised 10 Oct 2001
crle(1)
EXAMPLE 3 Creation of a directory cache for ELF objects (Continued)
....
find object=libc.so.1; required by ./main
search path=/usr/dt/lib:/usr/openwin/lib (RPATH ./main)
search path=/usr/lib (default)
trying path=/usr/lib/libc.so.1
libc.so.1 => /usr/lib/libc.so.1
With this configuration, the cache reflects that the system library libc.so.1 does not
exist in the directories /usr/dt/lib or /usr/openwin/lib. Therefore, the search
for this system file ignores these directories even though the application’s runpath
indicates they should be searched.
With this configuration, a new xterm and its dependencies are created. These new
objects are fully relocated to themselves and result in faster start-up than the
originating objects. Note: The execution of this application uses its own specific
configuration file. This model is generally more flexible than using the environment
variable LD_CONFIG, as the configuration file will not be erroneously used by other
applications such as ldd(1) or truss(1).
Directory: /usr/lib
libcurses.so.1 (alternate: /usr/ucblib/libcurses.so.1)
....
.....
example% LD_DEBUG=files LD_PRELOAD=preload.so.2 ./main
.....
18764: file=preload.so.2; preloaded
18764: file=/local/lib/preload.so.2 [ ELF ]; generating link map
.....
18764: file=preload.so.1; preloaded
18764: file=/local/lib/preload.so.1 [ ELF ]; generating link map
.....
With this configuration file, a replaceable search path has been specified together with
a permanent preload object which becomes appended to the process environment
definition.
EXIT STATUS The creation or display of a configuration file results in a 0 being returned; otherwise
any error condition is accompanied with a diagnostic message and a non-zero value
being returned.
NOTES Tagging an alternative application to use an application specific configuration file can
only be achieved if the original application contains one of the .dynamic tags
DT_FLAGS_1 or DT_FEATURE_1. Without these entries any application specific
configuration file must be specified using the LD_CONFIG environment variable. Care
should be exercised with this latter method as this environment variable will be visible
to any forked applications.
The use of the -u option requires at least version 2 of crle. This version level is
evident from displaying the contents of a configuration file:
example% crle
218 man pages section 1: User Commands • Last Revised 10 Oct 2001
crle(1)
With a version 2 configuration file, crle is capable of constructing the command-line
arguments required to regenerate the configuration file and to provide full update
capabilities. Although the update of a version 1 configuration file is possible, the
contents of the configuration file may be insufficient for crle to compute the entire
update requirements.
FILES /var/ld/ld.config Default configuration file for 32-bit
applications.
/var/ld/64/ld.config Default configuration file for 64-bit
applications.
/var/tmp Default location for temporary
configuration file (see tempnam(3C)).
/usr/lib/lddstub Stub application employed to dldump(3DL)
32-bit objects.
/usr/lib/64/lddstub Stub application employed to dldump(3DL)
64-bit objects.
/usr/lib/libcrle.so.1 Audit library employed to dldump(3DL)
32-bit objects.
/usr/lib/64/libcrle.so.1 Audit library employed to dldump(3DL)
64-bit objects.
Availability SUNWtoo
DESCRIPTION The crontab utility manages a user’s access with cron (see cron(1M)) by copying,
creating, listing, and removing crontab files. If invoked without options, crontab
copies the specified file, or the standard input if no file is specified, into a directory
that holds all users’ crontabs.
If crontab is invoked with filename, this will overwrite an existing crontab entry for
the user that invokes it.
Notice that the rules for allow and deny apply to root only if the allow/deny files
exist.
crontab Entry A crontab file consists of lines of six fields each. The fields are separated by spaces or
Format tabs. The first five are integer patterns that specify the following:
minute (0−59),
hour (0−23),
day of the month (1−31),
month of the year (1−12),
day of the week (0−6 with 0=Sunday).
Each of these patterns may be either an asterisk (meaning all legal values) or a list of
elements separated by commas. An element is either a number or two numbers
separated by a minus sign (meaning an inclusive range). Notice that the specification
of days may be made by two fields (day of the month and day of the week). Both are
adhered to if specified as a list of elements. See EXAMPLES.
220 man pages section 1: User Commands • Last Revised 19 Apr 2002
crontab(1)
The sixth field of a line in a crontab file is a string that is executed by the shell at the
specified times. A percent character in this field (unless escaped by \ ) is translated to
a NEWLINE character.
Only the first line (up to a ‘ % ’ or end of line) of the command field is executed by
the shell. Other lines are made available to the command as standard input. Any blank
line or line beginning with a ‘ # ’ is a comment and will be ignored.
The shell is invoked from your $HOME directory with an arg0 of sh. Users who
desire to have their .profile executed must explicitly do so in the crontab file. cron
supplies a default environment for every shell, defining HOME, LOGNAME,
SHELL(=/bin/sh), TZ, and PATH. The default PATH for user cron jobs is
/usr/bin; while root cron jobs default to /usr/sbin:/usr/bin. The default
PATH can be set in /etc/default/cron (see cron(1M)).
If you do not redirect the standard output and standard error of your commands, any
generated output or errors will be mailed to you.
If all lines in the crontab file are deleted, the old crontab file will be
restored. The correct way to delete all lines is to remove the crontab file via
the -r option.
-l Lists the crontab file for the invoking user. Only a user with the
solaris.jobs.admin authorization can specify a username following the
-r or -l options to remove or list the crontab file of the specified user.
-r Removes a user’s crontab from the crontab directory.
This example cleans up core files every weekday morning at 3:15 am:
15 3 * * 1-5 find $HOME -name core 2>/dev/null | xargs rm -f
This example
0 0 1,15 * 1
would run a command on the first and fifteenth of each month, as well as on every
Monday.
To specify days by only one field, the other field should be set to *. For example:
0 0 * * 1
ENVIRONMENT See environ(5) for descriptions of the following environment variables that affect the
VARIABLES execution of crontab: LANG, LC_ALL, LC_CTYPE, LC_MESSAGES, and NLSPATH.
EDITOR Determine the editor to be invoked when the -e option is
specified. The default editor is vi(1).
Availability SUNWcsu
SEE ALSO atq(1), atrm(1), auths(1), sh(1), vi(1), cron(1M), su(1M), auth_attr(4),
attributes(5), environ(5), standards(5)
NOTES If you inadvertently enter the crontab command with no argument(s), do not
attempt to get out with Control-d. This removes all entries in your crontab file.
Instead, exit with Control-c.
222 man pages section 1: User Commands • Last Revised 19 Apr 2002
crontab(1)
If an authorized user modifies another user’s crontab file, resulting behavior may be
unpredictable. Instead, the super-user should first use su(1M) to become super-user to
the other user’s login before making any changes to the crontab file.
When updating cron, check first for existing crontab entries that may be scheduled
close to the time of the update. Such entries may be lost if the update process
completes after the scheduled event. This can happen because, when cron is notified
by crontab to update the internal view of a user’s crontab file, it first removes the
user’s existing internal crontab and any internal scheduled events. Then it reads the
new crontab file and rebuilds the internal crontab and events. This last step takes time,
especially with a large crontab file, and may complete after an existing crontab entry is
scheduled to run if it is scheduled too close to the update. To be safe, start a new job at
least 60 seconds after the current date and time.
DESCRIPTION The crypt utility encrypts and decrypts the contents of a file. crypt reads from the
standard input and writes on the standard output. The password is a key that selects a
particular transformation. If no password is given, crypt demands a key from the
terminal and turns off printing while the key is being typed in. crypt encrypts and
decrypts with the same key:
example% crypt key<clear.file> encrypted.file
example% crypt key<encrypted.file | pr
Files encrypted by crypt are compatible with those treated by the editors ed(1),
ex(1), and vi(1) in encryption mode.
The security of encrypted files depends on three factors: the fundamental method
must be hard to solve; direct search of the key space must be infeasible; “sneak paths”
by which keys or cleartext can become visible must be minimized.
crypt implements a one-rotor machine designed along the lines of the German
Enigma, but with a 256-element rotor. Methods of attack on such machines are widely
known, thus crypt provides minimal security.
The transformation of a key into the internal settings of the machine is deliberately
designed to be expensive, that is, to take a substantial fraction of a second to compute.
However, if keys are restricted to (say) three lower-case letters, then encrypted files
can be read by expending only a substantial fraction of five minutes of machine time.
Since the key is an argument to the crypt command, it is potentially visible to users
executing ps(1) or a derivative command. To minimize this possibility, crypt takes
care to destroy any record of the key immediately upon entry. No doubt the choice of
keys and key security are the most vulnerable aspect of crypt.
FILES /dev/tty for typed key
Availability SUNWcsu
SEE ALSO des(1), ed(1), ex(1), makekey(1), ps(1), vi(1), attributes (5)
224 man pages section 1: User Commands • Last Revised 14 May 1997
csh(1)
NAME csh – shell command interpreter with a C-like syntax
SYNOPSIS csh [-bcefinstvVxX] [argument…]
DESCRIPTION csh, the C shell, is a command interpreter with a syntax reminiscent of the C
language. It provides a number of convenient features for interactive use that are not
available with the Bourne shell, including filename completion, command aliasing,
history substitution, job control, and a number of built-in commands. As with the
Bourne shell, the C shell provides variable, command and filename substitution.
Initialization and When first started, the C shell normally performs commands from the .cshrc file in
Termination your home directory, provided that it is readable and you either own it or your real
group ID matches its group ID. If the shell is invoked with a name that starts with ‘−’,
as when started by login(1), the shell runs as a login shell.
If the shell is a login shell, this is the sequence of invocations: First, commands in
/etc/.login are executed. Next, commands from the .cshrc file your home
directory are executed. Then the shell executes commands from the .login file in
your home directory; the same permission checks as those for .cshrc are applied to
this file. Typically, the .login file contains commands to specify the terminal type
and environment. (For an explanation of file interpreters, see below "Command
Execution" and exec(2).)
As a login shell terminates, it performs commands from the .logout file in your
home directory; the same permission checks as those for .cshrc are applied to this
file.
Interactive After startup processing is complete, an interactive C shell begins reading commands
Operation from the terminal, prompting with hostname% (or hostname# for the privileged
user). The shell then repeatedly performs the following actions: a line of command
input is read and broken into words. This sequence of words is placed on the history
list and then parsed, as described under USAGE. Finally, the shell executes each
command in the current line.
Noninteractive When running noninteractively, the shell does not prompt for input from the terminal.
Operation A noninteractive C shell can execute a command supplied as an argument on its
command line, or interpret commands from a file, also known as a script.
Except with the options -c, -i, -s, or -t, the first nonoption argument is taken to be
the name of a command or script. It is passed as argument zero, and subsequent
arguments are added to the argument list for that command or script.
USAGE
Filename When enabled by setting the variable filec, an interactive C shell can complete a
Completion partially typed filename or user name. When an unambiguous partial filename is
followed by an ESC character on the terminal input line, the shell fills in the remaining
characters of a matching filename from the working directory.
If a partial filename is followed by the EOF character (usually typed as Control-d), the
shell lists all filenames that match. It then prompts once again, supplying the
incomplete command line typed in so far.
When the last (partial) word begins with a tilde (~), the shell attempts completion with
a user name, rather than a file in the working directory.
The terminal bell signals errors or multiple matches. This bell signal can be inhibited
by setting the variable nobeep. You can exclude files with certain suffixes by listing
those suffixes in the variable fignore. If, however, the only possible completion
includes a suffix in the list, it is not ignored. fignore does not affect the listing of
filenames by the EOF character.
226 man pages section 1: User Commands • Last Revised 19 Aug 2002
csh(1)
Lexical Structure The shell splits input lines into words at space and tab characters, except as noted
below. The characters &, |, ;, <, >, (, and ) form separate words; if paired, the pairs
form single words. These shell metacharacters can be made part of other words, and
their special meaning can be suppressed by preceding them with a ‘\’ (backslash). A
newline preceded by a \ is equivalent to a space character.
When the shell’s input is not a terminal, the character # introduces a comment that
continues to the end of the input line. Its special meaning is suppressed when
preceded by a \ or enclosed in matching quotes.
Command Line A simple command is composed of a sequence of words. The first word (that is not part
Parsing of an I/O redirection) specifies the command to be executed. A simple command, or a
set of simple commands separated by | or |& characters, forms a pipeline. With |, the
standard output of the preceding command is redirected to the standard input of the
command that follows. With | &, both the standard error and the standard output are
redirected through the pipeline.
History History substitution allows you to use words from previous command lines in the
Substitution command line you are typing. This simplifies spelling corrections and the repetition of
complicated commands or arguments. Command lines are saved in the history list, the
size of which is controlled by the history variable. The most recent command is
retained in any case. A history substitution begins with a ! (although you can change
this with the histchars variable) and may occur anywhere on the command line;
history substitutions do not nest. The ! can be escaped with \ to suppress its special
meaning.
Event Designators An event designator is a reference to a command line entry in the history list.
! Start a history substitution, except when
followed by a space character, tab, newline,
= or (.
!! Refer to the previous command. By itself,
this substitution repeats the previous
command.
!n Refer to command line n.
!-n Refer to the current command line minus n.
!str Refer to the most recent command starting
with str.
!?str? Refer to the most recent command
containing str.
!?str? additional Refer to the most recent command
containing str and append additional to that
referenced command.
!{command} additional Refer to the most recent command
beginning with command and append
additional to that referenced command.
^previous_word^replacement^ Repeat the previous command line
replacing the string previous_word with the
string replacement. This is equivalent to the
history substitution:
!:s/previous_word/replacement/.
Word Designators A ‘:’ (colon) separates the event specification from the word designator. It can be
omitted if the word designator begins with a ^, $, *, − or %. If the word is to be
selected from the previous command, the second ! character can be omitted from the
event specification. For instance, !!:1 and !:1 both refer to the first word of the
previous command, while !!$ and !$ both refer to the last word in the previous
command. Word designators include:
# The entire command line typed so far.
228 man pages section 1: User Commands • Last Revised 19 Aug 2002
csh(1)
0 The first input word (command).
n The n’th argument.
^ The first argument, that is, 1.
$ The last argument.
% The word matched by the ?s search.
x−y A range of words; −y abbreviates 0−y.
* All the arguments, or a null value if there is just one word in the event.
x* Abbreviates x−$.
x− Like x* but omitting word $.
Modifiers After the optional word designator, you can add one of the following modifiers,
preceded by a :.
h Remove a trailing pathname component, leaving the head.
r Remove a trailing suffix of the form ‘.xxx’, leaving the basename.
e Remove all but the suffix, leaving the Extension.
s/l/r/ Substitute r for l.
t Remove all leading pathname components, leaving the tail.
& Repeat the previous substitution.
g Apply the change to the first occurrence of a match in each word, by
prefixing the above (for example, g&).
p Print the new command but do not execute it.
q Quote the substituted words, escaping further substitutions.
x Like q, but break into words at each space character, tab or newline.
Unless preceded by a g, the modification is applied only to the first string that
matches l; an error results if no string matches.
The left-hand side of substitutions are not regular expressions, but character strings.
Any character can be used as the delimiter in place of /. A backslash quotes the
delimiter character. The character &, in the right hand side, is replaced by the text from
the left-hand-side. The & can be quoted with a backslash. A null l uses the previous
string either from a l or from a contextual scan string s from !?s. You can omit the
rightmost delimiter if a newline immediately follows r; the rightmost ? in a context
scan can similarly be omitted.
Aliases The C shell maintains a list of aliases that you can create, display, and modify using
the alias and unalias commands. The shell checks the first word in each command
to see if it matches the name of an existing alias. If it does, the command is
reprocessed with the alias definition replacing its name; the history substitution
mechanism is made available as though that command were the previous input line.
This allows history substitutions, escaped with a backslash in the definition, to be
replaced with actual command line arguments when the alias is used. If no history
substitution is called for, the arguments remain unchanged.
Aliases can be nested. That is, an alias definition can contain the name of another alias.
Nested aliases are expanded before any history substitutions is applied. This is useful
in pipelines such as
alias lm ’ls -l \!* | more’
Except for the first word, the name of the alias may not appear in its definition, nor in
any alias referred to by its definition. Such loops are detected, and cause an error
message.
I/O Redirection The following metacharacters indicate that the subsequent word is the name of a file
to which the command’s standard input, standard output, or standard error is
redirected; this word is variable, command, and filename expanded separately from
the rest of the command.
<
Redirect the standard input.
< < word
Read the standard input, up to a line that is identical with word, and place the
resulting lines in a temporary file. Unless word is escaped or quoted, variable and
command substitutions are performed on these lines. Then, the pipeline is invoked
with the temporary file as its standard input. word is not subjected to variable,
filename, or command substitution, and each line is compared to it before any
substitutions are performed by the shell.
> >! >& >&!
Redirect the standard output to a file. If the file does not exist, it is created. If it does
exist, it is overwritten; its previous contents are lost.
When set, the variable noclobber prevents destruction of existing files. It also
prevents redirection to terminals and /dev/null, unless one of the ! forms is
used. The & forms redirect both standard output and the standard error (diagnostic
output) to the file.
> > > >& > >! > >&!
Append the standard output. Like >, but places output at the end of the file rather
than overwriting it. If noclobber is set, it is an error for the file not to exist, unless
230 man pages section 1: User Commands • Last Revised 19 Aug 2002
csh(1)
one of the ! forms is used. The & forms append both the standard error and
standard output to the file.
Variable The C shell maintains a set of variables, each of which is composed of a name and a
Substitution value. A variable name consists of up to 20 letters and digits, and starts with a letter
(the underscore is considered a letter). A variable’s value is a space-separated list of
zero or more words.
To refer to a variable’s value, precede its name with a ‘$’. Certain references (described
below) can be used to select specific words from the value, or to display other
information about the variable. Braces can be used to insulate the reference from other
characters in an input-line word.
Variable substitution takes place after the input line is analyzed, aliases are resolved,
and I/O redirections are applied. Exceptions to this are variable references in I/O
redirections (substituted at the time the redirection is made), and backquoted strings
(see Command Substitution).
Variables can be created, displayed, or destroyed using the set and unset
commands. Some variables are maintained or used by the shell. For instance, the argv
variable contains an image of the shell’s argument list. Of the variables used by the
shell, a number are toggles; the shell does not care what their value is, only whether
they are set or not.
Numerical values can be operated on as numbers (as with the @ built-in command).
With numeric operations, an empty value is considered to be zero. The second and
subsequent words of multiword values are ignored. For instance, when the verbose
variable is set to any value (including an empty value), command input is echoed on
the terminal.
Command and filename substitution is subsequently applied to the words that result
from the variable substitution, except when suppressed by double-quotes, when
noglob is set (suppressing filename substitution), or when the reference is quoted
with the :q modifier. Within double-quotes, a reference is expanded to form (a portion
of) a quoted string; multiword values are expanded to a string with embedded space
characters. When the :q modifier is applied to the reference, it is expanded to a list of
space-separated words, each of which is quoted to prevent subsequent command or
filename substitutions.
The modifiers :e, :h, :q, :r, :t, and :x can be applied (see History
Substitution), as can :gh, :gt, and :gr. If { } (braces) are used, then the
modifiers must appear within the braces. The current implementation allows only one
such modifier per expansion.
Command and Command and filename substitutions are applied selectively to the arguments of
Filename built-in commands. Portions of expressions that are not evaluated are not expanded.
Substitutions For non-built-in commands, filename expansion of the command name is done
separately from that of the argument list; expansion occurs in a subshell, after I/O
redirection is performed.
232 man pages section 1: User Commands • Last Revised 19 Aug 2002
csh(1)
line. Within double-quotes, only newline characters force new words; space and tab
characters are preserved. However, a final newline is ignored. It is therefore possible
for a command substitution to yield a partial word.
Filename Unquoted words containing any of the characters *, ?, [ or {, or that begin with ~, are
Substitution expanded (also known as globbing) to an alphabetically sorted list of filenames, as
follows:
* Match any (zero or more) characters.
? Match any single character.
[. . .] Match any single character in the enclosed list(s) or range(s). A list
is a string of characters. A range is two characters separated by a
dash (−), and includes all the characters in between in the ASCII
collating sequence (see ascii(5)).
{ str, str, . . . } Expand to each string (or filename-matching pattern) in the
comma-separated list. Unlike the pattern-matching expressions
above, the expansion of this construct is not sorted. For instance,
{b,a} expands to ‘b’ ‘a’, (not ‘a’ ‘b’). As special cases, the
characters { and }, along with the string { }, are passed
undisturbed.
~[user] Your home directory, as indicated by the value of the variable
home, or that of user, as indicated by the password entry for user.
Expressions and A number of C shell built-in commands accept expressions, in which the operators are
Operators similar to those of C and have the same precedence. These expressions typically
appear in the @, exit, if, set and while commands, and are often used to regulate
the flow of control for executing commands. Components of an expression are
separated by white space.
Null or missing values are considered 0. The result of all expressions is a string, which
may represent decimal numbers.
The operators: ==, !=, =~, and !~ compare their arguments as strings; other operators
use numbers. The operators =~ and !~ each check whether or not a string to the left
matches a filename substitution pattern on the right. This reduces the need for
switch statements when pattern-matching between strings is all that is required.
If filename does not exist or is inaccessible, then all inquiries return false.
234 man pages section 1: User Commands • Last Revised 19 Aug 2002
csh(1)
{ command } If command runs successfully, the expression evaluates to true, 1.
Otherwise, it evaluates to false, 0. Note: Conversely, command itself
typically returns 0 when it runs successfully, or some other value if
it encounters a problem. If you want to get at the status directly,
use the value of the status variable rather than this expression.
Control Flow The shell contains a number of commands to regulate the flow of control in scripts and
within limits, from the terminal. These commands operate by forcing the shell either to
reread input (to loop), or to skip input under certain conditions (to branch).
Each occurrence of a foreach, switch, while, if. . .then and else built-in
command must appear as the first word on its own input line.
If the shell’s input is not seekable and a loop is being read, that input is buffered. The
shell performs seeks within the internal buffer to accomplish the rereading implied by
the loop. (To the extent that this allows, backward goto commands will succeed on
nonseekable inputs.)
Command If the command is a C shell built-in command, the shell executes it directly. Otherwise,
Execution the shell searches for a file by that name with execute access. If the command name
contains a /, the shell takes it as a pathname, and searches for it. If the command
name does not contain a /, the shell attempts to resolve it to a pathname, searching
each directory in the path variable for the command. To speed the search, the shell
uses its hash table (see the rehash built-in command) to eliminate directories that
have no applicable files. This hashing can be disabled with the -c or -t, options, or
the unhash built-in command.
As a special case, if there is no / in the name of the script and there is an alias for the
word shell, the expansion of the shell alias is prepended (without modification) to
the command line. The system attempts to execute the first word of this special
(late-occurring) alias, which should be a full pathname. Remaining words of the alias’s
definition, along with the text of the input line, are treated as arguments.
When a pathname is found that has proper execute permissions, the shell forks a new
process and passes it, along with its arguments, to the kernel using the execve( )
system call (see exec(2)). The kernel then attempts to overlay the new process with
the desired program. If the file is an executable binary (in a.out(4) format) the kernel
succeeds and begins executing the new process. If the file is a text file and the first line
begins with #!, the next word is taken to be the pathname of a shell (or command) to
interpret that script. Subsequent words on the first line are taken as options for that
shell. The kernel invokes (overlays) the indicated shell, using the name of the script as
an argument.
If neither of the above conditions holds, the kernel cannot overlay the file and the
execve( ) call fails (see exec(2)). The C shell then attempts to execute the file by
spawning a new shell, as follows:
■ If the first character of the file is a #, a C shell is invoked.
■ Otherwise, a Bourne shell is invoked.
Job Control The shell associates a numbered job with each command sequence to keep track of
those commands that are running in the background or have been stopped with TSTP
signals (typically Control-z). When a command or command sequence (semicolon
separated list) is started in the background using the & metacharacter, the shell
displays a line with the job number in brackets and a list of associated process
numbers:
[1] 1234
To see the current list of jobs, use the jobs built-in command. The job most recently
stopped (or put into the background if none are stopped) is referred to as the current
job and is indicated with a ‘+’. The previous job is indicated with a ‘−’. When the
current job is terminated or moved to the foreground, this job takes its place (becomes
the new current job).
To manipulate jobs, refer to the bg, fg, kill, stop, and % built-in commands.
A reference to a job begins with a ‘%’. By itself, the percent-sign refers to the current
job.
% %+ %% The current job.
%− The previous job.
%j Refer to job j as in: ‘kill -9 %j’. j can be a job number, or a string
that uniquely specifies the command line by which it was started;
‘fg %vi’ might bring a stopped vi job to the foreground, for
instance.
%?string Specify the job for which the command line uniquely contains
string.
A job running in the background stops when it attempts to read from the terminal.
Background jobs can normally produce output, but this can be suppressed using the
‘stty tostop’ command.
Status Reporting While running interactively, the shell tracks the status of each job and reports
whenever the job finishes or becomes blocked. It normally displays a message to this
effect as it issues a prompt, in order to avoid disturbing the appearance of your input.
When set, the notify variable indicates that the shell is to report status changes
immediately. By default, the notify command marks the current process; after
starting a background job, type notify to mark it.
236 man pages section 1: User Commands • Last Revised 19 Aug 2002
csh(1)
Commands Built-in commands are executed within the C shell. If a built-in command occurs as
any component of a pipeline except the last, it is executed in a subshell.
:
Null command. This command is interpreted, but performs no action.
alias [ name [ def ] ]
Assign def to the alias name. def is a list of words that may contain escaped
history-substitution metasyntax. name is not allowed to be alias or unalias. If
def is omitted, the current definition for the alias name is displayed. If both name and
def are omitted, all aliases are displayed with their definitions.
bg [ %job . . . ]
Run the current or specified jobs in the background.
break
Resume execution after the end of the nearest enclosing foreach or while loop.
The remaining commands on the current line are executed. This allows multilevel
breaks to be written as a list of break commands, all on one line.
breaksw
Break from a switch, resuming after the endsw.
case label:
A label in a switch statement.
cd [dir ]
chdir [dir ]
Change the shell’s working directory to directory dir. If no argument is given,
change to the home directory of the user. If dir is a relative pathname not found in
the current directory, check for it in those directories listed in the cdpath variable.
If dir is the name of a shell variable whose value starts with a /, change to the
directory named by that value.
continue
Continue execution of the next iteration of the nearest enclosing while or foreach
loop.
default:
Labels the default case in a switch statement. The default should come after all
case labels. Any remaining commands on the command line are first executed.
dirs [-l]
Print the directory stack, most recent to the left. The first directory shown is the
current directory. With the -l argument, produce an unabbreviated printout; use of
the ~ notation is suppressed.
echo [-n] list
The words in list are written to the shell’s standard output, separated by space
characters. The output is terminated with a newline unless the -n option is used.
csh will, by default, invoke its built-in echo, if echo is called without the full
pathname of a Unix command, regardless of the configuration of your PATH (see
echo(1)).
The built-in command continue may be used to terminate the execution of the
current iteration of the loop and the built-in command break may be used to
terminate execution of the foreach command. When this command is read from
the terminal, the loop is read once prompting with ? before any statements in the
loop are executed.
glob wordlist
Perform filename expansion on wordlist. Like echo, but no \ escapes are
recognized. Words are delimited by NULL characters in the output.
goto label
The specified label is a filename and a command expanded to yield a label. The shell
rewinds its input as much as possible and searches for a line of the form label:
possibly preceded by space or tab characters. Execution continues after the
indicated line. It is an error to jump to a label that occurs between a while or for
built-in command and its corresponding end.
hashstat
Print a statistics line indicating how effective the internal hash table for the path
variable has been at locating commands (and avoiding execs). An exec is
attempted for each component of the path where the hash function indicates a
possible hit and in each component that does not begin with a ‘/’. These statistics
only reflect the effectiveness of the path variable, not the cdpath variable.
history [-hr] [ n ]
Display the history list; if n is given, display only the n most recent events.
-r Reverse the order of printout to be most recent first rather than oldest
first.
238 man pages section 1: User Commands • Last Revised 19 Aug 2002
csh(1)
-h Display the history list without leading numbers. This is used to
produce files suitable for sourcing using the -h option to source.
if (expr )command
If the specified expression evaluates to true, the single command with arguments is
executed. Variable substitution on command happens early, at the same time it does
for the rest of the if command. command must be a simple command, not a
pipeline, a command list, or a parenthesized command list. Note: I/O redirection
occurs even if expr is false, when command is not executed (this is a bug).
if (expr) then
...
else if (expr2) then
...
else
...
endif
If expr is true, commands up to the first else are executed. Otherwise, if expr2 is
true, the commands between the else if and the second else are executed.
Otherwise, commands between the else and the endif are executed. Any number
of else if pairs are allowed, but only one else. Only one endif is needed, but it
is required. The words else and endif must be the first nonwhite characters on a
line. The if must appear alone on its input line or after an else.
jobs [-l]
List the active jobs under job control.
-l List process IDs, in addition to the normal information.
kill [ -sig ] [ pid ] [ %job ] . . .
kill -l
Send the TERM (terminate) signal, by default, or the signal specified, to the specified
process ID, the job indicated, or the current job. Signals are either given by number
or by name. There is no default. Typing kill does not send a signal to the current
job. If the signal being sent is TERM (terminate) or HUP (hangup), then the job or
process is sent a CONT (continue) signal as well.
-l List the signal names that can be sent.
limit [-h] [resource [max-use ] ]
Limit the consumption by the current process or any process it spawns, each not to
exceed max-use on the specified resource. If max-use is omitted, print the current
limit. If resource is omitted, display all limits. Run the sysdef(1M) command to
obtain the maximum possible limits for your system. The values reported are in
hexadecimal, but can be translated into decimal numbers using the bc(1)
command.
-h Use hard limits instead of the current limits. Hard limits impose a
ceiling on the values of the current limits. Only the privileged user may
raise the hard limits.
Example of limit: to limit the size of a core file dump to 0 Megabytes, type the
following:
limit coredumpsize 0M
login [username | -p ]
Terminate a login shell and invoke login(1). The .logout file is not processed. If
username is omitted, login prompts for the name of a user.
-p Preserve the current environment (variables).
logout
Terminate a login shell.
nice [+n |-n ] [command ]
Increment the process priority value for the shell or for command by n. The higher
the priority value, the lower the priority of a process, and the slower it runs. When
given, command is always run in a subshell, and the restrictions placed on
commands in simple if commands apply. If command is omitted, nice increments
the value for the current shell. If no increment is specified, nice sets the process
priority value to 4. The range of process priority values is from −20 to 20. Values of
n outside this range set the value to the lower, or to the higher boundary,
respectively.
+n Increment the process priority value by n.
-n Decrement by n. This argument can be used only by the privileged user.
240 man pages section 1: User Commands • Last Revised 19 Aug 2002
csh(1)
nohup [command ]
Run command with HUPs ignored. With no arguments, ignore HUPs throughout the
remainder of a script. When given, command is always run in a subshell, and the
restrictions placed on commands in simple if statements apply. All processes
detached with & are effectively nohup’d.
notify [%job] . . .
Notify the user asynchronously when the status of the current job or specified jobs
changes.
onintr [−| label]
Control the action of the shell on interrupts. With no arguments, onintr restores
the default action of the shell on interrupts. (The shell terminates shell scripts and
returns to the terminal command input level). With the − argument, the shell
ignores all interrupts. With a label argument, the shell executes a goto label when
an interrupt is received or a child process terminates because it was interrupted.
popd [+n ]
Pop the directory stack and cd to the new top directory. The elements of the
directory stack are numbered from 0 starting at the top.
+n Discard the n’th entry in the stack.
pushd [+n |dir]
Push a directory onto the directory stack. With no arguments, exchange the top two
elements.
+n Rotate the n’th entry to the top of the stack and cd to it.
dir Push the current working directory onto the stack and change to dir.
rehash
Recompute the internal hash table of the contents of directories listed in the path
variable to account for new commands added. Recompute the internal hash table of
the contents of directories listed in the cdpath variable to account for new directories
added.
repeat count command
Repeat command count times. command is subject to the same restrictions as with the
one-line if statement.
set [var [= value ] ]
set var[n] = word
With no arguments, set displays the values of all shell variables. Multiword values
are displayed as a parenthesized list. With the var argument alone, set assigns an
empty (null) value to the variable var. With arguments of the form var = value set
assigns value to var, where value is one of:
word A single word (or quoted string).
(wordlist) A space-separated list of words enclosed in parentheses.
Values are command and filename expanded before being assigned. The form set
var[n] = word replaces the n’th word in a multiword value with word.
242 man pages section 1: User Commands • Last Revised 19 Aug 2002
csh(1)
stop %jobid . . .
Stop the current or specified background job.
stop pid . . .
Stop the specified process, pid. (see ps(1)).
suspend
Stop the shell in its tracks, much as if it had been sent a stop signal with ^Z. This is
most often used to stop shells started by su.
switch (string)
case label:
...
breaksw
...
default:
...
breaksw
endsw
Each label is successively matched, against the specified string, which is first
command and filename expanded. The file metacharacters *, ? and [. . .] may be
used in the case labels, which are variable expanded. If none of the labels match
before a “default” label is found, execution begins after the default label. Each case
statement and the default statement must appear at the beginning of a line. The
command breaksw continues execution after the endsw. Otherwise control falls
through subsequent case and default statements as with C. If no label matches
and there is no default, execution continues after the endsw.
time [command ]
With no argument, print a summary of time used by this C shell and its children.
With an optional command, execute command and print a summary of the time it
uses. As of this writing, the time built-in command does NOT compute the last 6
fields of output, rendering the output to erroneously report the value "0" for these
fields.
example %time ls -R
9.0u 11.0s 3:32 10% 0+0k 0+0io 0pf+0w
(See below the "Environment Variables and Predefined Shell Variables" sub-section
on the time variable.)
umask [value ]
Display the file creation mask. With value, set the file creation mask. With value
given in octal, the user can turn off any bits, but cannot turn on bits to allow new
permissions. Common values include 077, restricting all permissions from everyone
else; 002, giving complete access to the group, and read (and directory search)
access to others; or 022, giving read (and directory search) but not write permission
to the group and others.
unalias pattern
Discard aliases that match (filename substitution) pattern. All aliases are removed
by ‘unalias *’.
If the expression contains the characters >, <, &, or |, then at least this part of expr
must be placed within parentheses.
The operators *=, +=, and so forth, are available as in C. The space separating the
name from the assignment operator is optional. Spaces are, however, mandatory in
separating components of expr that would otherwise be single words.
244 man pages section 1: User Commands • Last Revised 19 Aug 2002
csh(1)
Environment Unlike the Bourne shell, the C shell maintains a distinction between environment
Variables and variables, which are automatically exported to processes it invokes, and shell
Predefined Shell variables, which are not. Both types of variables are treated similarly under variable
Variables
substitution. The shell sets the variables argv, cwd, home, path, prompt, shell, and
status upon initialization. The shell copies the environment variable USER into the
shell variable user, TERM into term, and HOME into home, and copies each back into
the respective environment variable whenever the shell variables are reset. PATH and
path are similarly handled. You need only set path once in the .cshrc or .login
file. The environment variable PWD is set from cwd whenever the latter changes. The
following shell variables have predefined meanings:
argv Argument list. Contains the list of command line arguments
supplied to the current invocation of the shell. This variable
determines the value of the positional parameters $1, $2, and so
on.
cdpath Contains a list of directories to be searched by the cd, chdir, and
popd commands, if the directory argument each accepts is not a
subdirectory of the current directory.
cwd The full pathname of the current directory.
echo Echo commands (after substitutions) just before execution.
fignore A list of filename suffixes to ignore when attempting filename
completion. Typically the single word ‘.o’.
filec Enable filename completion, in which case the Control-d character
EOT and the ESC character have special significance when typed in
at the end of a terminal input line:
EOT Print a list of all filenames that start with the preceding
string.
ESC Replace the preceding string with the longest
unambiguous extension.
hardpaths If set, pathnames in the directory stack are resolved to contain no
symbolic-link components.
histchars A two-character string. The first character replaces ! as the
history-substitution character. The second replaces the carat (^) for
quick substitutions.
history The number of lines saved in the history list. A very large number
may use up all of the C shell’s memory. If not set, the C shell saves
only the most recent command.
home The user’s home directory. The filename expansion of ~ refers to
the value of this variable.
ignoreeof If set, the shell ignores EOF from terminals. This protects against
accidentally killing a C shell by typing a Control-d.
246 man pages section 1: User Commands • Last Revised 19 Aug 2002
csh(1)
savehist The number of lines from the history list that are saved in
~/.history when the user logs out. Large values for savehist
slow down the C shell during startup.
shell The file in which the C shell resides. This is used in forking shells
to interpret files that have execute bits set, but that are not
executable by the system.
status The status returned by the most recent command. If that command
terminated abnormally, 0200 is added to the status. Built-in
commands that fail return exit status 1; all other built-in
commands set status to 0.
time Control automatic timing of commands. Can be supplied with one
or two values. The first is the reporting threshold in CPU seconds.
The second is a string of tags and text indicating which resources
to report on. A tag is a percent sign (%) followed by a single
upper-case letter (unrecognized tags print as text):
%D Average amount of unshared data space used in
Kilobytes.
%E Elapsed (wallclock) time for the command.
%F Page faults.
%I Number of block input operations.
%K Average amount of unshared stack space used in
Kilobytes.
%M Maximum real memory used during execution of the
process.
%O Number of block output operations.
%P Total CPU time — U (user) plus S (system) — as a
percentage of E (elapsed) time.
%S Number of seconds of CPU time consumed by the
kernel on behalf of the user’s process.
%U Number of seconds of CPU time devoted to the user’s
process.
%W Number of swaps.
%X Average amount of shared memory used in Kilobytes.
The default summary display outputs from the %U, %S, %E, %P, %X,
%D, %I, %O, %F, and %W tags, in that order.
verbose Display each command after history substitution takes place.
Availability SUNWcsu
CSI Enabled
SEE ALSO bc(1), echo(1), login(1), ls(1), more(1), ps(1), sh(1), shell_builtins(1),
tset(1B), which(1), df(1M), swap(1M), sysdef(1M), access(2), exec(2), fork(2),
pipe(2), a.out(4), environ(4), ascii(5), attributes(5), environ(5),
largefile(5), termio(7I)
DIAGNOSTICS You have stopped jobs.
You attempted to exit the C shell with stopped jobs under job control. An
immediate second attempt to exit will succeed, terminating the stopped jobs.
NOTES Words can be no longer than 1024 bytes. The system limits argument lists to 1,048,576
bytes. However, the maximum number of arguments to a command for which
filename expansion applies is 1706. Command substitutions may expand to no more
characters than are allowed in the argument list. To detect looping, the shell restricts
the number of alias substitutions on a single line to 20.
When a command is restarted from a stop, the shell prints the directory it started in if
this is different from the current directory; this can be misleading (that is, wrong) as
the job may have changed directories internally.
Shell built-in functions are not stoppable/restartable. Command sequences of the form
a ; b ; c are also not handled gracefully when stopping is attempted. If you suspend
b, the shell never executes c. This is especially noticeable if the expansion results from
an alias. It can be avoided by placing the sequence in parentheses to force it into a
subshell.
248 man pages section 1: User Commands • Last Revised 19 Aug 2002
csh(1)
Control over terminal output after processes are started is primitive; use the Sun
Window system if you need better output control.
Commands within loops, prompted for by ?, are not placed in the history list.
The g (global) flag in history substitutions applies only to the first match in each word,
rather than all matches in all words. The common text editors consistently do the latter
when given the g flag in a substitution command.
Quoting conventions are confusing. Overriding the escape character to force variable
substitutions within double quotes is counterintuitive and inconsistent with the
Bourne shell.
Symbolic links can fool the shell. Setting the hardpaths variable alleviates this.
It is up to the user to manually remove all duplicate pathnames accrued from using
built-in commands as
set path = pathnames
or
setenv PATH = pathnames
more than once. These often occur because a shell script or a .cshrc file does
something like
‘set path=(/usr/local /usr/hosts $path)’
The only way to direct the standard output and standard error separately is by
invoking a subshell, as follows:
command > outfile ) >& errorfile
Although robust enough for general use, adventures into the esoteric periphery of the
C shell may reveal unexpected quirks.
If you start csh as a login shell and you do not have a .login in your home
directory, then the csh reads in the /etc/.login.
When the shell executes a shell script that attempts to execute a non-existent
command interpreter, the shell returns an erroneous diagnostic message that the shell
script file does not exist.
250 man pages section 1: User Commands • Last Revised 19 Aug 2002
csplit(1)
NAME csplit – split files based on context
SYNOPSIS csplit [-ks] [-f prefix] [-n number] file arg1… argn
DESCRIPTION The csplit utility reads the file named by the file operand, writes all or part of that
file into other files as directed by the arg operands, and writes the sizes of the files.
An error will be reported if an operand does not reference a line between the current
position and the end of the file.
USAGE See largefile(5) for the description of the behavior of csplit when encountering
files greater than or equal to 2 Gbyte (231 bytes).
This example splits the file at every 100 lines, up to 10,000 lines. The -k option causes
the created files to be retained if there are less than 10,000 lines; however, an error
message would still be printed.
example% csplit -k filename 100 {99}
If prog.c follows the normal C coding convention (the last line of a routine consists
only of a } in the first character position), this example creates a file for each separate
C routine (up to 21) in prog.c.
example% csplit -k prog.c ’%main(%’ ’/^}/+1’ {20}
ENVIRONMENT See environ(5) for descriptions of the following environment variables that affect the
VARIABLES execution of csplit: LANG, LC_ALL, LC_COLLATE, LC_CTYPE, LC_MESSAGES, and
NLSPATH.
252 man pages section 1: User Commands • Last Revised 20 Dec 1996
csplit(1)
ATTRIBUTES See attributes(5) for descriptions of the following attributes:
Availability SUNWesu
CSI Enabled
DIAGNOSTICS The diagnostic messages are self-explanatory, except for the following:
arg − out of range The given argument did not reference a line between
the current position and the end of the file.
DESCRIPTION The ct utility dials the telephone number of a modem that is attached to a terminal
and spawns a login process to that terminal. The telno is a telephone number, with
equal signs for secondary dial tones and minus signs for delays at appropriate places.
(The set of legal characters for telno is 0 through 9, -, =, *, and #. The maximum length
telno is 31 characters). If more than one telephone number is specified, ct will try each
in succession until one answers; this is useful for specifying alternate dialing paths.
ct will try each line listed in the file /etc/uucp/Devices until it finds an available
line with appropriate attributes, or runs out of entries.
After the user on the destination ter