Make better use of your disk space in Unix

On this page:

To effectively manage your disk space at Indiana University, you need first to determine the size of your disk space and how much of it you have used. On a Unix computer, to see how much disk space you are using and how much you are allowed to use, from the Unix shell prompt, enter:


To see how much space each file on your account takes, enter:

 ls -alR ~/

The command above shows a listing of all files in your account, including those in subdirectories. If you have many files and subdirectories, the output may be very long. To read it in page-sized chunks, use the pipe command to format it:

 ls -alR ~/ | more

See the following examples for ways to maximize storage on your Unix account without a space increase.

Delete backup and temporary files

Delete backup and temporary files of the form filename~ and #filename# by entering:

 rm *~ rm \#*
With some shells, you need to escape the # (pound sign) character with a \ (backslash) character, since otherwise the shell would treat the rest of the line as a comment.

Store temporary files elsewhere

Put temporary files in the directories /tmp, /scratch/username/, or /scr/username/ while you are using them (where username is your username).

Some systems may not have /scr or /scratch directories, or you may have to create your own subdirectory in /scr or /scratch. Files in these directories are periodically erased and are not counted against your space. For information about scratch space on IU's research systems, see Available access to allocated and short-term storage capacity on IU's research systems.

Compress files

Compress files using one of several Unix compression programs. To compress a file named bigstuff with the Unix gzip command, at the Unix prompt, enter:

 gzip bigstuff

The file will be replaced in your directory with a compressed file that has a .gz extension. You can't read files or run programs while they are in compressed format, so this command is most useful for storing things you want to keep but won't need to use soon. To expand the file back to its original state, enter:

 gzip -d bigstuff.gz

For more information about Unix compression utilities, see the online manual pages. At the Unix prompt, enter any of the following:

 man gzip man tar man zip man compress

Store unused files elsewhere

Download some of the files you are not using to a Windows or Macintosh computer and save them on the hard drive or a removable disk.

At Indiana University, for personal or departmental Linux or Unix systems support, see Get help for Linux or Unix at IU.

This is document aeel in the Knowledge Base.
Last modified on 2023-07-14 08:47:45.