Dir (command)
dir, an abbreviation for directory, is a shell command used to display the contents of a file system, including both files and directories. While it performs functions akin to the ls command, its implementation often varies between different operating systems.
Typically, this command is integrated directly into the shell of the operating system rather than existing as a standalone program.
Implementations
The dir command can be found in the command-line interfaces of numerous operating systems such as Digital Research's CP/M, MP/M, Intel's ISIS-II, iRMX 86, CDOS, MetaComCo's TRIPOS, various versions of DOS, IBM/Toshiba's 4690 OS, IBM OS/2, Microsoft Windows, Singularity, Datalight's ROM-DOS, ReactOS, GNU Coreutils, the AROS, and DEC's DIGITAL Command Language used on platforms like OpenVMS, RT-11, and RSX-11. It is also present in OS/8 as part of its Commonly-Used System Programs (CUSP).
The dir command was supported by Tim Paterson's Seattle Computer Products' 86-DOS and subsequently inherited by MS-DOS from its initial release. It is also included in the open-source MS-DOS emulator DOSBox. On MS-DOS systems, executing dir without an inserted diskette triggers the "Abort, Retry, Fail?" prompt.
Within File Transfer Protocol (FTP) clients, dir is employed to retrieve listings of remote directories.
Furthermore, numerical computing platforms such as MATLAB and GNU Octave provide a dir function that offers similar directory listing features.
DOS, Windows, ReactOS
Display all files and folders within the current working directory:
List files with extensions ".txt" or ".bat":
Recursively show all files and folders inside a specified directory and its subdirectories in wide format, pausing after each screenful; note that the directory path is enclosed in double quotes to accommodate spaces:
Identify any existing NTFS junction points:
Unix
On Unix and Unix-like systems, directory contents are usually displayed with the command. However, GNU operating systems include a dir command that functions equivalently to ls -C -b, presenting files in vertically sorted columns with special characters escaped. Unlike device-dependent output from , this dir variant produces device-independent results, improving consistency across different environments.