| 1. Looking inside files: |
|
|
| % cat |
[concatenate] |
| % more file |
[show file: Space,Enter,b] |
| % head file |
[first lines] |
| % tail file |
[last lines] |
| % wc file |
[word counts] |
| % diff file1 file2 |
[compare files] |
| % od -c file |
[display character map] |
| % fold -n file |
[print the file using n chars/line] |
| | |
| % cat file1 file2 |
[concatenate files] |
| % cat file1 |
[show file] |
| % head -n file |
[first n lines] |
| % tail -n file |
[last n lines] |
|
|
| 2. Compressing files and directories: |
|
|
| % gzip file |
[compress file] |
| % gzip -d file.gz |
[uncompress file] |
% tar -cvf file.tar directory |
[create a tar-file from dir] |
% tar -xvf file.tar |
[create a dir from tar-file] |
| | |
% tar -zcvf file.tar.gz directory |
[create and compress a tar-file] |
% tar -zxvf file.tar.gz |
[uncompress a tar-file and create the dir] |
|
|
| 3. I/O redirection: |
|
|
| % command > out_file |
[standard output to file] |
| % command >> out_file |
[append] |
| % command < in_file |
[standard input from file] |
| % command 2> err_file |
[standard error to file (bash)] |
| % command >& err_file |
[standard error to file (tcsh)] |
| | |
| % ls > ls.out |
[output redirection] |
| % cat > mytext.out |
[use C-d to finish] |
|
|
| 4. Process management (multitasking): |
|
|
| % command |
[foreground, C-z, C-c] |
| % command & |
[background] |
| % ps |
[process status] |
| % kill -9 pid |
[cancel a process] |
| % top |
[system info] |
| % nice command |
[set priority] |