For the past few days I have been getting emails from System Administration (SysAdmin) telling me 'DISK QUOTA EXCEEDED', so I think it's about time I do something about it. First thing I want to do is check where and how much disk space I am using, and secondly...can I delete/backup this data?
So what are the commands I need to use? Well the simple answer is 'df' and 'du', but whats the difference?
df = report file system disk space usage
du = estimate file space usage
So what are the commands I need to use? Well the simple answer is 'df' and 'du', but whats the difference?
df = report file system disk space usage
du = estimate file space usage
df
Syntax: df |OPTION| |FILE_NAME|
The command 'df' can come in the following possible formats:
[NB: If you do not enter a file_name the output will be displayed for all files on the system.]
du
Syntax: du |OPTION| |FILE_NAME|
The command 'du' has the following available options to it:
Examples
du -hs /file_name/ - this will return the total size of directory 'file_name' in a readable form.
du -hsc /file_name/* - this will return the total size of the directory 'file_name' and also the total size of each file within that directory.
du -s /file_name/* - this will return the total size (in bytes) of each file within the given directory 'file_name' (but not the total size of that given directory).
You can find out lots more at this site http://www.codecoffee.com/tipsforlinux/articles/22.html
lots of good info and descriptions.
Syntax: df |OPTION| |FILE_NAME|
The command 'df' can come in the following possible formats:
- df -k (will output values in KB)
- df -h (will output in readable format)
- df -i (information about inodes)
- df -k [file_name] (details about a specific file ie. df -k /documents/ )
[NB: If you do not enter a file_name the output will be displayed for all files on the system.]
du
Syntax: du |OPTION| |FILE_NAME|
The command 'du' has the following available options to it:
- -a (returns individual file and directory sizes)
- -s (returns a total size for each directory)
- -h (makes result more readable (M instead of bytes))
- -c (returns total size of all files)
Examples
du -hs /file_name/ - this will return the total size of directory 'file_name' in a readable form.
du -hsc /file_name/* - this will return the total size of the directory 'file_name' and also the total size of each file within that directory.
du -s /file_name/* - this will return the total size (in bytes) of each file within the given directory 'file_name' (but not the total size of that given directory).
You can find out lots more at this site http://www.codecoffee.com/tipsforlinux/articles/22.html
lots of good info and descriptions.