Open main menu
Home
Random
Recent changes
Special pages
Community portal
Preferences
About Wikipedia
Disclaimers
Incubator escapee wiki
Search
User menu
Talk
Dark mode
Contributions
Create account
Log in
Editing
Dir (command)
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
{{Short description|Shell command for listing files and directories}} {{Other uses|Dir (disambiguation)}} {{Lowercase title}} {{Infobox software | name = dir | logo = | screenshot = SpartaDOS X prompt.png | screenshot size = | caption = The [[SpartaDOS X]] <code>DIR</code> command | developer = [[Digital Equipment Corporation|DEC]], [[Digital Research|DR]], [[Intel]], [[Cromemco]], [[MetaComCo]], [[Microsoft]], [[IBM]], [[Datalight]], ICD, Inc. | released = | latest release version = | latest release date = | operating system = [[CP/M]], [[MP/M]], [[ISIS (operating system)|ISIS-II]], [[RMX (operating system)|iRMX 86]], [[Cromemco DOS|CDOS]], [[TRIPOS]], [[DOS]], [[MSX-DOS]], [[SISNE plus]], [[4690 Operating System|4690 OS]], [[PC-MOS]], [[OS/2]], [[Microsoft Windows|Windows]], [[Singularity (operating system)|Singularity]], [[ReactOS]], [[AROS Research Operating System|AROS]], [[OpenVMS|VMS]], [[RT-11]], [[RSX-11]], [[OS/8]], [[AmigaDOS]] | platform = [[Cross-platform]] | genre = [[Command (computing)|Command]] | license = CP/M, MP/M: [[BSD licenses|BSD]]-like<br />MS-DOS: [[MIT License|MIT]]<br />PC-MOS: [[GPL-3.0-only]]<br />ReactOS: [[GNU General Public License|GPL]] | website = }} '''<code>dir</code>''', short for ''directory'', is a [[shell (computing)|shell]] [[command (computing)|command]] for listing [[file system]] contents; [[computer file|files]] and [[file directory|directories]].<ref>{{cite book|url=http://archive.org/details/1988-rugheimer-spanik-amigados-quick-reference|title=AmigaDOS quick reference|first1=Hannes|last1=Rügheimer|first2=Christian|last2=Spanik|date=October 22, 1988|publisher=Grand Rapids, Mi : Abacus|isbn=9781557550491|via=Internet Archive}}</ref> Arguably, the command provides the same essential functionality as the <code>[[ls]]</code> command, but typically the two commands are described as notably separate concepts, possibly since {{code|ls}} is implemented from a [[codebase]] that shares more history than many {{code|dir}} implementations. The command is often implemented as internal in the [[operating system]] [[shell (computing)|shell]] instead of as a separate application as many other commands are. ==Implementations== [[File:Abort Retry Fail.PNG|200px|thumb|right|Screenshot showing the "[[Abort, Retry, Fail?]]" prompt on [[MS-DOS]].]] Although syntax, semantics and implementations vary, a {{code|dir}} command is available in the [[command-line interface]] (CLI) of the [[operating system]]s [[Digital Research]] [[CP/M]],<ref>{{cite web|url=http://www.cpm.z80.de/manuals/cpm22-m.pdf |title=Operating manual |publisher=cpm.z80.de |access-date=2019-10-22}}</ref> [[MP/M]],<ref name="MP/M_1981_UG">{{cite book |author=Digital Research |author-link=Digital Research |title=MP/M-86 Operating System - User's Guide |date=1981-09-25 |edition=1 |publisher=[[Digital Research]] |location=Pacific Grove, CA, USA |url=http://bitsavers.informatik.uni-stuttgart.de/pdf/digitalResearch/mpm-86/MPM-86_Users_Guide_Sep81.pdf |access-date=2017-01-04 |url-status=live |archive-url=https://web.archive.org/web/20170104172228/http://bitsavers.informatik.uni-stuttgart.de/pdf/digitalResearch/mpm-86/MPM-86_Users_Guide_Sep81.pdf |archive-date=2017-01-04}}</ref> [[Intel]] [[ISIS (operating system)|ISIS-II]],<ref>[http://bitsavers.org/pdf/intel/ISIS_II/9800306-06_ISIS-II_Users_Guide_May81.pdf ISIS II Users Guide]</ref> [[RMX (operating system)|iRMX 86]],<ref>[https://archive.org/details/bitsavers_inteliRMX1_19819263 iRMX 86 INTRODUCTION AND OPERATOR'S REFERENCE MANUAL For Release 6]</ref> [[Cromemco]] [[Cromemco DOS|CDOS]],<ref>[http://www.hartetechnologies.com/manuals/Cromemco/CDOSv1.PDF CDOS USER'S MANUAL]</ref> [[MetaComCo]] [[TRIPOS]],<ref>{{cite web|url=https://www.pagetable.com/docs/amigados_tripos/tripos_manuals.pdf |title=Introduction to Tripos |access-date=2019-10-22}}</ref> [[DOS]], [[IBM]]/[[Toshiba]] [[4690 Operating System|4690 OS]],<ref>[https://archive.org/details/4690OSV6r2UsersGuide/page/n169]{{Dead link|date=October 2019}}</ref> IBM [[OS/2]],<ref>{{cite web|url=http://www.jatomes.com/Help/Os2Cmd.php#DIR|title=JaTomes Help - OS/2 Commands|website=www.jatomes.com|access-date=2019-07-20|archive-date=2019-04-14|archive-url=https://web.archive.org/web/20190414130029/http://www.jatomes.com/Help/Os2Cmd.php#DIR|url-status=dead}}</ref> [[Microsoft Windows]],<ref>{{cite web|url=https://www.computerhope.com/dirhlp.htm|title=MS-DOS and Windows command line dir command|website=www.computerhope.com}}</ref> [[Singularity (operating system)|Singularity]], [[Datalight]] [[ROM-DOS]],<ref>{{Cite web|url=https://www.datalight.com/assets/files/ROM-DOS_Users_Guide.pdf|title=Datalight ROM-DOS User's Guide|website=www.datalight.com}}</ref> [[ReactOS]],<ref>{{cite web|url=https://github.com/reactos/reactos|title=GitHub - reactos/reactos: A free Windows-compatible Operating System|date=October 22, 2019|via=GitHub}}</ref> [[GNU#GNU as an operating system|GNU]],<ref>{{cite web|url=https://www.gnu.org/software/coreutils/dir|title=GNU Coreutils Manual|publisher=Free Software Foundation}}</ref> [[AROS Research Operating System|AROS]]<ref>{{cite web|url=http://aros.sourceforge.net/documentation/users/shell/index.php|title=AROS Research Operating System|website=aros.sourceforge.net}}</ref> and in the [[DIGITAL Command Language|DCL]] command-line interface used on [[Digital Equipment Corporation|DEC]] [[OpenVMS|VMS]], [[RT-11]] and [[RSX-11]]. It is also supplied with [[OS/8]] as a CUSP (Commonly-Used System Program). The <code>dir</code> command is supported by [[Tim Paterson]]'s [[Seattle Computer Products|SCP]] [[86-DOS]].<ref>{{cite book |title=86-DOS - Disk Operating System for the 8086 - User's Manual |edition=Preliminary |version=Version 0.3 |date=1980 |publisher=[[Seattle Computer Products, Inc.]] |location=Seattle, Washington, USA |url=http://www.patersontech.com/Dos/docs/86_Dos_usr_03.pdf |access-date=2019-07-14 |url-status=dead |archive-url=https://web.archive.org/web/20190714004434/http://www.patersontech.com/dos/docs/86_Dos_usr_03.pdf |archive-date=2019-07-14}} (59 pages)</ref> On [[MS-DOS]], the command is available in versions 1 and later.<ref name="RUNNINGMSDOS">{{Cite book|author-last=Wolverton|author-first=Van|title=Running MS-DOS Version 6.22 (20th Anniversary Edition), 6th Revised edition|date=2003|publisher=[[Microsoft Press]]|isbn=0-7356-1812-7}}</ref> It is also available in the [[open-source software|open source]] MS-DOS [[emulator]] [[DOSBox]]. [[MS-DOS]] prompts "[[Abort, Retry, Fail?]]" after being commanded to list a [[directory (file systems)|directory]] with no [[floppy disk|diskette]] in the drive. The [[numerical analysis|numerical computing]] environments [[MATLAB]] and [[GNU Octave]] include a <code>dir</code> function with similar functionality.<ref>{{cite web|url=https://www.mathworks.com/help/matlab/ref/dir.html|title=List folder contents - MATLAB dir|website=www.mathworks.com}}</ref><ref>{{cite web|url=https://octave.sourceforge.io/octave/function/dir.html|title=Function Reference: dir|website=octave.sourceforge.io}}</ref> ==Examples== [[File:Commodore C128 CPM Screenshot 2 full.jpg|200px|thumb|right|[[CP/M 3.0]] directory listing on a [[Commodore 128]] home computer.]] [[File:Robotron1715SCREEN.gif|200px|thumb|right|Directory listing on [[Single User Control Program|SCP]] running on a [[VEB Robotron|robotron]] [[PC 1715]].]] [[File:J Elwro 804 Junior.JPG|200px|thumb|right|Directory listing on [[CP/J 2.21]] running on an [[Elwro 804 Junior]].]] [[File:Dir command in Windows Command Prompt.png|200px|thumb|right|[[Microsoft Windows]] [[cmd.exe|Command Prompt]] showing a directory listing.]] ===DOS, Windows, ReactOS=== List all files and directories in the current [[working directory]]. {{sxhl|2=doscon|C:\Users>dir}} List any [[text file]]s and [[batch file]]s ([[filename extension]] ".txt" or ".bat"). {{sxhl|2=doscon|C:\Users>dir *.txt *.bat}} [[Recursion (computer science)|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 [[Quotation mark|double-quotes]], to prevent it from being interpreted is as two separate [[command-line option]]s because it contains a [[whitespace character]]. {{sxhl|2=doscon|C:\Users>dir /s /w /p "C:\Users\johndoe\My Documents"}} List any [[NTFS junction point]]s: {{pre| {{codett|2=doscon|C:\Users>dir /ash}} {{codett|2=output|Volume in drive C is OS.}} {{codett|2=output|Volume Serial Number is xxxx-xxxx}} {{codett|2=output|Directory of C:\Users}} {{codett|2=output|12/07/2019 02:30 AM <SYMLINKD> All Users [C:\ProgramData]}} {{codett|2=output|12/07/2019 02:30 AM <JUNCTION> Default User [C:\Users\Default]}} {{codett|2=output|12/07/2019 02:12 AM 174 desktop.ini}} {{codett|2=output|1 File(s) 174 bytes}} {{codett|2=output|2 Dir(s) 332,659,789,824 bytes free}} }} ===Unix=== Traditionally, [[Unix]] and [[Unix-like]] systems use the {{code|ls}} command for the needs that <code>dir</code> satisfies. But, the [[GNU#GNU as an operating system|GNU operating system]], has a <code>dir</code> command that "is equivalent to <code>ls -C -b</code>; that is, by default files are listed in columns, sorted vertically, and special characters are represented by backslash escape sequences".<ref>[//www.gnu.org/software/coreutils/manual/html_node/dir-invocation.html dir invocation] (GNU coreutils) at www.gnu.org</ref> Actually, for compatibility reasons, {{code|ls}} produces device-dependent output. The <code>dir</code> command, on the other hand, produces device-independent output. ==See also== * [[Directory (OpenVMS command)]] * [[List of DOS commands]] * [[tree (command)|tree]] ==References== {{Reflist}} ==Further reading== *{{Cite book|author-last=Wolverton|author-first=Van|title=MS-DOS Commands: Microsoft Quick Reference, 4th Revised edition|url=https://archive.org/details/msdos00wolv|url-access=registration|date=1990|publisher=[[Microsoft Press]]|isbn=978-1556152894}} *{{Cite book|author1=Kathy Ivens|author2=Brian Proffit|year=1993|title=OS/2 Inside & Out|publisher=[[Osborne McGraw-Hill]]|isbn=978-0078818714}} *{{Cite book|first=Æleen|last=Frisch|year=2001|title=Windows 2000 Commands Pocket Reference|publisher=[[O'Reilly Media|O'Reilly]]|isbn=978-0-596-00148-3}} ==External links== {{Wikibooks|Guide to Windows Commands}} *[https://docs.microsoft.com/en-us/windows-server/administration/windows-commands/dir dir | Microsoft Docs] *[https://github.com/microsoft/MS-DOS/blob/master/v2.0/source/DIR.ASM Open source DIR implementation that comes with MS-DOS v2.0] *[https://www.windows-commandline.com/dir-command-line-options/ Dir command syntax and examples] {{Windows commands}} [[Category:CP/M commands]] [[Category:Internal DOS commands]] [[Category:Microcomputer software]] [[Category:Microsoft free software]] [[Category:MSX-DOS commands]] [[Category:OS/2 commands]] [[Category:ReactOS commands]] [[Category:Windows commands]] [[Category:Windows administration]]
Edit summary
(Briefly describe your changes)
By publishing changes, you agree to the
Terms of Use
, and you irrevocably agree to release your contribution under the
CC BY-SA 4.0 License
and the
GFDL
. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.
Cancel
Editing help
(opens in new window)
Pages transcluded onto the current version of this page
(
help
)
:
Template:Cite book
(
edit
)
Template:Cite web
(
edit
)
Template:Code
(
edit
)
Template:Dead link
(
edit
)
Template:Infobox
(
edit
)
Template:Infobox software
(
edit
)
Template:Lowercase title
(
edit
)
Template:Main other
(
edit
)
Template:Other uses
(
edit
)
Template:Pre
(
edit
)
Template:Reflist
(
edit
)
Template:Short description
(
edit
)
Template:Sister project
(
edit
)
Template:Sxhl
(
edit
)
Template:Template other
(
edit
)
Template:Wikibooks
(
edit
)
Template:Windows commands
(
edit
)