I tried du but that doesn't output the empty space of a folder. Any commands to do this?

  • 3
    That doesn't mean anything. A folder can have any space wanted. Do you mean free space on a partition/fs. Try df -h
    – solsTiCe
    May 20, 2015 at 10:18

3 Answers 3


Folders are as big as the total size of their contents; they do not have any free space.

The df command shows empty disk space.

  • 4
    Strange. You got a down-vote...not sure why (answer is perfectly fine) but you did. Our site needs more upvotes, here's one to remove that nasty -1 ;) May 20, 2015 at 13:09
  • 1
    – Wilf
    Jun 2, 2015 at 18:08

There is no meaning of a folder size. In really a folder/directory is just a File in Linux as the concept everything is a file in Linux.

So a folder is a file of files. I,e it's just a place to hold files, though it has no size, its size is related to the size of files inside.

So, there is nothing called free space on a folder.

You can know the size of a directory

du -sh

also you can know the free space of your whole filesystem

df -h

Just to clarify it a little more (hope i do not miss any special filesystem):

  • Folders are a small file
  • Folders grow as more files / sub folders are added to it (but not to a sub folder of it), only directly to it
  • Folders (on some systems do not) decrease on size when files / sub folders directly on it are removed from it
  • Think on folders as a phonebook list
  • Most filesystems leave empty entries on folders (just to not move all the rest up), so size most of the times only grows
  • Folder size does not include any file size (unless such folder is a container where talking about free space may have a meaning: size to reach max container size)
  • Folder size depends on the number of entries (including the ones than have been blanked) ceiling it to a multiply of a number
  • Folders does not hold inside it any content of any file (except special folders that are really a container, with or without a max size defined)

At least for FAT12, FAT16, FAT32, exFAT, NTFS, ext, ext2, ext3, ext4, and maybe for much more filesystems, folders are a small file that identifies what folders and files are under it, just like a phonebook list, it only describes what is inside it (beware: only directly on it, nothing about what is inside any sub folder).

NTTS has some extra things, but all has it's unique identificator (a number), folders identify only what of such identificators are just directly on such folder, not the ones that are in a sub folder of it, etc.

Beware there are filesystems very special, on that ones a Folder can have a size (upper limit) and so it has sence to talk about free space inside that folder.

For most Linux users to understand that, treat such Folder as a Container with a max size, concept is near the VDI files of VirtualBOX, etc. They can grow up to a limited size. Some special filesystems use that concept for a Folder, while others (like Pismo Private Folders) use a no max size limit.

For most Windows users to understand that, treat such Folder a a sparse big file, that with some 3rd part tool is seen as a folder.

In other words, the are three common well defined type of thing on a file system (including some special filesystems not so much common to see):

  1. Files (hold information, or links to other files)
  2. Normal folders, they are really a small file (hold a list of what is directly on its 1st level inside them)
  3. Special folders, they can be seen as a huge file, with or without an upper size limit (holds all what is inside them, list and content of all, including sub folders, etc); not all filesystems allow them natively, most use the trick of defining a file and then mount it as if it where a folder (like .zip, .rar, .7z mounter utilities, etc), but a few filesystems allow them natively.

If you want to see something very weird, try this (on a NTFS):

  1. Create a folder on the root, called for example: MyWeirdFolder
  2. Then inside it create a sub folder with a very large name (more than 200 characters)
  3. Create another folder, but with a short name, like WillBeRenamed
  4. Move the long one inside the short one
  5. Rename the short one to a very long name (more than 200) characters

You will get a path that is not accesible due to very long path, just rename such long names to shorter ones and will get access to it again.

  • 3
    This doesn't answer the question...
    – anonymous2
    Jun 13, 2016 at 14:02
  • @anonymous2 Agree, but provides a good explanation.
    – user423626
    Jun 13, 2016 at 16:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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