Loughborough University
Leicestershire, UK
LE11 3TU
+44 (0)1509 222222
Loughborough University

IT Services : High Performance Computing

Linux Tutorial Six


Other useful Linux commands

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 compresses a file, like zip on Windows (note that often zip and unzip are also available on Linux). 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 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
      

You can use the exclamation character (!) to recall commands easily.

Recall last command

!! (recall last command)
        

recall third most recent command

!-3 () 
        

recall 5th command in list

!5 () 
        

recall last command starting with grep

!grep () 
        

You can increase the size of the history buffer by typing

set history=100 
        

Attribution

Original version by M.Stonebank@surrey.ac.uk, 9th October 2000. Modified by a.turner@lboro.ac.uk, 2015.