ÌìÃÀ´«Ã½Ó°ÊÓ

print friendly version

Questions and answers

173
How do I check how much space my files are taking up on UNIX?


The commands described below need to be entered while logged in to the Unix server.   Normally you'll see a prompt ending with $ when the command interpreter (or shell) is ready for another command.

To find out your total disk space usage issue the command

du  -s  -k  ~

(note that the last character in this command is a tilde; this is used to signify your home directory)

Note that the command may take quite a long time before it shows any result.  The numbers shown on the left hand side in this command's results are in units of kilobytes, so 1000 is approximately the same as 1MByte.

The command

ls  -als

shows how big each file is (the sizes - in blocks - are shown on the left), and

ls  -aR

recursively goes through all your directories. You can combine these, so

ls  -alsR

should do what you want, except that if you have a large number of files, the information will shoot off the screen before you can read it, so you should 'pipe' the output to a pager, for example:

ls  -alsR | more

(note that the character between the R and more is a vertical bar symbol, signifying that the results from ls -alsR will be piped into more.

For more information on ls, see the man page

man  ls

If you have deleted all unnecessary files but still  require more space, then please go to

sussex.ac.uk/its/help

and follow the link to "Request for more file space"
 

Help us to improve this answer

Please suggest an improvement
(login needed, link opens in new window)

Your views are welcome and will help other readers of this page.

Categories

This is question number 173, which appears in the following categories:

Created by Andy Clews on 27 July 2001 and last updated by Andy Clews on 4 August 2015