User Tools

Site Tools


This is an old revision of the document!

Quotas and disk space

Unix/Linux allows system administrators to give each user a disk space quota. You can monitor your allowance with the quota command. On my Mac it gives the following:

$ quota
Disk quotas for user asa (uid 501): none

On managed Linux system such as the one in the computer science department you will have one, especially if you're a graduate student!

When you run your own Linux/Unix machine you should keep track of overall disk usage e.g. using the df command:

$ df
Filesystem    512-blocks      Used Available Capacity  Mounted on
/dev/disk0s2   488555536 184269328 303774208    38%    /

However, since the output is not very readable, we'll use the -h option:

$ df -h
Filesystem      Size   Used  Avail Capacity  Mounted on
/dev/disk0s2   233Gi   88Gi  145Gi    38%    /

Either way, and especially if you're analyzing large datasets, you will need to remove some files at some point. And you would like to have a way of identifying where the largest contribution to your disk usage occurs. To do that, use the du command:

$ du cs580
4	cs580/playground/dir087
4	cs580/playground/dir025
4	cs580/playground/dir073
404	cs580/playground
408	cs580/

To make the output more readable use the -h option (h is for human):

$ du -h cs580
4.0K	cs580/playground/dir087
4.0K	cs580/playground/dir025
4.0K	cs580/playground/dir073
404K	cs580/playground
408K	cs580/

To get a summary without having it list every subdirectory you can use the -s option:

$ du -sh cs580/
408K	cs580/

Another useful option is the –max-depth option, which tells du to only list things up to a certain depth:

$ du -h --max-depth=1 cs580/
404K	cs580/playground
408K	cs580/

Note that this is the long version of the -d option: <code bash> $ du -h -d1 cs580/ 404K cs580/playground 408K cs580/ <code>

wiki/disk.1448657512.txt.gz · Last modified: 2016/08/02 14:47 (external edit)