Professional Documents
Culture Documents
rm *
Deletes all the files in the current directory
ls chap??
chap01 chap02 chap03
ls .???*
.bash_profile .exrc .netscape .profile
ls emp*lst
emp.lst emp1.lst emp22lst empn.lst
Latharani T R, Asst. Professor, Dept. of CSE,
9
AcIT.
The character class [ ]
ls chap0 [1 2 3 4]
chap01 chap02 chap03
ls chap0 [1 - 4]
chap01 chap02 chap03
ls chap0 [x - z]
chapx chapy chapz
[! a – z A – Z ]
Matches all filenames that don’t begin withan
alphabet.
• ls chap0 \ [ 1 - 3\]
$ wc
Count this input
And display
[ctrl-d]
Latharani T R, Asst. Professor, Dept. of CSE,
18
AcIT.
$ wc < sample.txt
3 14 71
• Keep the command ignorant of the source
• On the above command execution
– On seeing the <, the shell opens the disk file,
sample.txt for reading
– It unplugs the standard input file from its default
source and assigns to sample.txt
– Wc reads from standard input
• cat - f1
• cat f1 - f2
Latharani T R, Asst. Professor, Dept. of CSE,
19
AcIT.
Standard output
• Three possible destinations
– The terminal – default destination
– A file using the redirection symbols > and >>
– As input to another program using a pipeline
– $ cat newfile
$ cat errorfile
cat: cannot open f1
• Examples
• $ count = 5
• $ echo $count
• $ total = $count
• $ echo $total
$ cd $progs ; pwd
/home/kumar/progs
• $ file = $base’.c’
• $ file = $base’01’