Viewing Disk Partitions and Directory Sizes

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Viewing Disk Partitions and Directory Sizes

579 Views
bonzo
NXP Employee
NXP Employee
Hi Everyone,

I came across a few commands I found very useful:  du, df, and cat

The first displays how much memory a directory uses.  This is helpful, for example, if you want to know the size the root file system you just built with LTIB.

du

Example:  So you want to find out how much space is use in /etc

du -h /etc

You may get a very long listing--all files and sub-directories.   But the last line gives you the grand total.  The -h means "human readable".

To get a quicker look (and avoid a large print out), you can look at just the last 10 lines of the listing (the "tail") this way:

du -h /etc | tail

Or to see just the last line:

du -h /etc | tail -n 1

You can find out more by typing:

man du

df

This is a useful for looking at how much disk storage is available.  This includes how much memory is available on the removable disk such as MMC.

df -h

Listing disk partitions

There are several ways to do this.  The quickest I've found is to type:

cat /proc/partitions

Besides listing the partitions, it tells you which drives and files are mounted.  Useful if you want to check if the MMC card is connected.



Again, the -h stands for "human readable"

You can find out more by typing

man df






 


0 Kudos
0 Replies