UNIX Tutorial Six

Other useful UNIX 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 kilobytes 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 reduces the size of a file, thus freeing valuable disk space. For example, to zip code-challenge.txt, type

$ gzip code-challenge.txt

This will zip the file and place it in a file called code-challenge.txt.gz

To unzip the file, use the gunzip command.

$ gunzip code-challenge.txt.gz

history

The Bash 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)

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)