IT 244 – Chapter 3 The Utilities Special Characters

advertisement
IT 244 – Chapter 3
The Utilities
Special Characters
&;|*?‘“`[]()$<>{}#/\!~
Quoting of special characters: \, and the difference between “ and ‘ for command line
expansion.
Utilities
 Hostname
 ls
 less and more
o less is a GNU command, and more is from BSD UNIX
o less allows for scrolling up and down, used to be that more didn’t do
this, but some versions do this now.
o less shows end and doesn’t quit, but more just quits out
o show help for both with h
 cp (dangerous – use –i option)
 mv (same – use –i)
 rm (extremely dangerous - use -i)








cat
grep
head [n | -n count | -c bytes] [file list]
tail –f
sort
uniq
diff
file



echo
date
script


Pipe (|) – for example: ps –auxw | grep daemon
Redirect (>) - for example: writing a file: ls –l > filename, or reading a file:
echo < filename


todos / unix2dos (talk about the end of line [DOS – cr/lf], [UNIX – lf]
fromdos / dos2unix
Compression / Archiving (the common utilities)


bzip2 (-v is verbose) (-k keeps the original file)
o replaces the content of the file with compressed version. Doesn’t
change the create date of the file.
bunzip2
o decompresses back to original content
bzcat
o display a bzipped file
gzip – older and less efficient than bzip2
gunzip
compress
uncompress
tar (very common – pull down files on the internet [tarballs])
o [tape] archive – packs files/directories into archive
o a single file from multiple files – keeping the directory hierarchy
o [-c – create] [ -v – verbose] [-f – read or write to file]
o tar –cvf all.tar <filelist>
o [-t – list table of contents as list of files with their paths]
o tar –tvf all.tar
o [-x – extract files]
 NOTE: Very Dangerous!!! Overwrites!!!
 Unpacks per the directory structure given, so could unpack all
files here, or all files under a folder here, or all files relative to
root directory.
o tar –xvf all.tar
!!! Use bzip2, gzip, or compress to compress tarfiles




which
whereis
slocate
locate







Users
 who
 w
 finger
Communication
 write
 mesg
 wall (not in the book)
Download