Tutorial Six

 

Sections in this tutorial: 6.1 | Command Summary

Commands in this tutorial: df | du | file | gunzip | gzip | history

Other Useful Bash Commands

df

The df command reports on the space left on the file system. For example, to find out how much space is left on the fileserver, type

$ df .

du

The du command outputs the number of kilobyes used by each subdirectory. Useful if you have gone over quota and you want to find out which directory has the most files. In your home-directory, type

$ du

gzip

This also compresses a file, and is more efficient than compress. For example, to zip science.txt, type

$ gzip science.txt

This will zip the file and place it in a file called science.txt.gz

To unzip the file, use the gunzip command.

$ gunzip science.txt.gz

file

file classifies the named files according to the type of data they contain, for example ascii (text), pictures, compressed data, etc.. To report on all files in your home directory, type

$ file *

history

The C shell keeps an ordered list of all the commands that you have entered. Each command is given a number according to the order it was entered.

$ history (show command history list)

If you are using the C shell, you can use the exclamation character (!) to recall commands easily.

$ !! (recall last command)

$ !-3 (recall third most recent command)

$ !5 (recall 5th command in list)

$ !grep (recall last command starting with grep)

Summary


df . disk space on file system/td>
du disk usage
file determine type of file
gzip archive and compress
gunzip uncompress and unarchive
history show previous commands
! command recall