Directory (computing)

Last updated
Screenshot of a Microsoft Windows command prompt window showing a directory listing. Dir command in Windows Command Prompt.png
Screenshot of a Microsoft Windows command prompt window showing a directory listing.

In computing, a directory is a file system cataloging structure which contains references to other computer files, and possibly other directories. On many computers, directories are known as folders, or drawers, [1] analogous to a workbench or the traditional office filing cabinet. The name derives from books like a telephone directory that lists the phone numbers of all the people living in a certain area.

Contents

Files are organized by storing related files in the same directory. In a hierarchical file system (that is, one in which files and directories are organized in a manner that resembles a tree), 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 systems – including but not limited to systems using GNOME, KDE Plasma 5, or ROX Desktop as the desktop environment – is "inode/directory". [2] This is not an IANA registered media type.

Overview

Diagram of a hierarchical directory tree. The root directory is here called "MFD", for Master File Directory. Usually a file can only be in one directory at a time, but here File 2 is hard linked so it appears in two directories. Files11 directory hierarchy.svg
Diagram of a hierarchical directory tree. The root directory is here called "MFD", for Master File Directory. Usually a file can only be in one directory at a time, but here File 2 is hard linked so it appears in two directories.

Historically, and even on some modern embedded systems, the file systems either had no support for directories at all or had only a "flat" directory structure, meaning subdirectories were not supported; there were 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 systems, programs have an associated working directory 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 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 /root for this purpose.

In keeping with Unix philosophy, Unix systems treat directories as a type of file. [3] 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 calls that return records, not a byte-stream. [4]

Folder metaphor

Sample folder icon (from KDE). Breezeicons-apps-48-system-file-manager.svg
Sample folder icon (from KDE).

The name folder, presenting an analogy to the file folder used in offices, and used in a hierarchical file system design for the Electronic Recording Machine, Accounting (ERMA) Mark 1 published in 1958 [5] as well as by Xerox Star, [6] is used in almost all modern operating systems' desktop environments. Folders are often depicted with icons which visually resemble physical file folders.

There is a difference between a directory, which is a file system concept, and the graphical user interface metaphor that is used to represent it (a folder).[ original research? ] For example, Microsoft Windows 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 clients 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. [ citation needed ] 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, /usr/bin/ is usually referred to as a directory when viewed in a command line console, but if accessed through a graphical file manager, 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 world, this is usually called Directory Name Lookup Cache (DNLC), although it is called dcache on Linux. [7]

For local filesystems, DNLC 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. [7]

See also

Related Research Articles

A file manager or file browser is a computer program that provides a user interface to manage files and folders. The most common operations performed on files or groups of files include creating, opening, renaming, copying, moving, deleting and searching for files, as well as modifying file attributes, properties and file permissions. Folders and files may be displayed in a hierarchical tree based on their directory structure.

<span class="mw-page-title-main">History of the graphical user interface</span>

The history of the graphical user interface, understood as the use of graphic icons and a pointing device to control a computer, covers a five-decade span of incremental refinements, built on some constant core principles. Several vendors have created their own windowing systems based on independent code, but with basic elements in common that define the WIMP "window, icon, menu and pointing device" paradigm.

Linux has several filesystem drivers for the File Allocation Table (FAT) filesystem format. These are commonly known by the names used in the mount command to invoke particular drivers in the kernel: msdos, vfat, and umsdos.

In computing, a desktop environment (DE) is an implementation of the desktop metaphor made of a bundle of programs running on top of a computer operating system that share a common graphical user interface (GUI), sometimes described as a graphical shell. The desktop environment was seen mostly on personal computers until the rise of mobile computing. Desktop GUIs help the user to easily access and edit files, while they usually do not provide access to all of the features found in the underlying operating system. Instead, the traditional command-line interface (CLI) is still used when full control over the operating system is required.

AmigaDOS is the disk operating system of the AmigaOS, which includes file systems, file and directory manipulation, the command-line interface, and file redirection.

cd (command) Computer command in various operating systems

The cd command, also known as chdir, is a command-line shell command used to change the current working directory in various operating systems. It can be used in shell scripts and batch files.

In computing, a symbolic link is a file whose purpose is to point to a file or directory by specifying a path thereto.

<span class="mw-page-title-main">GoboLinux</span> Linux distribution

GoboLinux is a Linux distribution whose most prominent feature is a reorganization of the traditional Linux file system. Rather than following the Filesystem Hierarchy Standard like most Unix-like systems, each program in a GoboLinux system has its own subdirectory tree, where all of its files may be found. Thus, a program "Foo" has all of its specific files and libraries in /Programs/Foo, under the corresponding version of this program at hand. For example, the commonly known GCC compiler suite version 8.1.0, would reside under the directory /Programs/GCC/8.1.0.

A home directory is a file system directory on a multi-user operating system containing files for a given user of the system. The specifics of the home directory are defined by the operating system involved; for example, Linux / BSD (FHS) systems use /home/⟨username⟩ or /usr/home/⟨username⟩ and Windows systems since Windows Vista use \Users\⟨username⟩.

<span class="mw-page-title-main">Desktop metaphor</span> Concept used on desktop computer graphical user interfaces

In computing, the desktop metaphor is an interface metaphor which is a set of unifying concepts used by graphical user interfaces to help users interact more easily with the computer. The desktop metaphor treats the computer monitor as if it is the top of the user's desk, upon which objects such as documents and folders of documents can be placed. A document can be opened into a window, which represents a paper copy of the document placed on the desktop. Small applications called desk accessories are also available, such as a desk calculator or notepad, etc.

<span class="mw-page-title-main">Virtual file system</span> Abstract layer on top of a more concrete file system

A virtual file system (VFS) or virtual filesystem switch is an abstract layer on top of a more concrete file system. The purpose of a VFS is to allow client applications to access different types of concrete file systems in a uniform way. A VFS can, for example, be used to access local and network storage devices transparently without the client application noticing the difference. It can be used to bridge the differences in Windows, classic Mac OS/macOS and Unix filesystems, so that applications can access files on local file systems of those types without having to know what type of file system they are accessing.

A path is a string of characters used to uniquely identify a location in a directory structure. It is composed by following the directory tree hierarchy in which components, separated by a delimiting character, represent each directory. The delimiting character is most commonly the slash ("/"), the backslash character ("\"), or colon (":"), though some operating systems may use a different delimiter. Paths are used extensively in computer science to represent the directory/file relationships common in modern operating systems and are essential in the construction of Uniform Resource Locators (URLs). Resources can be represented by either absolute or relative paths.

The Andrew File System (AFS) is a distributed file system which uses a set of trusted servers to present a homogeneous, location-transparent file name space to all the client workstations. It was developed by Carnegie Mellon University as part of the Andrew Project. Originally named "Vice", "Andrew" refers to Andrew Carnegie and Andrew Mellon. Its primary use is in distributed computing.

du (Unix) Standard Unix program

du is a standard Unix program used to estimate file space usage—space used under a particular directory or files on a file system. A Windows commandline version of this program is part of Sysinternals suite by Mark Russinovich.

<span class="mw-page-title-main">File system</span> Computer filing system

In computing, a file system or filesystem governs file organization and access. A local file system is a capability of an operating system that services the applications running on the same computer. A distributed file system is a protocol that provides file access between networked computers.

rm (Unix) Unix command utility

rm is a basic command on Unix and Unix-like operating systems used to remove objects such as computer files, directories and symbolic links from file systems and also special files such as device nodes, pipes and sockets, similar to the del command in MS-DOS, OS/2, and Microsoft Windows. The command is also available in the EFI shell.

On Microsoft Windows, a special folder is a folder that is presented to the user through an interface as an abstract concept instead of an absolute folder path. Special folders make it possible for any application to ask the operating system where an appropriate location for certain kinds of files can be found; independently of which version or user language of Windows is being used.

<span class="mw-page-title-main">Hierarchical file system</span> Computer files in nested directories

In computing, a hierarchical file system is a file system that uses directories to organize files into a tree structure.

<span class="mw-page-title-main">Trash (computing)</span> Temporary storage for deleted files

In computing, the trash, also known by other names such as dustbin, wastebasket, and others, is a graphical user interface desktop metaphor for temporary storage for files set aside by the user for deletion, but not yet permanently erased. The concept and name is part of Mac operating systems, a similar implementation is called the Recycle Bin in Microsoft Windows, and other operating systems use other names.

<span class="mw-page-title-main">AmigaOS</span> Operating system for Amiga computers

AmigaOS is a family of proprietary native operating systems of the Amiga and AmigaOne personal computers. It was developed first by Commodore International and introduced with the launch of the first Amiga, the Amiga 1000, in 1985. Early versions of AmigaOS required the Motorola 68000 series of 16-bit and 32-bit microprocessors. Later versions, after Commodore's demise, were developed by Haage & Partner and then Hyperion Entertainment. A PowerPC microprocessor is required for the most recent release, AmigaOS 4.

References

  1. "Chapter 1: Tutorial". Using The AMIGA Workbench. Commodore-Amiga. July 1991. p. 46. The path specifies the disk name, or location, and all of the drawers that lead to the specified file.
  2. Leonard, Thomas (2018-10-02). "Shared MIME-info Database". X Desktop Group. Non-regular files. Retrieved 2023-03-13.
  3. "Everything is a File". Behavior Genetics Association. c. 2002. Archived from the original on March 10, 2012. Retrieved April 30, 2021.
  4. "readdir(3) — Linux manual page". The Linux man-pages project. 2021-03-22. Retrieved November 27, 2022.
  5. Barnard III, G. A.; Fein, L. (1958). "Organization and Retrieval of Records Generated in a Large-Scale Engineering Project". Proceedings of the Eastern Joint Computer Conference: 59–63. doi:10.1109/AFIPS.1958.75.
  6. ""Xerox Star User Interface (1982)"". YouTube. 28 August 2009. Archived from the original on 2021-12-21. Retrieved 19 November 2014.
  7. 1 2 "Close-To-Open Cache Consistency in the Linux NFS Client". Citi.umich.edu. Retrieved 19 November 2014.