User Tools

Site Tools


wiki:disk

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

wiki:disk [2015/11/27 13:51]
asa
wiki:disk [2016/08/02 14:47]
Line 1: Line 1:
- 
-===== 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: 
- 
-<code bash> 
-$ quota 
-Disk quotas for user asa (uid 501): none 
-</​code>​ 
- 
-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: 
- 
-<code bash> 
-$ df 
-Filesystem ​   512-blocks ​     Used Available Capacity ​ Mounted on 
-/​dev/​disk0s2 ​  ​488555536 184269328 303774208 ​   38%    / 
-</​code>​ 
- 
-However, since the output is not very readable, we'll use the ''​-h''​ option: 
- 
-<code bash> 
-$ df -h 
-Filesystem ​     Size   ​Used ​ Avail Capacity ​ Mounted on 
-/​dev/​disk0s2 ​  ​233Gi ​  ​88Gi ​ 145Gi    38%    / 
-</​code>​ 
- 
-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: 
- 
-<code bash> 
-$ du cs580 
-4 cs580/​playground/​dir087 
-4 cs580/​playground/​dir025 
-4 cs580/​playground/​dir073 
-... 
-404 cs580/​playground 
-408 cs580/ 
-</​code>​ 
- 
-To make the output more readable use the ''​-h''​ option (h is for human): 
-<code bash> 
-$ du -h cs580 
-4.0K cs580/​playground/​dir087 
-4.0K cs580/​playground/​dir025 
-4.0K cs580/​playground/​dir073 
-... 
-404K cs580/​playground 
-408K cs580/ 
-</​code>​ 
-To get a //summary// without having it list every subdirectory you can use the ''​-s''​ option: 
-<code bash> 
-$ du -sh cs580/ 
-408K cs580/ 
-</​code>​ 
- 
-Another useful option is the ''​--max-depth''​ option, which tells du to only list things up to a certain depth: 
-<code bash> 
-$ du -h --max-depth=1 cs580/ 
-404K cs580/​playground 
-408K cs580/ 
-</​code>​ 
-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.txt ยท Last modified: 2016/08/02 14:47 (external edit)