Cover | Table of Contents | Colophon
http://www.sun.com/developer.troff, macros, and related toolsemacs and RCS.
Although
they are not part of the standard SVR4 distribution, they are
found on many Unix systems because they are useful add-ons.
cb
|
cc
|
cflow
|
cof2elf
|
cscope
|
ctrace
|
cxref
|
lprof
|
pic
|
ftp
| File transfer protocol. |
login
| Sign on to Unix. |
mailx
| Read or send mail. |
rlogin
| Sign on to remote Unix. |
talk
| Write to other terminals. |
telnet
| Connect to another system. |
vacation
| Respond to mail automatically. |
cmp
| Compare two files, byte by byte. |
comm
| Compare items in two sorted files. |
diff
| Compare two files, line by line. |
diff3
| Compare three files. |
dircmp
| Compare directories. |
sdiff
| Compare two files, side by side. |
cat
| Concatenate files or display them. |
cd
| Change directory. |
chmod
| Change access modes on files. |
cp
|
/usr/ucb directory.
This is especially important when using certain commands,
because the compatibility packages include
several commands that have an existing counterpart in SVR4,
and the two versions usually work differently.
If your PATH variable
specifies /usr/ucb before the
SVR4 command directories (e.g., /usr/bin),
you'll end up running
the BSD version of the command. Check your PATH variable
(use echo $PATH)
to make sure you get what you want. The commands that have
both BSD and SVR4 variants are:
basename
|
du
|
ls
|
tr
|
cc
|
echo
|
ps
|
vacation
|
chown
|
groups
|
stty
| |
deroff
|
ld
|
sum
| |
df
|
ln
|
test
|
/usr/xpg4/bin.
These commands are listed here, but not otherwise covered in
this book, as most users typically do not have /usr/xpg4/bin
in their search paths.
The manual entries for each command discuss the differences
between the /usr/bin version and
the /usr/xpg4/bin version.
ar
|
ed
|
make
|
rm
|
awk
|
edit
|
more
|
sccs
|
basename
|
env
|
nice
|
sed
|
cp
|
expr
|
nl
|
sort
|
ctags
|
get
|
nm
|
stty
|
date
|
grep
|
nohup
|
tail
|
/usr/ucb, the name of the directory in which they reside.
Also included here are commands specific to Solaris 7,
such as those for using Java and the occasional absolutely
essential program available from the Internet./usr/ccs/bin,
/usr/dt/bin,
/usr/java/bin,
and
/usr/openwin/bin,
and not just /usr/bin and /usr/ucb.
In such cases, this book provides the full pathname, e.g.,
/usr/ccs/bin/make.
In some instances, a symbolic link
for a
command exists in /usr/bin to the actual command elsewhere.addbibaddbib [options] database
refer suite of programs.
See Chapter 17./usr/ccs/bin/admin [options] files
/usr/java/bin/appletviewer [options] urls
-debug
jdb.-encoding
name
-J
opt
if-else),
as in many high-level programming languages.ksh88 and ksh93 respectively./etc/passwd file determines which shell takes effect
during your interactive Unix session.
When you log in, the system checks
your entry in /etc/passwd. The last field of each entry
names a program to run as the default shell.
For example:| If the program name is: | Your shell is the: |
|---|---|
/bin/sh
| Bourne shell |
/bin/rsh
| Restricted Bourne shell |
/bin/jsh
| Bourne shell, including job control |
/bin/ksh
| Korn shell |
/usr/dt/bin/dtksh
|
The Desktop Korn shell, a version of
ksh93
(Solaris only) |
/bin/rksh
|
bg, fg,
jobs,
stop,
and suspend are available only on systems that
support job control. (Essentially all modern Unix systems do.)| Symbol/Command | Meaning/Action |
|---|---|
>
| Redirect output. |
>>
| Append to file. |
<
| Redirect input. |
<<
| “Here” document (redirect input). |
|
| Pipe output. |
|&
| Start a coprocess. Korn shell only. |
&
| Run process in background. |
;
| Separate commands on same line. |
*
| Match any character(s) in filename. |
?
| Match single character in filename. |
[ ]
| Match any characters enclosed. |
( )
| Execute in subshell. |
‘ ‘
| Substitute output of enclosed command. |
" "
| Partial quote (allows variable and command expansion). |
' '
| Full quote (no expansion). |
\
| Quote following character. |
$
var
|
| sh | ksh | csh | Meaning/Action |
|---|---|---|---|
$
|
$
|
%
| Prompt. |
>|
|
>!
| Force redirection. | |
>>!
| Force append. | ||
>
file
2>&1
|
>
file
2>&1
|
>&
file
| Combine stdout and stderr. |
{ }
| Expand elements in list. | ||
‘ ‘
|
‘ ‘
|
‘ ‘
|
Substitute output of enclosed command.
|
$( )
|
Substitute output of enclosed command.
(Preferred form.)
| ||
$HOME
|
$HOME
|
$home
| Home directory. |
~
|
~
| Home directory symbol. | |
var
=
value
|
http://www.kornshell.com
provides considerable information about the Korn shell.
Follow the links there for binaries of ksh93
that can be downloaded for noncommercial and educational use.
See also Learning the Korn Shell, which is listed in the Bibliography.vi or emacs)vi or emacs)ksh93 adds the following capabilities:for loop/etc/profile
$HOME/.profile
ksh88: all shells.
ksh93: interactive shells only.)
The value is variable (ksh93: and command and
arithmetic) substituted in order to determine the actual file name.
Login shells read $ENV after processing
/etc/profile and
$HOME/.profile./etc/passwd
~
name
abbreviations.
(On networked systems, this information may come
from NIS or NIS+, not your workstation password file.)ksh93 only)ksh93 provides structured variables, such as
pos.x and pos.y.
To create either one, pos must already
exist, and braces must be used to retrieve their values.
Names beginning with .sh are
reserved for use by ksh.:) is optional;
if it's included, var must be nonnull as
well as set.|
var
=
value ... |
Set each variable var to a value.
|
${
var
}
|
Use value of var;
braces are optional if var is separated from the following text.
They are required in
ksh93 if a variable name contains periods. |
${
var
:-
value
}
|
Use var if set; otherwise, use value.
|
let command performs arithmetic.
ksh88 is restricted to integer arithmetic.
ksh93 can do floating-point arithmetic as well.
The Korn shell provides a way to substitute arithmetic values
(for use as command arguments or in variables); base conversion
is also possible:
$((
expr
))
|
Use the value of the enclosed arithmetic expression.
|
|
B
#
n
|
Interpret integer n in numeric base B.
For example,
8#100 specifies the octal equivalent of decimal 64. |
|
Operator
|
Description
|
|---|---|
++ --
|
Auto-increment and auto-decrement, both prefix and postfix.
ksh93 only.
|
+
|
fc and hist commandsvi and emacs editors.
The history list is treated like a file. When the editor
is invoked, you type editing keystrokes to move to
the command line you want to execute. You can also
change the line before executing it. When you're ready
to issue the command, press the Return key.$ VISUAL=vi $ EDITOR=vi $ set -o vi Overrides value of VISUAL or EDITOR
vi starts in input mode;
to type a vi command, press the Escape key first.|
vi
|
emacs
|
Result
|
|---|---|---|
k
|
CTRL-p
|
Get previous command.
|
jsh -i Bourne shell ksh -m -i Korn shell (same as next two) set -m set -o monitor
%
n
%
s
%?
s
%%
%+
%-
bg
fg
sh)
or the Korn shell (ksh) can be invoked as follows:sh [options] [arguments] ksh [options] [arguments]
ksh and sh can execute commands from a terminal,
from a file (when the
first argument is an executable script), or
from standard input (if no arguments remain or if -s
is specified).
ksh and sh automatically print prompts if
standard input is a terminal, or if -i is
given on the command line.$1, $2, etc. If array assignment is in effect
(-A or +A), arguments are assigned as array
elements. If the first argument is an executable script,
commands are read from it, and the remaining arguments are assigned
to $1, $2, etc.-c
str
-D
$"..." strings in the program.
ksh93 only.-i
rksh Korn shell ksh -r set -r /usr/lib/rsh Bourne shell set -r
rksh or rsh
in the shell field of /etc/passwd
or by using them as the value for the SHELL variable.cd).rksh also
prohibits setting ENV and SHELL./ for command names or pathnames.> and >>).
ksh also prohibits the use of <>.ksh93).ksh
or sh to run the script.
This includes the /etc/profile,
$HOME/.profile, and $ENV files.