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.

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>

Options/Switches[edit]

DIR [drive:][path][filename] [/A[[:]attributes]] [/B] [/C] [/D] [/L] [/N]

 [/O[[:]sortorder]] [/P] [/Q] [/R] [/S] [/T[[:]timefield]] [/W] [/X] [/4]
 [drive:][path][filename]
             Specifies drive, directory, and/or files to list.
 /A          Displays files with specified attributes.
 attributes   D  Directories                R  Read-only files
              H  Hidden files               A  Files ready for archiving
              S  System files               I  Not content indexed files
              L  Reparse Points             -  Prefix meaning not
 /B          Uses bare format (no heading information or summary).
 /C          Display the thousand separator in file sizes.  This is the
             default.  Use /-C to disable display of separator.
 /D          Same as wide but files are list sorted by column.
 /L          Uses lowercase.
 /N          New long list format where filenames are on the far right.
 /O          List by files in sorted order.
 sortorder    N  By name (alphabetic)       S  By size (smallest first)
              E  By extension (alphabetic)  D  By date/time (oldest first)
              G  Group directories first    -  Prefix to reverse order

[1]

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. ^ Windows 7
  2. ^ dir invocation (GNU coreutils) at www.gnu.org