dir (command)

From Wikipedia, the free encyclopedia
Jump to: navigation, search
For other uses, see Dir (disambiguation).

In computing, dir (directory) is a command used for file and directory listing, specifically in the command line interface (CLI) of the operating systems RT-11, CP/M, VMS, DOS, OS/2, Singularity, and Microsoft Windows.

Microsoft[edit]

Because it is the primary means of displaying the files and directories on disk or other storage medium within a command window, the dir command is one of the most basic commands employed by users of the command line interface to MS-DOS and subsequent versions of Microsoft Windows.[1]

The dir command has existed as a DOS command since the initial release of MS-DOS. It is built into the DOS command shell, and is not provided as a separate standalone program.

In DOS and Microsoft Windows, dir checks for switches in the %dircmd% environment variable.

In Windows PowerShell, dir is a predefined command alias for the Get-ChildItem Cmdlet which basically serves the same purpose.

Sample usage[edit]

The following example demonstrates the output of the dir command on Windows 7, without arguments:

 C:\Users\Public\Pictures\Sample Pictures>dir
  Volume in drive C is System
  Volume Serial Number is C8D0-76E2
 
  Directory of C:\Users\Public\Pictures\Sample Pictures
 
 14-07-2009  06:41    <DIR>          .
 14-07-2009  06:41    <DIR>          ..
 14-07-2009  06:52           879,394 Chrysanthemum.jpg
 14-07-2009  06:52           845,941 Desert.jpg
 14-07-2009  06:52           595,284 Hydrangeas.jpg
 14-07-2009  06:52           775,702 Jellyfish.jpg
 14-07-2009  06:52           780,831 Koala.jpg
 14-07-2009  06:52           561,276 Lighthouse.jpg
 14-07-2009  06:52           777,835 Penguins.jpg
 14-07-2009  06:52           620,888 Tulips.jpg
                8 File(s)      5,837,151 bytes
                2 Dir(s)  57,925,980,160 bytes free
 
 C:\Users\Public\Pictures\Sample Pictures>dir /w
  Volume in drive C is System
  Volume Serial Number is C8D0-76E2
 
  Directory of C:\Users\Public\Pictures\Sample Pictures
 
 [.]                 [..]                Chrysanthemum.jpg   Desert.jpg          Hydrangeas.jpg      Jellyfish.jpg
 Koala.jpg           Lighthouse.jpg      Penguins.jpg        Tulips.jpg
                8 File(s)      5,837,151 bytes
                2 Dir(s)  57,925,992,448 bytes free
 
 C:\Users\Public\Pictures\Sample Pictures>

Unices[edit]

dir is not a Unix command, Unix has the analogous ls command instead. The GNU/Linux operating system, however, 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, as the documentation says.[2]

See also[edit]

References[edit]

  1. ^ Baril, Suzanne (2000-01-10). "Learning MS-DOS Basics - A Tutorial". Archived from the original on 2007-07-09. Retrieved 2007-08-08. 
  2. ^ dir invocation (GNU coreutils) at www.gnu.org