Dir (command)
Template:Short description
Template:Other uses
Template:Lowercase title
Template:Infobox software
dir
, short for directory, is a shell command for listing file system contents; files and directories.<ref>Template:Cite book</ref> Arguably, the command provides the same essential functionality as the ls
command, but typically the two commands are described as notably separate concepts, possibly since Template:Code is implemented from a codebase that shares more history than many Template:Code implementations.
The command is often implemented as internal in the operating system shell instead of as a separate application as many other commands are.
Implementations
[edit]Although syntax, semantics and implementations vary, a Template:Code command is available in the command-line interface (CLI) of the operating systems Digital Research CP/M,<ref>Template:Cite web</ref> MP/M,<ref name="MP/M_1981_UG">Template:Cite book</ref> Intel ISIS-II,<ref>ISIS II Users Guide</ref> iRMX 86,<ref>iRMX 86 INTRODUCTION AND OPERATOR'S REFERENCE MANUAL For Release 6</ref> Cromemco CDOS,<ref>CDOS USER'S MANUAL</ref> MetaComCo TRIPOS,<ref>Template:Cite web</ref> DOS, IBM/Toshiba 4690 OS,<ref>[1]Template:Dead link</ref> IBM OS/2,<ref>Template:Cite web</ref> Microsoft Windows,<ref>Template:Cite web</ref> Singularity, Datalight ROM-DOS,<ref>Template:Cite web</ref> ReactOS,<ref>Template:Cite web</ref> GNU,<ref>Template:Cite web</ref> AROS<ref>Template:Cite web</ref> and in the DCL command-line interface used on DEC VMS, RT-11 and RSX-11. It is also supplied with OS/8 as a CUSP (Commonly-Used System Program).
The dir
command is supported by Tim Paterson's SCP 86-DOS.<ref>Template:Cite book (59 pages)</ref> On MS-DOS, the command is available in versions 1 and later.<ref name="RUNNINGMSDOS">Template:Cite book</ref> It is also available in the open source MS-DOS emulator DOSBox. MS-DOS prompts "Abort, Retry, Fail?" after being commanded to list a directory with no diskette in the drive.
The numerical computing environments MATLAB and GNU Octave include a dir
function with similar functionality.<ref>Template:Cite web</ref><ref>Template:Cite web</ref>
Examples
[edit]DOS, Windows, ReactOS
[edit]List all files and directories in the current working directory. Template:Sxhl
List any text files and batch files (filename extension ".txt" or ".bat"). Template:Sxhl
Recursively list all files and directories in the specified directory and any subdirectories, in wide format, pausing after each screen of output. The directory name is enclosed in double-quotes, to prevent it from being interpreted is as two separate command-line options because it contains a whitespace character. Template:Sxhl
List any NTFS junction points: Template:Pre
Unix
[edit]Traditionally, Unix and Unix-like systems use the Template:Code command for the needs that dir
satisfies. But, the GNU operating system, has a dir
command that "is equivalent to ls -C -b
; that is, by default files are listed in columns, sorted vertically, and special characters are represented by backslash escape sequences".<ref>dir invocation (GNU coreutils) at www.gnu.org</ref> Actually, for compatibility reasons, Template:Code produces device-dependent output. The dir
command, on the other hand, produces device-independent output.