Doing More with SunOS
1.0 Files
1.1 Filename Substitution
Wild Cards ? and *
Character Class [c...]
Rangle [c-c]
c is any single character.
String Class {str{,str]}
str is a combination of characters, wild cards, embedded
character classes and embedded string classes.
Home Directory /home/user_name
List Hidden Files ls -la
1.2 File Properties
Seeing Permissions ls -l filename
Changing Permissions chmod nnn filename
chmod c=p...[,c=p...] filename
n, a digit form 0 to 7, sets the access level for the user
(owner), group, and others (public), respectively.
c is one of: u - user, g - group, o - others; or a - all.
p is one of: r - read access, w - write access,
or x - execute access.
Setting Default Permissions unmask ugo
ugo is a (3-digit) number. Each digit restricts the default
permissions for the user, group and others, respectively.
Changing Modification Time touch filename
Making Links (hard) ln oldname newname
(symbolic) ln -s oldname newname
Seeing File Types ls -F
1.3 Searching with more
Run more more filenames
Next Line RETURN key
Next 11 Lines d
Next Page SPACE BAR key
Search for Pattern /pattern
Next Occurrence n
Next File :n
1.4 The Directory Stack
Change Directory, Push pushd directory
Change to Top Directory, Pop popd
Show Stack dirs
2.0 Commands
2.1 Command-Line Special Characters
Quotes and Escape
Join Words "..."
Suppress Filename, Variable Substititions '...'
Escape Character \
Separation, Continuation
Command Separation ;
Command-Line Continuation \RETURN
2.2 I/O Redirection and Pipes
Standard Output >
>!
Appending to Standard Output >>
>>!
Standard Input <
Standard Error and Output >&
Standard Error Separately
( command > output ) >& errorfile
Pipes/Pipelines command | filter [ | filter ]...
Duplicating Displayed Output
command | tee filename
Filters
Word/Line Count wc [-l]
First n Line head [-n]
Last n Lines tail [-n]
Skip to Line n tail [+n]
Show Nonprinting Characters cat -v
Sort Lines sort [-n]
Format Paragraphs fmt
Reverse Character Order rev
Multicolumn Output pr -t
List Spelling Errors spell
Substitutions in Output Stream sed -e "s/pattern/string/[g]"
Report-Generation awk
2.3 Searching with grep
grep Command grep "pattern" filename
command | grep "pattern"
grep Search Patterns
beginning of line ^
end of line $
any single character .
singe character in list or range [...]
character not in list or range [^...]
zero or more of preceding character
or pattern *
zero or more of any character .*
escapes special meaning \
3.0 C-Shell Features
The History List
Set Up History List set history=n
See History List history [-h]
Event Designators
Repeat Previous Command !!
Display Previous Command !!:p
Command Line n !n
n Commands Back !-n
Command Beginning with str !str
Command Containing str !?str[?]
All arguments to Previous Command !*
First argument to Previous Command !^
Last argument to Previous Command !$
n'th Argument !:n
Word Designators
All Arguments :*
First Arguments :^
Last Arguments :$
n'th Argument :n
Arguments x Through y :x-y
Modifiers
Print Command Line :p
Substitute Command Line :[g][s]/l/r/
3.2 Aliases
alias Command alias name 'definition'
definition can contain escaped history substitutions, event and
word designators as placeholders for command-line arguments.
3.3 Variable Substitution
Creating a Variable set var
Assigning a Value set var = value
Expressing (Using) a Value $var
Displaying a Value echo var
value is a single word, and expression in quotes, or an
expression that results in a single word after variable,
filename, and command substitution takes place.
Assigning a List set var = (list)
list is a space-separated list of words, or an expresssion
that results in a space-separated list.
Selecting the n'th Item $var[n]
Selecting all Items $var
Selecting a Range $var[x-y]
Item Count $#var
3.4 foreach Lists
Start foreach Loop foreach var (list)
foreach prompts for commands to repeat for each item in
list (with >), until you type end. Within the loop,
$var stands for the current iterm in list.
3.5 Command Substitution
Replace Command with its Output on the Command Line `...`
3.6 Job Control
Run Command in the Background &
Stop Foreground Job CONTROL-Z
List of Background Jobs jobs
Bring Job into Foreground %[n]
4.0 Processes
Listing ps -[aux]
Terminating kill [-9] PID
Timing time command
Scheduling at time[a|p] script
time is a number up to 4 digits. script is the name
of a file containing the command line(s) to perform.
5.0 Users
Seeing Who Is Logged In who
w
Changing identities su [username]
Seeing Your User Name whoami
who am i
who is this
id
6.0 Managing Files
6.1 Looking Up Files
Standard Commands whereis filename
Aliases and Commands which command
Describe Command whatis filename
Searching Out Files find dir -name name -print
dir is a directory name within which to search. name is
a filename to search for.
6.2 Tracking Changes
Comparing Files diff leftfile rightfile
diff prefixes a left angle-bracket (<) to selected lines from
leftfile and a right angle-bracket (>) to lines from
rightfile.
(C) Copyright 1988 Sun Microsystems
Press here to return to the Basic Unix Help Menu