User Tools

Site Tools


how_to_find_the_size_of_folders

Differences

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

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
how_to_find_the_size_of_folders [2023/11/08 23:19] walkeradminhow_to_find_the_size_of_folders [2023/11/08 23:38] (current) walkeradmin
Line 1: Line 1:
 ====== How to Find the Size of a Folder ====== ====== How to Find the Size of a Folder ======
 <color darkorange>2016</color> <color darkorange>2016</color>
-\\  
 \\  \\ 
 <color red>Updated Nov 2023</color> <color red>Updated Nov 2023</color>
Line 17: Line 16:
 All the information present in this article is available in the man pages for du and df. In case you get bored reading the man pages and you want to get your work done quickly, then this article is for you.\\  All the information present in this article is available in the man pages for du and df. In case you get bored reading the man pages and you want to get your work done quickly, then this article is for you.\\ 
 \\  \\ 
 +----
 +==== Better Examples ====
 +To find the size of a directory that you are currently in
 +    du -h -s
 +For example, here is the contents of my home folder:
 +<file>
 +drwxr-xr-x. 2 root root  90 Aug  9 11:05 nics
 +drwxr-xr-x. 3 root root 135 Nov  8 18:22 openstack
 +drwxr-xr-x. 3 root root  17 Aug  9 11:12 streamer
 +</file>
 +To see the combined size of these folders, I use:
 +    du -h -s
 +This gives me the output:
 +    30G     .
 +Lets say I am interested in how much is in the 'streamer' folder (staying in /home) I can just add a '*' at the end.
 +    du -h -s *
 +This gives:
 +<file>
 +12K     nics
 +1.1M    openstack
 +30G     streamer
 +</file>
 +Lets use this command on the /home/streamer/bin folder:
 +    cd /home/streamer/bin
 +    ll
 +    drwxr-xr-x. 2 root root        128 Aug  9 11:15 1080i
 +    -rw-r--r--. 1 root root 2636986136 Aug  9 11:21 avp.ts
 +    drwxr-xr-x. 2 root root         44 Aug  9 11:15 bbc
 +    drwxr-xr-x. 2 root root        192 Aug  9 11:18 CRa
 +    drwxr-xr-x. 2 root root         67 Aug  9 11:18 example
 +    drwxr-xr-x. 2 root root         63 Aug  9 11:18 itv
 +    -rw-r--r--. 1 root root         87 Aug  9 11:21 kill_all_mpeg2ts_broadcaster.sh
 +    -rwxr-xr-x. 1 root root     825163 Aug  9 11:21 libos.so
 +    drwxr-xr-x. 2 root root       4096 Sep 20 15:53 MK.ts
 +    -rwxr-xr-x. 1 root root      17387 Aug  9 11:21 mpeg2ts_broadcaster
 +    -rw-r--r--. 1 root root  813563044 Aug  9 11:21 Oro4KTest.ts
 +    drwxr-xr-x. 2 root root        105 Aug  9 11:19 virgin
 +    drwxr-xr-x. 2 root root       4096 Aug  9 11:20 zb
 +Now I use the following:
 +    du -h -s 
 +The output is:
 +    30G     .
 +However, if I use the same with a star * at the end:
 +<file>
 +du -h -s *
 +
 +1.3G    1080i
 +2.5G    avp.ts
 +15G     bbc
 +502M    CRa
 +832K    example
 +576M    itv
 +4.0K    kill_all_mpeg2ts_broadcaster.sh
 +808K    libos.so
 +2.4G    MK.ts
 +20K     mpeg2ts_broadcaster
 +776M    Oro4KTest.ts
 +554M    virgin
 +7.5G    zb
 +</file>
 +\\ 
 +I could have done the same thing from say root by issuing the command:
 +<file>
 +du -h -s /home/streamer/bin/*
 +
 +1.3G    /home/streamer/bin/1080i
 +2.5G    /home/streamer/bin/avp.ts
 +15G     /home/streamer/bin/bbc
 +502M    /home/streamer/bin/CRa
 +832K    /home/streamer/bin/example
 +576M    /home/streamer/bin/itv
 +4.0K    /home/streamer/bin/kill_all_mpeg2ts_broadcaster.sh
 +808K    /home/streamer/bin/libos.so
 +2.4G    /home/streamer/bin/MK.ts
 +20K     /home/streamer/bin/mpeg2ts_broadcaster
 +776M    /home/streamer/bin/Oro4KTest.ts
 +554M    /home/streamer/bin/virgin
 +7.5G    /home/streamer/bin/zb
 +</file>
 +\\ 
 +\\ 
 +----
 ==== du - Finding the size of a directory ==== ==== du - Finding the size of a directory ====
 \\  \\ 
how_to_find_the_size_of_folders.1699485544.txt.gz · Last modified: 2023/11/08 23:19 by walkeradmin