Skip to content

Latest commit

 

History

History
44 lines (32 loc) · 2.84 KB

057-the-dir-command.md

File metadata and controls

44 lines (32 loc) · 2.84 KB

The dir command

The dir command lists the contents of a directory(the current directory by default). It differs from ls command in the format of listing the content. By default, the dir command lists the files and folders in columns, sorted vertically and special characters are represented by backslash escape sequences.

Syntax:

dir [OPTIONS] [FILE]

Examples:

  1. To list files in the current directory:
dir
  1. To list even the hidden files in the current directory:
dir -a
  1. To list the content with detailed information for each entry
dir -l

Additional Flags and their Functionalities:

Short Flag Long Flag Description
-a --all It displays all the hidden files(starting with .) along with two files denoted by . and ..
-A --almost-all It is similar to -a option except that it does not display files that signals the current directory and previous directory.
-l - Display detailed information for each entry
-s --size Print the allocated size of each file, in blocks File
-h --human-readable Used with with -l and -s, to print sizes like in human readable format like 1K, 2M and so on
-F - Classifies entries into their type based on appended symbol (/, *, @, %, =)
-v --verbose Print source and destination files
- --group-directories-first To group directories before files
-R --recursive To List subdirectories recursively.
-S - sort by file size, display largest first