DIR.COM
| Company type | Shell command |
|---|---|
| Industry | Computer software |
| Founded | 1980s |
| Products | Directory listing utility |
dir, an abbreviation for directory, is a shell instruction used to display the contents of a file system, including both files and folders. While it shares fundamental capabilities with the ls command, its implementation varies across different platforms.
Typically, this command is integrated directly into the operating system's command interpreter rather than existing as an independent program.
Implementations
The dir command is supported by the command-line environments of a wide range of operating systems. These include 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's OS/2, and Microsoft Windows. Additionally, it is present in systems such as Singularity, Datalight's ROM-DOS, ReactOS, GNU Coreutils, AROS Research Operating System, and DEC's DCL interface found on OpenVMS, RT-11, and RSX-11. It also ships as a Commonly-Used System Program (CUSP) with OS/8.
The inclusion of dir traces back to Tim Paterson's SCP 86-DOS, which influenced MS-DOS from its initial release. This command remains part of the open-source MS-DOS emulator DOSBox. On MS-DOS platforms, executing dir on a drive without media prompts the user with the "Abort, Retry, Fail?" message.
Within network operations, FTP client software utilizes the dir command to retrieve directory listings from remote servers.
In numerical computing environments like MATLAB and GNU Octave, a dir function exists that performs directory listing tasks with similar functionality.
DOS, Windows, ReactOS
To display all files and directories contained in the current working directory:
To show files ending with ".txt" or ".bat" extensions:
For a recursive listing of all files and folders within a specified directory and its subdirectories, presented in wide format with pauses after each screen. The directory path is enclosed in double quotes to accommodate spaces:
To list any existing NTFS junction points:
Unix
On Unix and Unix-like operating systems, directory contents are traditionally listed using the command. Nevertheless, GNU systems provide a dir command that functions equivalently to ls -C -b, displaying files in vertically sorted columns with special characters escaped. Unlike , which produces output dependent on the device, dir outputs device-independent listings, improving portability.