Sei sulla pagina 1di 12

SUN-OS Command Summary

SunOs Command Table

User Environment

cat
cat [-s] [file...]
(concatenate) cat reads each filename in sequence
and displays it on the standard output

logname
show login name

-v

Display non-printing character (with the exception of TAB, NEWLINE, and FORMFEED characters) so that they are visible
-s
Suppress messages about files which cannot
be opened
cat file1
display file1 on your terminal

id
(identifier) show user and group number and name
who
who [file]
show logged in users
who am i

my own name

passwd
passwd [loginname]
change own password or as superuser change password of other user
su
su [-] [loginname]
(switch user) work as another user
If no username is specified, root is assumed
-

Perform a complete login

stty
stty [-a] [-g] [options]
(set tty) adjust and show terminal settings
-a
-g

cat file1 file2 > file3


concatenates the first two files and places the
result on the third
more, page
more [option] [file...]
page [option] [file...]
browse or page through a text file
tail, head
tail [option] [file]
display the first part of a file
head [option] [file]
display the last part of a file
-f
follow the growth of a file
tail -20 file
display last 20 lines of file

Report all of the option settings


Report current settings in a form that can be
used as an argument to another stty command.

umask
umask [nnn]
(user mask) mask to define the access control for
newly created files or shows the active mask

od
od [option] [file]
(octal dump) octal, decimal, hexadecimal, and ASCII
dump
-a

umask
show active mask setting

-c
-b
-x
od

umask 022
no write access for group and others

Basic File Handling Commands


pwd
(print working directory) show name of current directory

cp
cp file1 [file2...] target
(copy) copies the contents of file1 onto target

cd

-r, -R copy recursively


-i
Interactive. Prompt for confirmation whenever
the copy would overwrite an existing file
cp /usr/src/* .
copy all files from directory /usr/src into the
working directory

cd [directory]
(change directory) switch to another directory
ls
ls [option] [file...]
(list) show directory contents
-C
-F

-R
-a
-l
-g

Force multi-column output (default for video


terminals)
Mark directories with a trailing slash ( /),
executable files with a trailing asterisk ( *),
symbolic links with a trailing at-sign ( @)
Recursively list subdirectories encountered
List all entries, even hidden files (.)
List in long format (detailed information)
show the group ownership of the file in a long
output

interpret bytes as characters and display them


with their ASCII names
interpret bytes as ASCII characters
interpret bytes as unsigned octal
interpret words as hexadecimal
-c .
dump of the current directory

ln
ln [option] name [linkname]
(link) make hard or symbolic links to files
-s
-f

Create a symbolic link or links


Force a hard link to a directory - this option is
only available to the super-user
ln -s /usr/tmp symlink
create symbolic link of /usr/tmp to symlink in
your current directory

3-2

Theory of Operation
SunOs Command Table

mv

find . -name intro.ms -print


To find all the files called intro.ms starting from
the current directory

mv [option] file1 [file2...] target


(move) move or rename files
-f
-i

Force. Override any mode restrictions and the


-i option
interactive mode

rm

File and Filesystem Administration

rm [option] file
(remove) remove (unlink) files
-i
-r

find . -name \*.c -exec cp {} src/ \;


To copy all files with the extension c from the
current directory to the directory src

Ask whether to delete each file


Recursively delete the contents of a directory,
its subdirectories, and the directory itself

mkdir
mkdir dirname...
(make directory) create a directory
rmdir
rmdir dirname...
(remove directory) removes each named empty directory
diff
diff [option] file1 file2
(difference) display line-by-line differences between
pairs of text files
-i
Ignore the case of letters
dircmp
dircmp [option] dir1 dir2
(directory comparsion) compare directories
cmp
cmp [option] file1 file2
(compare) perform a byte-by-byte comparison of two
files

chmod
chmod mode file...
(change mode) change the permissions mode of a file

Absolute Modes
An absolute mode is an octal number constructed from the OR of the following modes:
400
Read by owner.
200
Write by owner.
100
Execute (search in directory) by owner.
040
Read by group.
020
Write by group.
010
Execute (search) by group.
004
Read by others.
002
Write by others.
001
Execute (search) by others.
4000 Set user ID on execution.
2000 Set group ID on execution (this bit isignored if
the file is a directory; it may be set or cleared
only using symbolic mode).
1000 Sticky bit, (If the sticky-bit is set on a directory,
an unprivileged user may not delete or rename
files of other users in that directory).

find
find pathname-list expression
find files by name, or by other characteristics
-name file
True if the filename argument
matches the current file name
-perm onum
True if the file permission flags
exactly match the octal number onum
-type c
True if the type of the file is c,
where c is one of:
b
for block special file c
c
for character special file
d
for directory
f
for plain file
p
for named pipe (FIFO)
l
for symbolic link
s
for socket
-user uname
True if the file belongs to the user
uname
-atime n
True if the file has been accessed
in n days
-exec command True if the executed command returns a zero value as exit status
-ok command
Like -exec except that the generated command is executed only upon response
y
-print Always true; the current pathname is printed

Siemens AG
TDF 9
Medizinische Technik Op

chmod 700 file1


rwx for the owner
chmod 4755 file1
SUID-bit, rwx for the owner, rx for group and
others

Symbolic Modes
u
Users permissions
g
Group permissions
o
Others
a
All, or ugo
+
To add the permission
To remove the permission
=
To assign the permission explicitly
permission is any combination of:
r
Read

P03-010.041.01.02.02
Rev.01
03.95

ISA / AS
System Manual

SUN-OS Command Summary


w
Write
x
Execute
s
Set owner or group ID
t
Set the sticky bit to save program
text between processes
chmod u+x bin/*
execute right for the owner for all files in directory bin

-i

du [ -s ] [ -a ] [ filename ... ]
(disk usage) display the number of disk blocks used
per directory or file
-a
-s

Generate an entry for each file


Only display the grand total for each of the specified filenames
du -a | sort -nr | more
displays that files or directories first, using most
disk space

chmod go=u file1


adjust rights for group and owner as others
chown
chown owner file...
(change owner) changes the owner of the filenames
to owner
-R

fsck
fsck [-b block#] [-y] [-n] [filesystem...]
file system consistency check and interactive repair
-b

Recursively descend into directories setting


the ownership of all files in each directory encountered.

-y

chgrp
chgrp group file
(change group) change the group ownership of a file
-R

Recursive. chgrp descends through the directory, and any subdirectories, setting the specified GID as it proceeds.

mkfs
/usr/etc/mkfs [...] raw special device
(make filesystem) construct a file system
You must be super-user to use this command
Note: file systems are normally created with the newfs
command

-n

update the super block; force changed blocks to the


disk
tar
tar [option] file...]
(tape archive) create tape archives, and add or extract
files

/usr/etc/newfs [option] [mkfs-option] raw-specialdevice


(new filesystem) create a new file system

-v

-r
-x
-t
-u
-c

Write the named files on the end of the tarfile


Extract the named files from the tarfile
List the table of contents of the tarfile
Add the named files to the tarfile
Create a new tarfile and write the named files
onto it
-v
Verbose
-f
Use the next argument as the name of the tarfile
tar cvf /dev/rst0 file
Create a tape archive

Print out the file system parameters without actually creating the file system
Verbose. newfs prints out its actions, including
the parameters passed to mkfs

mknod
/usr/etc/mknod filename [c] [b] major minor
(make node) build special file
Note: Normally you should use /dev/MAKEDEV instead when making special files
makedev
/dev/MAKEDEV device-name ...
make system special files

tar cvf /dev/rst0 .


opy the current directory into a new tape archive

mount, umount
mount [options] filesystem directory
umount [options] filesystem|directory ...
mount and unmount file systems
-a
-v
-t
-r

All. Attempt to mount or unmount all the file systems described in /etc/fstab
Verbose.
Specify a file system type like 4.2, nfs, hsfa etc
Mount the specified file system read-only

df
df [option] [file-system...]
(disk free) report free disk space on file systems

Use the block specified immediately after the


flag as the super block for the file system.
Block 32 is always an alternate super block.
Assume a yes response to all questions asked
by fsck; this should be used with extreme caution, as it is a free license to continue, even after severe problems are encountered.
Assume a no response to all questions asked
by fsck; do not open the file system for writing.

sync

newfs

-N

Report the number of used and free inodes

du

tar tvf /dev/rst0


Display the table of contents of a tape archive
tar xvpf /dev/rst0 fileA
Extract files from a tape archive, preserving
permissions
tar rvf /dev/rmt0 file
append to a tape archive (1/2-inch tape only)
dump
dump [ options [ arguments ] ] filesystem
dump [ options [ arguments ] ] filename ...
dump backs up all files in filesystem, or files

3-4

Theory of Operation
SunOs Command Table

0-9
The "dump level
a archive-file
Create a dump table-of-contents
archive in the specified file, archive-file
D
Diskette. Specify removable disk as the dump
media
f dump-file
Use dump-file as the file to dump
to, instead of /dev/rmt8
s size Specify the size of the volume being dumped to
u
Update the dump record
dump 0uDsf 300000 /dev/rsd6g /home
dumps the directory /home onto a removable
disk /dev/rsd6g (a Pioneer drive) with the media size of 300000kB

ls | cpio -o > /dev/mt0


To copy the contents of a directory into an archive
cpio -icd < /dev/rmt0
To read a cpio archive from a tape drive:
dd
dd [option=value] ...
(disk duplicate) convert and copy files with various
data formats

i
enter interactive restore mode
t
Table of contents
x
Extract the named files from the tape
a archive-fileThe dump table of contents is taken
from the specified archive-file instead of from a
dump tape
v
Verbose
f dump-fileUse dump-file instead of /dev/rmt? as the
file to restore from
s n Skip to the n'th file when there are multiple
dump files on the same tape
restore vf /dev/rsd6g
Restores from the SCSI drive /dev/rsd6g all files into the current directory

if=name
input file is taken from name
of=name
Output file is taken from name
ibs=n Input block size n bytes (default 512)
obs=n Output block size n bytes (default 512)
bs=n Set both input and output block size, superseding ibs and obs
conv=ascii
Convert EBCDIC to ASCII. ebcdic Convert ASCII to EBCDIC.
ibm
Slightly different map of
ASCII to EBCDIC.
block
Convert variable length
records to fixed length.
unblock
Convert fixed length records
to variable length.
lcase
Map alphabetics to lower
case.
ucase
Map alphabetics to upper
case.
swab
Swap every pair of bytes.
noerror
Do not stop processing on
an error.
sync
Pad every input record to
ibs.
dd if=/dev/rmt0 of=x ibs=800 cbs=80
conv=ascii,lcase
To read an EBCDIC tape blocked ten 80-byte
EBCDIC card images per record into the ASCII
file x

restore tvf /dev/rsd6g


List the contents of the dump in the SCSI drive
/dev/rsd6g

dd if=/dev/rsd5c of=/dev/rsd6c bs=1000k


does a one to one copy on the equal devices
sd5 and sd6

dump csf 1500 /dev/rst0 /export


dumps the directory /export to the cartridge of
the SCSI tape /dev/rst0 with the size of 1500
feet
restore
restore -irRtx [filename ...]
restores files from backup tapes created with the
dump command

cpio
cpio -o [aBcv
cpio -i [bBcdfmrsStuv6] [patterns]
cpio -p [adlmuv] directory
(copy file archives in and out) copies files in to and out
from a cpio copy archive
-i
-o
-p
d
c
t
u
v
l

copy in an archive
copy out an archive
One pass. Copy in and out in a single operation
Create directories as needed
Write header information in ASCII character
form for portability
Print a table of contents of the input archive
Copy unconditionally
verbose
Whenever possible, link files rather than copying them

Siemens AG
TDF 9
Medizinische Technik Op

File Manipulation
awk
awk [-Fc] program [ parameters] [file...]
pattern scanning and processing language
-Fc

Use the character c as the field separator (FS)


character
-f program-fileUse the contents of program-file as the
source for the program
awk -F: {print $1,\t,$3} /etc/passwd
print first and third parameter of every line seperated with a tab of the file /etc/passwd with
the fieldseperator :
awk -f awkprog filename
read program pattern from file awkprog and
use it to manipulate file filename
grep
grep [option] [regexp] [filename...]

P03-010.041.01.02.02
Rev.01
03.95

ISA / AS
System Manual

SUN-OS Command Summary


(global regular expression printer) search a file for a
string or regular expression.
A circumflex or caret (^) at the beginning of an entire
regular expression constrains that regular expression
to match an initial segment of a line
Invert the search to only display lines that do
not match
-c
Display a count of matching lines rather than
displaying the lines which match
-i
Ignore the case of letters in making comparisons - that is, upper and lower case are considered identical
-l
List only the names of files with matching lines
(once) separated by NEWLINE characters
-n
Precede each line by its relative line number in
the file
who | grep root
checks if root is locked in

sorted by the third field

Printing
lpr
lpr [-Pprinter] [-#copies] [-Ttitle] [-m] [-h] [filename...]
send a job to the printer

-v

-Pprinter
Send output to the named printer
-#copies
Produce the number of copies indicated for each named file
-Ttitle
Use title instead of the file name
-m
Send mail upon completion
-h
Suppress printing the burst page
lpr -Plaser filename
Print filename on printer laser
lprm
lprm [-Pprinter] [-] [job # ...] [username ...]
remove jobs from the printer queue

ls -l | grep ^.......r
show files with read access for others (r in position 8 of ls -l command)

-Pprinter
Specify the queue associated
with a specific printer
Remove all jobs owned by you
lprm 385

sed
sed [-n] [-e script] [-f sfilename] [filename]...
(stream editor) sed copies the filenames (standard input default) to the standard output, edited according to
a script of commands
-e scriptscript is an edit command for sed. If there is
just one -e option and no -f options, the -e flag
may be omitted.
-f sfilenameTake the script from sfilename
-n
Suppress the default output
sed -f sedprog < file.old > file.new
Edits file file.old according to the sed command
file sedprog and writes the result into the file file.new
sort
sort [option] [file...]
sort and collate lines
-c

Check that the input file is sorted according to


the ordering rules
-n
Numeric collating sequence
-d
Dictionary order
-f
Fold in lower case. Treat upper- and lowercase letters equally in collating comparisons
-m
Merge only, the input files are already sorted
-tc
Use c as the word delimiter character
-b
Ignore leading SPACE characters when determining the starting and ending positions of a
field
-i
Ignore characters outside the ASCII range
040-0176 in non-numeric comparisons
-r
Reverse the current collating sequence
-ooutput-fileDirect output to the file specified as output-file, instead of the standard output
sort -t: -n +2 -3 /etc/passwd
print contents of passwd in numerical order

lp
lp [-cmsw] [-ddest] [-nnumber] [-ooption] [-ttitle] filename...
(line print) lp arranges for the named files and associated information (collectively called a request) to be
printed by a line printer
-c

Make copies of the filenames to be printed immediately when lp is invoked


-m
Send mail after the files have been printed
-s
Suppress messages from lp such as request
id is ...
-w
Write a message on the users terminal after
the filenames have been printed
-ddest Choose dest as the printer that is to do the printing
-nnumberPrint number copies (default of 1) of the output
-ttitle Print title on the banner page of the output
cancel
cancel [id...] [printer...]
cancel requests to a printer
cancel 187
cancel lp
lpc
lpc [command[parameter...]]
(line printer control program) controls the operation of
the printer
lpstat
lpstat [-d] [-r] [-s] [-t] [-a[list]] [-c[list]]
(line printer status) display the printer status information
-d

Print the system default destination for output

3-6

Theory of Operation
SunOs Command Table

-r
-s
-t

requests
Print the status of the printer request scheduler
Print a status summary
Print all status information

send a signal to a process, or terminate a process


kill -9 1288
kill process with the id 1288 (ps)
kill -9 %1
kill job with the job id 1 (jobs)

Controlling Processes
pstat

ps

pstat [-afipSsT] [-u pid] [system[corefile]]


(print status) interprets the contents of certain system
tables

ps [option]
(process status) display the status of current processes
-a

Include information about processes owned by


others
-c
Display the command name
-e
Display the environment as well as the arguments to the command
-g
Display all processes
-l
Display a long listing
-u
Display user-oriented output
-x
nclude processes with no controlling terminal
The state is given by a sequence of four letters
First letter indicates the runnability of the process:
R
Runnable processes.
T
Stopped processes.
P
Processes in page wait.
D
Processes in non-interruptible waits; typically short-term waits for disk or NFS
I/O.
S
Processes sleeping for less than
about 20 seconds.
I
Processes that are idle (sleeping longer than about 20 seconds).
Z
Processes that have terminated and
that are waiting for their parent process
to do a wait ("zombie" processes).
Second letterindicates whether a process is swapped
out:
blank Represented as a SPACE character, in
this position indicates that the process
is loaded (in memory).
W
Process is swapped out.
Third letterindicates whether a process is running
with altered CPU scheduling priority (nice):
blankRepresented as a SPACE character, in
this position indicates that the process
is running without special treatment.
NThe process priority is reduced,
<The process priority has been raised artificially
Fourth letterindicates any special treatment of the
process for virtual memory replacement
jobs
show existing background jobs
kill
kill [-signal] pid...

Siemens AG
TDF 9
Medizinische Technik Op

-s
Print information about swap space usage
-u pid Print information about the process with ID pid.
vmstat
vmstat [-cfisS] [interval [count]]
(virtual memory statistics) Without options, vmstat
displays a one-line summary of the virtual memory activity since the system has been booted
-i
Report the number of interrupts per device
-S
Report on swapping rather than paging activity
vmstat -S 5
env, printenv
env [- [name=value...] [command]
obtain or alter environment variables for command
execution
-

Ignore the environment that would otherwise


be inherited from the current shell
name=valueSet the environment variable name to value
env prints actual environment variables
nice
nice [+n|-n] [command]
run a command at low priority
The higher the value, the lower the commands scheduling priority
nice -15 ps -l
increments the nice number for the command
ps -l to -15
sleep
sleep time
suspends execution for time seconds
(sleep 105; command) &
executes command after 105 seconds

Communication
mail
mail [option]
read or send mail messages
mail root@tdfisa
Sends a mail to user root on node tdfisa. To finish the entry of messages type <control> + D
(EOF) in a new line.
mail root < message.txt
Sends a mail to the user root on the own node.
The message to send has been already prepared in the file message.txt.

P03-010.041.01.02.02
Rev.01
03.95

ISA / AS
System Manual

SUN-OS Command Summary


mails are read by typing mail.

expr 17 % 5
Displays 2 on the screen

mails are deleted by typing mail and entering d to delete the current read mail.

expr 2 \* 5 + 3
Displays 13 on the screen

mail is terminated with q


touch

mesg

touch [-c] [-f] filename...


update the access and modification times of a file

mesg [y] [n]


permit or deny messages on the terminal
y
enable messages
n
disable messages
mesg
reports the current state without changing it

-c
-f
tee

tee [-ai] [filename]...


replicate the standard output

write
write username [ttyname]
write a message to another user
To write to a user who is logged in more than once,
use the ttyname argument to indicate the appropriate
terminal name.
write root ttyp3
writes a message to user root logged in at terminal ttyp3. To finish the entry of the message
type <control> + D (EOF) in a new line.
write root < message.txt
Writes a message to the user root. The message to send has been already prepared in the file
message.txt.

-a

Append the output to the filenames rather than


overwriting them
-i
Ignore interrupts
(date; df) | tee -a logfile
Display the date and the free disk space on the
screen and at the same time write into the file
logfile
uname
uname [-mnrsva]
display the name of the current system
-m
-n

wall
wall [ -a ] [ filename ]
(Write to all) write to all users logged in
-a
send the message even to pseudo terminals
wall -a message.txt
Sends the message text from the file message.txt to all users

-r
-s
-v
-a

date [-u] [-a [-] sss.fff] [yymmddhhmm [.ss]] [+format]


display or set the date

clear

-u
Display the date in GMT (universal time)
-a [-]sss.ffftell system to slowly adjust the time by
sss.fff seconds
date +DATE: %m/%d/%y%nTIME: %H:%M:%S
would generate the output:
DATE: 08/01/86
TIME: 14:45:05

clear the terminal screen


echo
echo [-n] [argument...]
writes its arguments on the standard output

echo $home
Displays the contents of the system variable
$home (login directory) on the screen.
expr
expr argument...
evaluates expressions as specified by its arguments
+
*
/
%

Add
subtract
multiply (must be masked with \)
divide
modulo operation

Print the machine hardware name.


Print the nodename. The nodename may be a
name that the system is known by to a communications network.
Print the operating system release.
Print the system name (default).
Print the operating system version.
Print all the above information.

date

Miscellaneous

-n
Do not add the NEWLINE to the output
echo 11 12
Displays 11 12 on the screen

Do not create filename if it does not exist


Attempt to force the touch in spite of read and
write permissions on filename

cal
cal [[month] year]
display a calendar
at
at [-csm] [-qqueue] time [date] [+ increment]
[script]
execute a command or script at a specified time
-c
-s

C shell. csh is used to execute script


Standard (Bourne) shell. sh is used to execute the job
-m
Mail. Send mail after the job has been run,
even if the job completes successfully.
-qqueue
Submit the job in queue queue

3-8

Theory of Operation
SunOs Command Table

rather than the default queue a.


at 1400 jan 12 < jobfile
execute at 12th of january the commands in
jobfile

cd

at 1200
switches to the vi to enter the commands that
have to be executed at 12 oclock. Put each
command into a single line. Finish the entry
with <control>+D (EOF) in a new line.

echo

at -l

fg

list all your defined at jobs

cd [dir]
chdir [dir]
(change directory) switch to another directory
echo [-n] list
writes its arguments on the standard output
exit
Terminate a subshell
fg [%job]
Bring the current or specified job into the foreground

batch
batch [csm] [script]
jobs queued with batch will execute as soon as the system load level permits execution.
-c
-s

C shell. csh is used to execute script


Standard (Bourne) shell. sh is used to execute the job
Mail. Send mail after the job has been run,
even if the job completes successfully.

-m

crontab
crontab [filename]
crontab [option] [username]
install, edit, remove or list a user's crontab file
-l
-r

List the user's crontab file


Remove the current user's crontab file from the
crontab directory
-e
edit users crontab file
Entry scheme:
5

4 *

2 3

4 5

1.
2.
3.
4.
5.

6.

history
history [-hr] [n]
Display the history list; if n is given, display only the n
most recent events
-r
-h
jobs
jobs [-l]
List the active jobs under job control
-l

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
-l
List the signal names that may be sent
kill -9 1234
kills process number 1234 (ps)

kill -9 %1
kill job with the id 1 (jobs)
logout
logout
Terminate a login shell
nice
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
nohup
nohup [command]
Run command with HUPs ignored (logout does not
stop execution of the command)

C-Shell-Built-in Commands
alias
alias [name [def]]
Assign def to the alias name

set

alias dir ls -F
creates an alias with the name dir, which may
be used as a new command.
bg
bg [%job] ...
Run the current or specified jobs in the background

Siemens AG
TDF 9
Medizinische Technik Op

List process IDs, in addition to the normal information

kill

df >> /home/user/df_log.txt

The minute field, which can have values between 0 and 59.
The hour field, which can have values between
0 and 23.
The day-of-month field, which can have values
between 1 and 31.
The month field, which can have values between 1 and 12, January to December.
The day-of-week field, which can have values
between 0 and 6. Sunday is 0 in this scheme.
For backwards compatibility, Sunday may also
be 7.
The command field is the command to be run.

Reverse the order of printout to be most recent


first rather than oldest first.
Display the history list without leading numbers

set [var [=value]]


set var[n] = word
With arguments of the form var = value set assigns value to var
With no arguments, set displays the values of all shell
variables
The defined variables are only true for the current shell

P03-010.041.01.02.02
Rev.01
03.95

ISA / AS
System Manual

SUN-OS Command Summary


set term=vt100
sets the terminal variable to vt100 mode
setenv
setenv [VAR [word]]
sets the environment shell variable VAR to the value
word, which must be either a single word or a quoted
string
With no arguments, setenv displays all environment
variables (printenv does the same)
The defined variables are true for the complete login
source
source [-h] name
Reads commands from name
-h

Place commands from the file name on the history list without executing them

time
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
umask
umask [value]
Display the file creation mask. With value set the file
creation mask. value is given in octal, and is XORed
with the permissions of 666 for files and 777 for directories to arrive at the permissions for new files (see chmod)
unalias
unalias pattern
Discard aliases that match pattern

<

Redirect standard input

<<xxx Read input up to a line identical with xxx


|

Pipe: redirect standard output to another command

| tee

Direct standard output to another command and a file

|&

Redirect standard output and standard error to


another command

Metacharacters
*

any string (except . at beginning)

a single character

[...]

one of the characters mentioned inside the brackets

[a-z]

a range of characters mentioned inside the brackets

[!...]

one of the characters not mentioned inside the brakkets

Quoting
\

Turns off the special meaning of any C shell metacharacter that immediately follows the backslash.

...

Single quotes turn off the special meaning of all C shell


metacharacters except backslash (\) and bang. (!)

"..."

Double quotes turn off the special meaning of all


C-shell metacharacters except back quote ( ), dollar
sign ($), backslash (\) and bang. (!)

unset
unset pattern
Remove variables created with set whose names
match pattern
unsetenv
unsetenv variable
Remove variable created with setenv from the environment

Redirection
>

Redirect standard output

>!

Redirect standard output, disregarding noclobber

>>

Redirect and append standard output

>>!

Redirect and append standard output, suppressing error and opening a new file if output file does not exist

Process Control
&

at end of the command runs the job in the background.

separator to enter more commands in a line

What follows in a line is a comment

cmd1 || cmd2
is not 0)

cmd2 is executed if cmd1 fails (exit-status

cmd1 && cmd2 cmd2 is executed if cmd1 was finished successfully (exit-status is 0)

Parameter Substitution
$var

contents of variable var

>&

Redirect standard output and standard error

>&!

Redirect standard output and standard error, disregarding noclobber

$?

Redirect and append standard output and standard error

predefined shell-variables:
TERM, HOME, USER, LOGNAME, PATH

>>&

>>&! Redirect and append standard output and standard error, suppressing error and opening a new file if output
file does not exist

set dir=/usr/bin;echo $dir


/usr/bin
exit-status of last command

vi Editor

3-10

Theory of Operation
SunOs Command Table
w
Cursor to begin of next word
b
Cursor to begin of previous word
0
Cursor to begin of line
$
Cursor to end of line
G
Cursor to last line of file
1G
Cursor to first line of file
<Control>+f
forward: advance one page
<Control>+b
backwards: advance one page backwards
<Control>+g
Show current line

Delete
<Backspace>
Delete last character in insertmode
x
extinct: cut character under cursor into buffer
dw
delete word under cursor
dd
delete line under cursor
D
delete to end of line

Copy
Y
nY
yy
yw
p

Finish and Save


ZZ
:wq
:q
:q!
:w

Exit editor and write changes to disk


Like ZZ
Quit editor if nothing was changed
Quit editor. Dont update changes on disk
Write changes to disk

Undo Changes
u
U
:e!
:q!

Undo last changes


Undo all changes of the line
Undo all changes since last save
Quit editor. Dont update changes on disk

Repeat Changes
.

Repeat the last change

Cursor Positioning
l or Cursor right
j or
Cursor down
h or Cursor left
k or Cursor up
+ or <Return> Cursor to begin of next line
Cursor to begin of previous line

Siemens AG
TDF 9
Medizinische Technik Op

Yank: copy active line into common buffer


Yank: copy next n lines into common buffer
copy active line into common buffer
copy from cursor to end of word into buffer
paste word of buffer at cursor position or paste line below cursor
paste word of buffer at cursor position or paste line
above cursor

Insert Text
i
l
a
A
o
O
cc
cw
C
s
S
r
R

insert left of cursor


insert at begin of line
append right of cursor
append at end of line
insert new line below cursor
insert new line above cursor
change complete line
change to end of word
change to end of line
substitute character
substitute line
replace character under cursor
replace from cursor position

Finish Insert Mode


<ESC> or <Control> + [

go back to command mode

File Access

P03-010.041.01.02.02
Rev.01
03.95

ISA / AS
System Manual

SUN-OS Command Summary


:w
:w filename
:n, mw filename
:r filename

write file to disk


write into file filename
write line n to m into file filename
read file filename to cursor position

Search
/string
/ or n
?string
? or n

search string from cursor position forward


repeat search forward
search string from cursor position backwards
repeat search backwards

Search and Replace


:s/old/new/

substitute old with new in current line

Set vi-Parameters
:set all
:set number
:set nonumber
:set showmode

show current parameters


switch on line numbering
switch off line numbering
switch on mode display

Miscellaneous
<Control> + l
refresh screen
<Control> + g
show cursor position
<Control> + v <Control> + (char)insert spec. char
<Control> + v <Control> + [ creates ESC

3-12

Theory of Operation
SunOs Command Table

Siemens AG
TDF 9
Medizinische Technik Op

P03-010.041.01.02.02
Rev.01
03.95

ISA / AS
System Manual

Potrebbero piacerti anche