| Unix | |||||||
| shells: | bourne $ /bin/sh | Korn $ /bin/ksh | C % /bin/csh | bourne-again (bash) $ |
root # | ||
| file system: | solaris = ufs | ||||||
| login ID's | /etc/passwd |
encrypted password /etc/shadow | solaris >6 chars 2+ alpha 1+ numeric | diff from old by 3 chars | . a hidden file |
||
| to change password |
passwd username newpassword |
rt click
screen>tools>terminal |
alt+f3 window to the back |
alt+f9 minimize |
alt+f4 close window |
||
| last=previous environmnet |
default=gnome |
failsafe=no startup scripts ran |
CDE MAIL: aliases for groups |
can't attach multi files |
answerbook 2 help manager |
||
| man -ks name |
name of command |
-k keywords |
-s section name |
in solaris root must run catman
-w for -k to work |
name -? quick help |
||
| info |
info info |
p previous node |
n next node |
m modename c cross reference |
info docs |
||
| hostname |
displays hostname |
uname -a |
expanded system info |
arp <hostname> |
host name ip address ethernet
address |
||
| domainname |
domain |
prtconf | grep Memory |
memory useage |
||||
| ctrl-q screen scroll |
crtl-c interupt process |
ctrl-d end of file |
quit window restart |
kill process id |
log out and back in again |
||
| relative path from pwd |
absolute path from top level |
$ commands [options] [arguments] |
cal |
date |
clear |
||
| ls -aAlFtdRn |
-a list all -A list all but no . or .. |
-l long -f filetype |
-t top order -n numeric ie 666 |
-d details (dir only) | -R recursive |
||
| * represent any character |
? match any one single char |
[ - ] range of chars |
> >> 2> <
redirection |
| pipe ! command redirection |
~ users home |
||
| more filename less filename |
display contyents of textfile filename |
spacebar scroll next screen return scroll one line |
b back one screen f forward one screen |
h help q quit |
/string search for string N next occurrence of string |
||
| ctrl-c interrupt process |
ctrl-s stop screen output eg
from cat |
ctrl-q resume screen output |
ctrl-d eof |
ctrl-u erase the commad line |
ctrl-w erase last word ctrl-h erase last char |
||
| file filename |
determines file type of filename |
strings filename |
print readable chars in filename |
cat |
cocatenate |
||
| head -n filename[s] |
display first n lines of filename |
default is 10 |
tail -n +n filename[s] |
-n last n lines in filename the last +n lines
starting from line n |
avoid *&|""$ in file or
directory names |
||
| wc -lwcm |
wordcount |
-l lines |
-w words |
-c bytes |
-m chars |
||
| diff -lc file1 file2 |
compares file1 file2 |
-l ignore case |
-c detailed comparison |
cmp |
as diff but only if file1 file2 differ |
||
| touch filename[s] |
create a new empty file
called filename |
has rw-rw-rw- 666 permission |
mkdir -p directoryname
directoryname |
make directory[subdirectory] |
-p parents |
||
| rm -ir |
delete files |
-i interactive ie confirm
deletion |
-r recursive ie all child items |
aliased to rm -i by default |
\rm rm not aliased |
||
| rmdir |
remove empty directorys |
cd |
change directory |
.. up one level ../.. up two levels |
|||
| cp -ir |
copy files directorys |
-i interactive |
-r recursive |
ln |
create a link |
||
| mv -i |
rename or move a file |
-i interactive |
|||||
| stdin |
standard input |
< 0< |
command
redirectionsymbol file |
||||
| stdout |
standard output |
> 1> |
|||||
| stderr |
standard error |
2> |
eg ls /etc > etc.list |
set -o noclobber |
prevent overwriting |
||
| pipe |
| |
a metacharacter |
command | command |
direct
output of one command into another command |
|||
| solaris partitions are slices |
0 root 1 swap 2 entire disk 3 usr 4 home |
/dev/dsk/controller cn target tn disk dn slice sn |
mount: the process of attaching a filesystem to an empty directory |
linux: primary partitions are /dev/hda1 2 3 4 first logical partition is /dev/hda5 one partition MUST be / |
next disk is hdb scsi drive is sdan |
||
| df |
show disk usage (solaris) |
du -sk |
show disk usage (linux) |
-s summary |
-k kilobytes |
||
| find
path -expression [action] |
find files |
-name
filename by name |
-type
filetype by filetype |
-perm mode by permission mode |
|||
| -mtime +n | older by n days |
-mtime -n | newer than n days |
-size
+n larger than n |
-
size -n smaller than n
byteblocks c bytes |
||
| -atime +n |
accessed before n |
-atime
-n |
accessed after n |
-group
groupid by group |
-user loginid by userid | ||
| -exec
command {}\; |
run the file[s] found |
-ok
command {}\; |
run the file[s] found
interactively |
-ls
print the path |
|||
| grep[options]
string filename |
find text string string in file filename n | egrep molre metacharacters |
|||||
| sed [options]
[address] filename [>newfile] |
stream
editor: find/ edit large strings |
s
search |
|||||
| -n |
dont print to screen |
p
except these lines |
'x,y' |
display lines x to y |
g
global |
||
| /
/ |
delimit
round char/string to search/ insert |
$
append |
^
insert |
d
delete |
|||
| sort
[options] input-filename |
-n
numeric |
-r
reverse order |
-f
fold ie ignore case |
+nM
by month |
|||
| -d
dictionary ie non ascii |
-o
output to filename |
+n -n begin the sort/ end the sort
after n |
-kn keyfields sort |
||||
| vi |
command mode |
a
append A append at the end of the line |
i insert o open new line |
ZZ
same as qw |
|||
| entry mode |
inserts appends deletes |
x
delete char dw delete word ndw dd delete line ndd replace n words lines |
cw
change word r replace char u undo previous |
yy
copy line (yank) p paste below current line P above current line |
|||
| last-line mode |
saves. use : first |
w
write |
q
quit |
q!
immediate quit |
|||
| cursor positioning: |
$
end of line o origin of line |
w
forward a word b back a word |
j
down a line k up a line |
spacebar
right one return origin of next line |
h
back one i forward one |
||
| G
last line of file :n go to line n |
!spell
word spell check !command run command |
/string
search forward for string ?string search backward |
n
next occurrence N previous |
||||
| emacs |
c-x
c-f open a file c-x c-v restart c-x c-s save c-x c-c exit emacs |
c-g
abort c-h help c-h t tutorial c-h ? see help options |
c-v
forward a screen tab-v back a screen c-l clear screen tab-x abort emacs |
c-a
beginning of line c-e end of line c-n next line |
c-p
previous line c-b back one char c-f forward one char |
||
| directory-user-group-others d rwx rwx rwx |
r=4 w=2 x=1 |
chmod nnn -r filename 777 etc -r recursively |
chmod ugoa =-+ filename user group other all |
= set - remove + add permission |
|||
| umask |
subtract
from numerical permissions |
chown new-owner filename | change owner | ||||
| who, finger |
displays
users currently logged in |
chgrp _R new-group filename |
change group |
||||
| su username |
sswitch user |
id |
displays current user |
||||
| who am i |
displays
current user, ignores su |
id -a |
displays all users |
||||
| lp options filename | -d destination ie not the default
printer |
-m
send mail that the ptint is complete |
-n
print n copies -o no banner page |
linux uses lpr |
|||
| lpstat options printer-queue-name |
-p display staus of all printers -o outstanding print staus if all print requests -d display default printer |
-t tell all -s summary -a accepting |
|||||
| cancel option request-id/userid |
in
solaris, cancel print jobs |
-u user's jobs |
|||||
| fdformat |
low level format a floppy |
mkfs |
make a unix file system on a
floppy |
mount |
mount a drive |
||
| umount |
unmount a drive |
||||||
| tar
[function] modifier
output-file filename |
compress
[options] filename |
makes a .Z file |
|||||
| tar |
[c] create |
f
file |
uncompress |
-v
verbose -c content ie view a .Z file |
decompresses |
||
| [t] able of contents |
v
verbose |
||||||
| [x] extract |
k
multispan |
jar |
similar
to tar but DOES compress |
||||
| cpio
[options][patterns] |
-o to
standard output (same as >) -v verbose ie print a list of filenames |
-t print a table of contents -p to path ie another directory |
-O output file name -i import -I input |
||||
| kill (-signal) process-id/%job-id |
-15
SIGTERM end properly -9 SIGKILL end abrubtly |
pkill solaris |
killall linux |
||||
| jobs |
display all background jobs |
bg |
place a job in the background |
fg |
place a job in the foreground |
||
| stop |
suspends a job |
||||||
| at
[time-spec][scriptfilename/command] |
at 03:00
1 jun 2004 find . -name *.jpg |
||||||
| crontab [mins hrs date mnth day-ofweek] [scriptfilename/command] | |||||||