dir Linux Commands

What is Linux dir Command?

Explanation

dir COMMAND:

dir command is used to list all the files in a particular directory.

SYNTAX :


dir [OPTION] [FILE]

OPTIONS:


-a, --all do not hide entries starting with .
--author print the author of each file.
-B, --ignore-backups do not list implied entries ending with ~
-C list entries by columns.
-d, --directory list directory entries instead of contents.
-g like -l, but do not list owner.
-k like --block-size=1K.
-m fill width with a comma separated list of entries.
-p, --file-type print ? instead of non graphic characters.
-S sort by file size.
-s, --size print size of each file, in blocks.
-t sort by modification time.
-v sort by version.
-l list one file per line.

EXAMPLE:


  1. dir /opt/lampp/htdocs/
    Output:
    index.php test.php a.txt
    b.txt adc.php a.jpg
    In the above example, the command lists all the files in the directory 'htdocs'.

Ask Questions

Ask Question