Folder or Directory? Here's Why Folders are Called Directories in Linux

When you switch to Linux, you find that folders are often termed as directories. Should you call it a folder or a directory? Is there even a difference?
Warp Terminal

If you start using computers with Windows, you are likely to use the term folder.

But when you switch to Linux, you’ll find that folders are often termed as directories.

This may confuse some new Linux users. Should you call it a folder or a directory? Is there even a difference?

Here’s the thing. You can call it a folder if you want or a directory if you like. It won’t make a difference.

But if you wonder why a folder is called a directory in Linux, here is some explanation.

Why is a folder called a directory in Linux?

Before I explain that, let’s recall what a folder and directory are used for in the real world.

A folder (envelope) can be used to keep several files (or other items) in it. A directory can be used to maintain an index of items so that you can find which items is located where.

folder directory
Illustration of folder and directory

Now, let’s go back to directory. The term existed even before the existence of Linux. It is coming from the UNIX era. Linux inherits a lot of things from UNIX and this is just one of those many things.

Now let me tell you something that may surprise you. A directory does NOT really keep files inside it. Directory is a ‘special file’ that knows where (the content of) a file is stored in the memory (through inode).

This makes sense why it is called directory. A directory keeps the index of items, not necessarily the items themselves. The directories in Linux and UNIX don’t keep the files inside them. They just have the information about the location of files.

If you want to learn more about it, my article on hard links should help you.

Hard Link in Linux: Everything Important You Need to Know
Learn the concept of hard links in Linux and its association with inodes in this tutorial.

So, why is it called a folder then? To me, it comes from the perspective. When you are in a graphical environment, you visualize things. Here, files can be visualized like pages and those file pages are stored in an envelope (folder).

When the operating systems started using graphical elements, I think some terms were changed accordingly and directory-folder was one of them.

Should you call it folder or directory?

That’s entirely up to you. You can use either term at your convenience.

However, if you are learning Linux command line or use it often, using the term directory could be a tad bit more helpful.

There are Linux commands like mkdir, rmdir etc. The term ‘dir’ gives a hint that these commands have something to do with directories.

Similarly, many Linux commands and bash scripts will use option -d for directories and -f for files.

Even the file properties in the terminal distinguish between files and folders (directories) by putting the letter d in front of the directories.

Take this example where I have a file names ‘some’ and a folder/directory named ‘something’. Notice how various Linux commands distinguish between file and directory with ‘dir’ or ‘d’.

file directory commands difference
Example showing the difference between files and directories operations

All this makes me think that using the term ‘directory’ will be beneficial while using Linux commands. It would be easier for your subconscious mind to relate the terms ‘dir’ and ‘d’ with directory.

Once again, it’s entirely up to you if you want to call it a folder or directory. People would understand what you are referring to.

I just gave some insight into the historical origin of the term directory and this should give you some hint on why people say ‘everything is a file in Linux/UNIX’.

Now that I end my ramblings, I invite your comment on it. If you find any technical inaccuracies, let me know, please.

About the author
Abhishek Prakash

Abhishek Prakash

Created It's FOSS 11 years ago to share my Linux adventures. Have a Master's degree in Engineering and years of IT industry experience. Huge fan of Agatha Christie detective mysteries 🕵️‍♂️

Become a Better Linux User

With the FOSS Weekly Newsletter, you learn useful Linux tips, discover applications, explore new distros and stay updated with the latest from Linux world

It's FOSS

Great! You’ve successfully signed up.

Welcome back! You've successfully signed in.

You've successfully subscribed to It's FOSS.

Success! Check your email for magic link to sign-in.

Success! Your billing info has been updated.

Your billing was not updated.