CSCI 330 T Unix S: HE Ystem
CSCI 330 T Unix S: HE Ystem
Create
Edit
Display
Contents
Others
cat
vim,
emacs
nano,
etc.
Create Regular
Files
Redirect
Command
Output
See shell
Section
3
Example:
% cat > myfile
This is line 1 of input
Line 2 of input
^d
%
4
cat
more
less
pg
head
Display Text
File contents
tail
head
displays the beginning portion of indicated file(s);
the default head size is 10 lines.
tail
displays the ending portion of indicated file(s);
the default tail size is 10 lines.
PRINTING FILES
lpr
send a file to the default printer
printers available:
csl or
frl or
ucl or
lpcsl
lpfrl
lpucl
(default)
Example:
% lpr -P frl assign1.txt
10
PRETTY-PRINTING FILES
enscript
default: PostScript
Options:
-P
to specify printer
-w
to select output language
-o
to specify output file
11
12
Extract
contents
Compare
files
Count
words
Compress
contents
Sort
Unique
lines
Encrypt/
decrypt
Combine
contents
13
14
15
option -f
Example:
% cut -d: -f 5 /etc/passwd
16
17
18
Syntax: wc file-list
Commonly used options:
-l display the number of lines
-w display the number of words
-c display the number of characters
19
FILE COMPRESSION
utilities to compress and uncompress files
common on Linux:
.gz
Example:
% gzip assign1.txt
% gunzip assign1.txt.gz
gzip, gunzip
file extension:
Bzip2
Old
compress/uncompress (.Z)
Windows-compatible
zip/unzip (.zip)
Do not delete their input!
21
SORTING FILES
22
uniq
removes repeated lines from a sorted input file,
sending unique (unrepeated) lines to standard
output
23
2 kinds of limits:
Cannot be exceeded
24