IT 1100 : Introduction to Operating Systems
- Redirection and Compression
|
Command
|
Sample Usage
|
Description
|
|||||||||||||
|
cat
|
|
||||||||||||||
|
echo
|
echo “the blue dog does tricks” > echo-save.txt
echo “the blue dog does new tricks” >> echo-save.txt
|
echo text and redirect it to a file.
echo text and append it to the end of a file.
|
|||||||||||||
|
less
|
less myfile.txt
cat myfile.txt | less
|
display the contents of a file with the ability to navigate up and down
|
|||||||||||||
|
sort
|
sort myfile.txt
cat myfile.txt | sort
|
sort the output into alpha-numeric order based on the first word of the line
|
|||||||||||||
|
uniq
|
sort myfile.txt | uniq
|
remove duplicate lines that are adjacent to each other. best when used with the sort command
|
|||||||||||||
|
grep
|
|
||||||||||||||
|
wc
|
|
||||||||||||||
|
head
|
|
||||||||||||||
|
tail
|
|
||||||||||||||
|
tee
|
ls | tee -a file.txt
|
redirect standard output to both the terminal and append it to a file
|
|||||||||||||
|
ln
|
|
||||||||||||||
|
type
|
type foo
|
check if an alias name already exists as a command
|
|||||||||||||
|
alias
unalias
|
|
||||||||||||||
|
zip
unzip
|
|
||||||||||||||
|
bzip2
bunzip2
bzcat
|
|
||||||||||||||
|
gzip
gunzip
zcat
zless
|
|
||||||||||||||
|
tar
|
|
||||||||||||||
|
tar/gzip
|
|
||||||||||||||
|
tar/bzip2
|
|
||||||||||||||
|
> and >>
|
|
||||||||||||||
|
<
|
cat < ls-output.txt
|
redirect standard input from a file
|
|||||||||||||
|
2> and 2>>
/dev/null
|
|
||||||||||||||
|
&> and &>>
|
ls -l /bin/usr &> ls-output.txt
ls -l /bin/usr &>> ls-output.txt
|
redirect standard output and standard error to the same file
|
|||||||||||||
|
find
|
|
||||||||||||||
|
altogether now
|
|
||||||||||||||
|
| (pipe)
|
cat /etc/passwd | sort | less
|
redirect the standard output of one command to another command
|
|||||||||||||
|
locate
|
locate zip | grep bin
|
find files using a database. Searches for anything in the bin directory with the name zip. Example /bin/zip
|
|||||||||||||
|
updatedb
|
updatedb
|
update the locate database so it can find recently created files.
|
|||||||||||||
Last Updated 12/15/2017

