2

If I look at "properties" under /home/user/Desktop in the GUI (nautilus), it shows free space as 137.3 GB. However, if I execute df . -kh it shows 128 GB available.

Why are these different? Which one should I believe if I need the exact free space of PWD?

3

One program is showing the free space in decimal (10^9) gigabyes (GB), the other is showing it in binary (2^30) gigabytes (GiB); 128 GiB = 137.4 GB. For df you can specify whether you want decimal or binary units:

$ df -h . # -h requests binary units
Filesystem                 Size  Used Avail Use% Mounted on
/dev/mapper/Serverax-Home  9.3G  420M  8.4G   5% /home

$ df -H . # -H requests decimal units
Filesystem                 Size  Used Avail Use% Mounted on
/dev/mapper/Serverax-Home   10G  440M  9.0G   5% /home

See man df for details.

  • so which are we using normally in day-to-day life? should i need to go with binary units or decimal units? – Mani Dec 15 '16 at 11:35
  • Normaly I use 'df -h' but in day-to-day operations it doesn't matter, as long as you have some free space. Anyway, for performance reasons, you wont like to fill up your filesystem more that 80%. – Soren A Dec 15 '16 at 11:43
  • @Mani: In real life until the 1990s binary units were traditionally used only for memory (RAM or ROM). Then Windows started using binary units for storage space, and other operating systems followed. Hard disk manufacturers still give disk capacities in decimal units; for example, a 1TB hard disk has about 1,000,000,000,000 byes, not 1,099,511,627,776. SSD capacities are quoted in binary units, but capacities of USB flash drives are usually given in decimal units. Bandwith is always given in decimal units -- 10 megabits/second means 10 million bits per second. – AlexP Dec 15 '16 at 11:57
  • @Mani go with binary units. The reality is that computers systems use binary. On physical level, disk memory is divided into blocks of specific size. The decimal system is nice for us humans, but that's not how things works in actuality. Besides, if you are switching to different Linux distro or maybe even different OS ( like FreeBSD for example ), you will quickly learn that GUI tools aren't always available. On the other hand, the standard unix command line utilities such as df are fairly consistent and exist almost on any *nix OS, from Solaris to BSD. – Sergiy Kolodyazhnyy Dec 15 '16 at 12:09
  • 1
    @AlexP do you have a source for the statement about Windows starting to use binary units and others adopting it ? Because I've Unix System V book from like 1995, and in their man pages it says df utility uses blocks of 1024 of their units, and there's no -H option. What I mean to say is that it looks like the opposite is true - Windows started using the "human readable" base 10 form, and then others adopted it. – Sergiy Kolodyazhnyy Dec 15 '16 at 12:12

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.