Deleting mail and files to save disk space

This page contains some simple information about finding out what is taking up disk space in your account, and how to go about reducing your disk usage. If you can't find an answer here or if you have any suggestions please send e-mail to ops@maths.tcd.ie.

Questions



Answers

How much disk space am I using?

Type the command
    du -s ~
The number that is printed is the amount of space in your home directory measured in kilobytes.

What's taking up all that space?

"du" is the most useful command for showing you what directories contain the most space. For example:
hamilton ~% du
16      ./VILEARN
48      ./Mail/inbox
842     ./Mail
4       ./.nn
5       ./.pgp
2       ./www
1952    ./mail
142     ./.netscape
3849
hamilton ~%
This gives you a breakdown of how much space is used by each directory. The above output indicates that there is approx 3.8Mb in the account, most of which is in the 'mail' and 'Mail' directories. For a graphical display of this information you can try:
    du | xdu

To find large files in the current directory, try the command:
    ls -la | sort -n +4 

or for other directories, something like 'ls -la www | sort -n +4' will work.

Reducing the size of particular files and directories


How do I delete files and directories?

The UNIX command for deleting things is rm. With its -r option it will remove whole directories. -i makes it ask for confirmation before deleting each file. For example:
    rm picture.gif
    rm -ir www
You can also use shell meta or wildcard characters, e.g.:
    rm *.jpg
    rm file?

Can I reduce the size without deleting?

If you have large files that you need to keep, for instance postscript images for a lab report, or data sets from a numerical experiment, you can compress them. To compress a single file:
    gzip lab.data
    gzip results.ps
To uncompress a single file:
    gunzip lab.data.gz
    gunzip results.ps.gz
You can also compress entire directories. Make sure to remove junk from them first, and to delete the directory after it is compressed.

project is directory containing C code, Makefiles, data etc,

    tar -zcf project.tar.gz project
check to make sure it worked
    tar -ztf project.tar.gz
remove the original
    rm -rf project
To uncompress the directory:
    tar -zxf project.tar.gz



Again, if you have any suggestions for improvements please let us know.

ops@maths.tcd.ie