I want to see the current available disk space as well as how much the folder I am in is using. Is there some du/df command that not only tells me the size of my folder but also how much is still available in this directory ?
2 Answers
You can get the size of the disk usage of the current folder with the du command, using the "s" (summarize) option:
du -sk .
The "k" signifies the result is in kibibytes (i.e. 1024 bytes).
To get the capacity of the disk partition that this directory resides, then you can use the df command:
df -k .
This command returns the capacity of the whole disk partition, not specifically this directory.
Again the results are in kibibytes, so it will be more easily comparable to the result from the du command.
I think using df -h /YourDiskLocation
will resolve your problem, and here's an example of df
command:
$ df -h
Filesystem Size Used Avail Use% Mounted on
/dev/root 29G 11G 17G 39% /
devtmpfs 325M 0 325M 0% /dev
tmpfs 455M 0 455M 0% /dev/shm
tmpfs 182M 1.3M 181M 1% /run
tmpfs 5.0M 4.0K 5.0M 1% /run/lock
/dev/mmcblk0p1 253M 31M 222M 13% /boot
tmpfs 91M 20K 91M 1% /run/user/1000
And on 2nd
to 4rd
column, there shows total
、 used
and available
size, and for example you want to see the home directory usage, like this:
$ df -h /home
Filesystem Size Used Avail Use% Mounted on
/dev/root 29G 11G 17G 39% /
From the above information, /home
is mounted on /
, and 11G is used, 17G available.
And you can check this answers too:
Determine what device a directory is located on
Hope that helped you, and hope your understand my poor English!

- 16
-k
gives results in kibibytes (but on macOS maybe it gives results in*bytes
instead of*bibytes
) – Edgar Magallon Jan 23 '23 at 22:34h
instead ofk
which returns in human readable form likeKB
,MB
,GB
etc – Rahul Feb 28 '24 at 04:35