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
-
stty
stty [-a] [-g] [options]
(set tty) adjust and show terminal settings
-a
-g
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
cp
cp file1 [file2...] target
(copy) copies the contents of file1 onto target
cd
cd [directory]
(change directory) switch to another directory
ls
ls [option] [file...]
(list) show directory contents
-C
-F
-R
-a
-l
-g
ln
ln [option] name [linkname]
(link) make hard or symbolic links to files
-s
-f
3-2
Theory of Operation
SunOs Command Table
mv
rm
rm [option] file
(remove) remove (unlink) files
-i
-r
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
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
-i
du [ -s ] [ -a ] [ filename ... ]
(disk usage) display the number of disk blocks used
per directory or file
-a
-s
fsck
fsck [-b block#] [-y] [-n] [filesystem...]
file system consistency check and interactive repair
-b
-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
-v
-r
-x
-t
-u
-c
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
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
sync
newfs
-N
du
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
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
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
P03-010.041.01.02.02
Rev.01
03.95
ISA / AS
System Manual
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
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
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
Controlling Processes
pstat
ps
ps [option]
(process status) display the status of current processes
-a
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
-
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
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
mesg
-c
-f
tee
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
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
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
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
date
Miscellaneous
-n
Do not add the NEWLINE to the output
echo 11 12
Displays 11 12 on the screen
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
3-8
Theory of Operation
SunOs Command Table
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
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
-m
crontab
crontab [filename]
crontab [option] [username]
install, edit, remove or list a user's crontab file
-l
-r
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 -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
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.
P03-010.041.01.02.02
Rev.01
03.95
ISA / AS
System Manual
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
<
| tee
|&
Metacharacters
*
a single character
[...]
[a-z]
[!...]
Quoting
\
Turns off the special meaning of any C shell metacharacter that immediately follows the backslash.
...
"..."
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 and append standard output, suppressing error and opening a new file if output file does not exist
Process Control
&
cmd1 || cmd2
is not 0)
cmd1 && cmd2 cmd2 is executed if cmd1 was finished successfully (exit-status is 0)
Parameter Substitution
$var
>&
>&!
$?
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
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
Undo Changes
u
U
:e!
:q!
Repeat Changes
.
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
Insert Text
i
l
a
A
o
O
cc
cw
C
s
S
r
R
File Access
P03-010.041.01.02.02
Rev.01
03.95
ISA / AS
System Manual
Search
/string
/ or n
?string
? or n
Set vi-Parameters
:set all
:set number
:set nonumber
:set showmode
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