du -csh /
The above will take huge amount of time to calculate,is there a way to see the less accurate result with less overhead?
UPDATE
What I want to know is the total size under a specific directory.
du -csh /
The above will take huge amount of time to calculate,is there a way to see the less accurate result with less overhead?
UPDATE
What I want to know is the total size under a specific directory.
As far as a more optimized version
du
, I am not aware of one. The things that come to mind are:stat -c '%h'
) - 2.Out of all these, the quota and dedicated partition options are probably the easiest and most efficient.
The problem is that 'du' has to enumerate every object in the sub-tree. This is a metadata intensive operation, and takes a while for most Linux filesystems. Some filesystems, NTFS and Novell's NSS come to mind, have the ability to keep track of directory sizes like this in the metadata which makes this operation vastly faster. Generally, if your file-system supports directory quotas of some kind, it has to keep track of this data internally for enforcement, every size-change is replicated up the directory-tree to the quota-point (NTFS) or every directory (NSS) when it happens, so getting a directory-tree size is very fast.
Unfortunately, there isn't a way to make du run faster, just work-arounds.
Gives you the sizes in human KB/MB/GB format from your current working directory.
With the standard tools you have to get the size of every file in the directory each time you want to know the total size. A possibly more efficient way to do it would be to have a "directory size monitor", which keeps track of the current size of the directory. There is no such thing (that I know of), but you could implement one with
inotify
. Possibly not with bash (andinotify-tools
), but you could probably use python and pyinotify, for example.You might find
gt5
to be useful. It stores the most recentdu
information and does a diff against that the next time it's run. It displays its output using a text-mode browser such aslinks
.Also, consider the -x option on du -- "one file system" if your doing
You'll only see the disk usage summary on your root partition, and it won't try to add up /proc, /sys, /dev, and so on...
if you only want disk usage for root file system, then
df -h /
No. Could you periodically do a du piped to a text file, in a cron job set to run overnight, so you've got not quite current data immediately available?
Note that measuring the disk space used by a folder containing a large no of files under Windows similarly takes some time.
df -h will do the trick
df -kh /
this will show you the amout of disk space used and available.