The dir command lists directory contents. It also lists information about the FILEs (the current directory by default). Sort entries alphabetically if none of -cftuvSUX nor –sort is specified.
dir Command Examples
1. To list all the directories:
# dir -a # dir --all
2. To skip listing implied directory contents:
# dir -A
3. To list the author of the each file:
# dir --author
4. To print octal escapes for nongraphic characters:
# dir -b # dir --escapes
5. To list the output using specified block size:
# dir --block-size=1024 # dir -k=1024
6. To skip listing entries ending with ~:
# dir -B # dir --ignore-backups
7. To list the contents with last modification time:
# dir -c
8. To list the entries by column:
# dir -C
9. To print the output in color:
# dir --color
10. To list only the directory entries:
# dir -d # dir --directory
11. To not to sort the output:
# dir -f
12. To list the directories with specified format:
# dir -x (across) # dir -m (Commas) # dir -x (Horizontal) # dir -l (Long) # dir -1 (Single-column) # dir -l (Vebose) # dir -c (Vertical)
13. To list the directories with specifying the full time:
# dir --full-time
14. To skip listing owner with long list:
# dir -g
15. To group directories before files:
# dir --group-directories-first
16. Do not list entries with specified pattern:
# dir --hide=ana* # dir -I=ana* # dir --ignore=ana*
17. To print the inode number of each file:
# dir -i # dir --inode
18. To list the entries with comma seperated list:
# dir -m
19. To list the entries with owner and group IDs:
# dir -n # dir --numeric-uid-gid
20. To print the raw entry names:
# dir -N # dir --literal
21. To list the entries without group info:
# dir -o
22. To append the indicators to the directories:
# dir -p /
23. To enclose the entry names in double quotes:
# dir -Q # dir --quote-name
24. To use quoting style:
# dir --quoting-style=slash # dir --quoting-style=literal # dir --quoting-style=locale # dir --quoting-style=shell-always # dir --quoting-style=shell # dir --quoting-style=c # dir --quoting-style=escape
25. To reverse order while sorting:
# dir -r # dir --reverse
26. To list sub directories recursively:
# dir -R # dir --recursive
27. To print the allocated size of each file in blocks:
# dir -s # dir --size
28. To sort by file size:
# dir -S
29. To sort by work instead of name:
# dir --sort=WORD none -U, extension -X, size -S, time -t, version -v
30. To list the files specified times (used with -l option):
# dir --time=WORD -l atime -u, access -u, use -u, ctime -c, or status -c; use specified time as sort key if --sort=time
31. To list the time with style (used with -l option):
# dir --time-style=STYLE full-iso, long-iso, iso, locale, +FORMAT.
32. To sort entries by modification time:
# dir -t
33. To list entries with specifying the tab size:
# dir --tabsize=8
34. To list entries in sorted order:
# dir -ult # dir -ul
35. To not to sort the entries:
# dir -U
36. To list entries with natural sort:
# dir -v
37. To list entries by line instead of columns:
# dir -x
38. To sort alphabatically:
# di -X
39. To list one file per line:
# dir -1
40. To display the security context:
# dir -Z
41. To display only security context and file name:
# dir --scontext
42. To display security context with long list:
# dir --lcontext