
In
computing
Computing is any goal-oriented activity requiring, benefiting from, or creating computer, computing machinery. It includes the study and experimentation of algorithmic processes, and the development of both computer hardware, hardware and softw ...
, a directory is a
file system cataloging structure that contains references to other
computer file
A computer file is a System resource, resource for recording Data (computing), data on a Computer data storage, computer storage device, primarily identified by its filename. Just as words can be written on paper, so too can data be written to a ...
s, and possibly other directories. On many computers, directories are known as folders or drawers,
analogous to a
workbench or the traditional office
filing cabinet
A filing cabinet (or sometimes file cabinet in American English) is a piece of office furniture for storing paper documents in file folders. In the most simple context, it is an enclosure for drawer (furniture), drawers in which articles are sto ...
. The name derives from books like a
telephone directory
A telephone directory, commonly called a telephone book, telephone address book, phonebook, or the white and yellow pages, is a listing of telephone subscribers in a geographical area or subscribers to services provided by the organization tha ...
that lists the phone numbers of all the people living in a certain area.
Files are organized by storing related files in the same directory. In a
hierarchical file system
In computing, a hierarchical file system is a file system that uses directories to organize files into a tree structure.
In a hierarchical file system, ''directories'' contain information about both files and other directories, called ''sub ...
(that is, one in which files and directories are organized in a manner that resembles a
tree
In botany, a tree is a perennial plant with an elongated stem, or trunk, usually supporting branches and leaves. In some usages, the definition of a tree may be narrower, e.g., including only woody plants with secondary growth, only ...
), a directory contained inside another directory is called a subdirectory. The terms parent and child are often used to describe the relationship between a subdirectory and the directory in which it is cataloged, the latter being the parent. The top-most directory in such a filesystem, which does not have a parent of its own, is called the root directory.
The
freedesktop.org media type for directories within many
Unix-like
A Unix-like (sometimes referred to as UN*X, *nix or *NIX) operating system is one that behaves in a manner similar to a Unix system, although not necessarily conforming to or being certified to any version of the Single UNIX Specification. A Uni ...
systems – including but not limited to systems using
GNOME
A gnome () is a mythological creature and diminutive spirit in Renaissance magic and alchemy, introduced by Paracelsus in the 16th century and widely adopted by authors, including those of modern fantasy literature. They are typically depict ...
,
KDE Plasma 5, or
ROX Desktop as the desktop environment – is "inode/directory". This is not an
IANA registered media type.
Overview

Historically, and even on some modern
embedded system
An embedded system is a specialized computer system—a combination of a computer processor, computer memory, and input/output peripheral devices—that has a dedicated function within a larger mechanical or electronic system. It is e ...
s, the file systems either had no support for directories at all or had only a "flat"
directory structure
In computing, a directory structure is the way an operating system arranges files that are accessible to the user. Files are typically displayed in a hierarchical tree structure.
File names and extensions
A filename is a string used to uniquely ...
, meaning subdirectories were not supported; there was only a group of top-level directories, each containing files. In modern systems, a directory can contain a mix of files and subdirectories.
A reference to a location in a directory system is called a
path.
In many
operating system
An operating system (OS) is system software that manages computer hardware and software resources, and provides common daemon (computing), services for computer programs.
Time-sharing operating systems scheduler (computing), schedule tasks for ...
s, programs have an associated
working directory
In computing, the working directory of a process is a directory of a hierarchical file system, if any, dynamically associated with the process. It is sometimes called the current working directory (CWD), e.g. the BSD getcwd function, or just c ...
in which they execute. Typically, file names accessed by the program are assumed to reside within this directory if the file names are not specified with an explicit directory name.
Some operating systems restrict a
user's access only to their
home directory
A home directory is a directory (file systems), file system directory on a multi-user operating system containing computer file, files for a given user (computing), user of the system. The specifics of the home directory (such as its name and loc ...
or project directory, thus isolating their activities from all other users. In early versions of Unix, the root directory was the home directory of the
root user, but modern Unix usually uses another directory such as for this purpose.
In keeping with
Unix philosophy
The Unix philosophy, originated by Ken Thompson, is a set of cultural norms and philosophical approaches to Minimalism (computing), minimalist, Modularity (programming), modular software development. It is based on the experience of leading devel ...
, Unix systems treat directories as a type of file. Caveats include not being able to write to a directory file except indirectly by creating, renaming, and removing file system objects in the directory and only being able to read from a directory file using directory-specific library routines and
system call
In computing, a system call (syscall) is the programmatic way in which a computer program requests a service from the operating system on which it is executed. This may include hardware-related services (for example, accessing a hard disk drive ...
s that return records, not a byte-stream.
Folder metaphor

The name ''folder'', presenting an analogy to the
file folder
A file folder (or simply folder) is a kind of folder that holds papers together for organization and protection. File folders usually consist of a sheet of heavy paper stock or other thin, but stiff, material which is folded in half, and are ...
used in offices, and used in a hierarchical file system design for the
Electronic Recording Machine, Accounting (ERMA) Mark 1 published in 1958 as well as by
Xerox Star,
is used in almost all modern
operating system
An operating system (OS) is system software that manages computer hardware and software resources, and provides common daemon (computing), services for computer programs.
Time-sharing operating systems scheduler (computing), schedule tasks for ...
s' desktop environments. Folders are often depicted with
icon
An icon () is a religious work of art, most commonly a painting, in the cultures of the Eastern Orthodox, Oriental Orthodox, Catholic Church, Catholic, and Lutheranism, Lutheran churches. The most common subjects include Jesus, Mary, mother of ...
s that visually resemble physical file folders.
There is a difference between a ''directory'', which is a
file system concept, and the
graphical user interface
A graphical user interface, or GUI, is a form of user interface that allows user (computing), users to human–computer interaction, interact with electronic devices through Graphics, graphical icon (computing), icons and visual indicators such ...
metaphor that is used to represent it (a ''folder''). For example,
Microsoft Windows
Windows is a Product lining, product line of Proprietary software, proprietary graphical user interface, graphical operating systems developed and marketed by Microsoft. It is grouped into families and subfamilies that cater to particular sec ...
uses the concept of
special folders to help present the contents of the computer to the user in a fairly consistent way that frees the user from having to deal with absolute directory paths, which can vary between versions of Windows, and between individual installations. Many operating systems also have the concept of "smart folders" or
virtual folders that reflect the results of a file system search or other operation. These folders do not represent a directory in the file hierarchy. Many
email client
An email client, email reader or, more formally, message user agent (MUA) or mail user agent is a computer program used to access and manage a user's email.
A web application which provides message management, composition, and reception functio ...
s allow the creation of folders to organize email. These folders have no corresponding representation in the filesystem structure.
If one is referring to a ''container of documents'', the term ''folder'' is more appropriate. The term ''directory'' refers to the way a structured list of document files and folders are stored on the computer. The distinction can be due to the way a directory is accessed; on Unix systems, is usually referred to as a directory when viewed in a
command line console
Console may refer to:
Computing and video games
* System console, a physical device to operate a computer
** Virtual console, a user interface for multiple computer consoles on one device
** Command-line interface, a method of interacting with ...
, but if accessed through a graphical
file manager
A file manager or file browser is a computer program that provides a user interface to manage computer files, files and folder (computing), folders. The most common Computer file#Operations, operations performed on files or groups of files incl ...
, users may sometimes call it a folder.
Lookup cache
Operating systems that support hierarchical filesystems (practically all modern ones) implement a form of
caching to
RAM of recent
path lookups. In the
Unix
Unix (, ; trademarked as UNIX) is a family of multitasking, multi-user computer operating systems that derive from the original AT&T Unix, whose development started in 1969 at the Bell Labs research center by Ken Thompson, Dennis Ritchie, a ...
world, this is usually called Directory Name Lookup Cache (DNLC), although it is called dcache on
Linux
Linux ( ) is a family of open source Unix-like operating systems based on the Linux kernel, an kernel (operating system), operating system kernel first released on September 17, 1991, by Linus Torvalds. Linux is typically package manager, pac ...
.
For local filesystems, cache entries normally expire only under pressure from other more recent entries. For
network file systems a
coherence mechanism is necessary to ensure that entries have not been invalidated by other clients.
See also
*
File folder
A file folder (or simply folder) is a kind of folder that holds papers together for organization and protection. File folders usually consist of a sheet of heavy paper stock or other thin, but stiff, material which is folded in half, and are ...
;Concepts
*
Directory structure
In computing, a directory structure is the way an operating system arranges files that are accessible to the user. Files are typically displayed in a hierarchical tree structure.
File names and extensions
A filename is a string used to uniquely ...
*
Filename
A filename or file name is a name used to uniquely identify a computer file in a file system. Different file systems impose different restrictions on filename lengths.
A filename may (depending on the file system) include:
* name – base ...
*
Filesystem Hierarchy Standard
The Filesystem Hierarchy Standard (FHS) is a reference describing the conventions used for the layout of Unix-like systems. It has been made popular by its use in Linux distributions, but it is used by other Unix-like systems as well. It is main ...
*
Home directory
A home directory is a directory (file systems), file system directory on a multi-user operating system containing computer file, files for a given user (computing), user of the system. The specifics of the home directory (such as its name and loc ...
*
Root directory
In a Computing, computer file system, and primarily used in the Unix and Unix-like operating systems, the root directory is the first or top-most Directory (computing), directory in a hierarchy. It can be likened to the trunk of a Tree (data st ...
*
Virtual folder
*
Working directory
In computing, the working directory of a process is a directory of a hierarchical file system, if any, dynamically associated with the process. It is sometimes called the current working directory (CWD), e.g. the BSD getcwd function, or just c ...
;Commands
*
cd (command)
is a shell command that changes the working directory. It is available in many shells and other applications that maintain a working directory. In some contexts, the command can perform actions other than change directory. Some environments p ...
*
chroot
chroot is a shell (computer), shell command (computing), command and a system call on Unix and Unix-like operating systems that changes the apparent root directory for the current running process and its Child process, children. A program that i ...
*
dir (command)
*
mkdir
(make directory) command (computing), command in the Unix, DOS, Digital Research, DR FlexOS, IBM OS/2, Microsoft Windows, and ReactOS operating systems is used to make a new directory (file systems), directory. It is also available in the Unified ...
*
pushd and popd
*
pwd
*
tree (command)
References
External links
Definition of directoryby The Linux Information Project (LINFO)
{{DEFAULTSORT:Directory (computing)
Computer file systems
File system management