Linux Quick Reference: How do I get the size of a folder, a file or a disk

+1 vote
Good day to you!

Please find below my brief cheat notes on finding out the size of a folder, a file and a disk quickly in Linux system.
asked Jan 13, 2017 in System administration by Brian

17 Answers

0 votes

Below, there is my cheat sheet on the useful commands in Linux. If you have forgotten the command you need, you can always look it up here. The most frequently used commands are marked in bold type. 

Finding out the size of a file

To find out the certain file size, type in the following command:

du -h /file_path/file name
du -h.  /file name – if the file is located in that very folder where you are now 

The parameter –h should be added in order to get an understandable representation of the file size.

Finding out the size of a file

To display the list of all files with their size, type in:

ll -h – to display the current folder list
ll -h /path to the folder with files

Finding out folder size in Linux

To find out the size of a folder, use the command:

du -sh  - the current folder size
du -sh /folder_path

h – display the size in understandable representation, s – display the final size only (without the list of all sub-catalogues and files)

Finding out folder size in Linux

If you need to display the list of all sub-folders of the current folder with their size stated – use ll command; the same is used for files.

Finding out disk size, used and empty disk space

To display the list of all mapped disks and file systems, where the total size, as well as empty and used space will be stated, type in the command:

df -ah

The result will look something like this:

Finding out disk size

The lines starting with /dev/ are physical disks; further you can see file systems, located on these disks. Parameter “-a” is necessary for displaying the information about all the disks, installed in the system.
If you have any questions left or need some details – please, ask a question or leave a comment.

answered Jan 13, 2017 by Expert Brian (5,410 points)
0 votes
viagra in bangalore <a href="">buy viagra in toronto</a> viagra online overnight [url=]viagra for sale[/url] ’
answered Jan 26 by Lbgdreve
0 votes
buy viagra in australia <a href="">buy viagra 100 mg</a> pink viagra [url=]what to say to get viagra[/url] ’
answered Feb 1 by Jdbxdreve
0 votes
national pharmacies online <a href="">prescription online</a> canadian online pharmacies
answered Feb 3 by KbcxBogs
0 votes
best price viagra <a href=" ">brand viagra</a> super viagra
answered Feb 4 by FvfcBiort
0 votes
wholesale generic viagra <a href=" ">viagra free trial online</a> viagra soft taps
answered Feb 4 by Kuikshove
0 votes
international pharmacies that ship to the usa <a href=" ">canada pharmaceutical online ordering</a> canadian drug store
answered Feb 4 by Jbbvdreve
0 votes
discount prescription drugs online <a href=" ">hepatitis c virus (hcv)</a> canadian drugs pharmacy
answered Feb 6 by JbnbDully
0 votes
cialis  paypal <a href=" ">canadian pharmacy no prescription generic cialis</a> cialis free trial canada
answered Feb 7 by Aqcfslabledia
0 votes
generis viagra <a href=" ">viagra online samples</a> buying viagra online in montreal
answered Feb 9 by NncsBiort
Welcome to Help Desk, here you can ask any questions and receive answers from our experts and other members of the community.

If you have any questions, please do not hesitate to contact our help desk!

Make a question!