Dir (command)

Revision as of 13:32, 23 April 2025 by imported>Stevebroshar (fix typo)
(diff) ← Previous revision | Latest revision (diff) | Newer revision → (diff)

Template:Short description {{#invoke:other uses|otheruses}} Template:Lowercase title {{#invoke:Infobox|infobox}}Template:Template other{{#invoke:Check for unknown parameters | check | showblankpositional=1 | unknown = Template:Main other | preview = Page using Template:Infobox software with unknown parameter "_VALUE_"|ignoreblank=y | AsOf | author | background | bodystyle | caption | collapsetext | collapsible | developer | discontinued | engine | engines | genre | included with | language | language count | language footnote | latest preview date | latest preview version | latest release date | latest release version | latest_preview_date | latest_preview_version | latest_release_date | latest_release_version | licence | license | logo | logo alt | logo caption | logo upright | logo size | logo title | logo_alt | logo_caption | logo_upright | logo_size | logo_title | middleware | module | name | operating system | operating_system | other_names | platform | programming language | programming_language | released | replaced_by | replaces | repo | screenshot | screenshot alt | screenshot upright | screenshot size | screenshot title | screenshot_alt | screenshot_upright | screenshot_size | screenshot_title | service_name | size | standard | title | ver layout | website | qid }}Template:Main other 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 <syntaxhighlight lang="text" class="" style="" inline="1">ls</syntaxhighlight> is implemented from a codebase that shares more history than many <syntaxhighlight lang="text" class="" style="" inline="1">dir</syntaxhighlight> implementations.

The command is often implemented as internal in the operating system shell instead of as a separate application as many other commands are.

ImplementationsEdit

File:Abort Retry Fail.PNG
Screenshot showing the "Abort, Retry, Fail?" prompt on MS-DOS.

Although syntax, semantics and implementations vary, a <syntaxhighlight lang="text" class="" style="" inline="1">dir</syntaxhighlight> command is available in the command-line interface (CLI) of the operating systems Digital Research CP/M,<ref>{{#invoke:citation/CS1|citation |CitationClass=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>{{#invoke:citation/CS1|citation |CitationClass=web }}</ref> DOS, IBM/Toshiba 4690 OS,<ref>[1]Template:Dead link</ref> IBM OS/2,<ref>{{#invoke:citation/CS1|citation |CitationClass=web }}</ref> Microsoft Windows,<ref>{{#invoke:citation/CS1|citation |CitationClass=web }}</ref> Singularity, Datalight ROM-DOS,<ref>{{#invoke:citation/CS1|citation |CitationClass=web }}</ref> ReactOS,<ref>{{#invoke:citation/CS1|citation |CitationClass=web }}</ref> GNU,<ref>{{#invoke:citation/CS1|citation |CitationClass=web }}</ref> AROS<ref>{{#invoke:citation/CS1|citation |CitationClass=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>{{#invoke:citation/CS1|citation |CitationClass=web }}</ref><ref>{{#invoke:citation/CS1|citation |CitationClass=web }}</ref>

ExamplesEdit

File:Robotron1715SCREEN.gif
Directory listing on SCP running on a robotron PC 1715.
File:J Elwro 804 Junior.JPG
Directory listing on CP/J 2.21 running on an Elwro 804 Junior.

DOS, Windows, ReactOSEdit

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

UnixEdit

Traditionally, Unix and Unix-like systems use the <syntaxhighlight lang="text" class="" style="" inline="1">ls</syntaxhighlight> 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, <syntaxhighlight lang="text" class="" style="" inline="1">ls</syntaxhighlight> produces device-dependent output. The dir command, on the other hand, produces device-independent output.

See alsoEdit

ReferencesEdit

Template:Reflist

Further readingEdit

External linksEdit

Template:Sister project

Template:Windows commands