- About ls : To list directory contents
- It comes from “coreutils-8.4” package.
- Configuration Files :
- Path: /bin/ls
Examples:
1. To list the directory content
$ ls |
2. To list all the directory contents
$ ls -a $ ls –all |
3. To skip listing implied . and ..
$ ls -A $ ls –almost-all |
4. To print the author of each file
$ ls –author -l |
5. To print in specified block size
$ ls –block-size=1024 |
6. To skip listing entries ending with ~
$ ls -B $ ls –ignore-backups |
7. To show the ctime for the files
$ ls -c |
8. To list entries by columns
$ ls -C |
9. To list the content in color
$ ls –color |
10. To list the directory entries only
$ ls -d $ ls –directory |
11. To not to sort the output
$ ls -f |
12. To append the indicator
$ ls -F $ ls –classify |
13. To specify the format
$ ls –format=verbose $ ls –format=long $ ls –format=commas $ ls –format=horizontal $ ls –format=across $ ls –format=vertical $ ls –format=single-column $ ls –format=context |
14. To long list
$ ls –full-time |
15. To list group and not the owner
$ ls -g |
16. To group directories before files
$ ls –group-directories-first |
17. To print in human readable format
$ ls -h $ ls –human-readable |
18. To list the size in powers of 1000 and not 1024
$ ls –si |
19. To follow symbolic links
$ ls -H $ ls –dereference-command-line |
20. To follow each command line symbolic link that points to a directory
$ ls –dereference-command-line-symlink-to-dir |
21. To skip listing implied entries matching shell PATTERN
$ ls –hide=PATTERN |
22. To print the index number of each file
$ ls -i $ ls –inode |
23. To skip listing implied entries matching shell PATTERN
$ ls -I $ ls –ignore=PATTERN |
24. To list the entries with block size of 1K
$ ls -k $ ls –block-size=1K |
25. To get comma separated list of entries
$ ls -m |
26. To list entries with numeric user and user IDs
$ ls -n $ ls –numeric-uid-gid |
27. To print raw entry names
$ ls -N $ ls –literal |
28. To skip listing group entries
$ ls -o |
29. To append indicator to directories
$ ls -p $ ls –indicator-style=slash |
30. To print the ? instead of non graphic characters
$ ls -q $ ls –hide-control-chars |
31. To enclose entry names in double quotes
$ ls -Q $ ls –quote-name |
32. To reverse order while sorting
$ ls -r $ ls –reverse |
33. To list subdirectories recursively
$ ls -R $ ls –recursive |
34. To print the allocated size of each file, in blocks
$ ls -s $ ls –size |
35. To sort by file size
$ ls -S |
36. To sort by WORD instead of name
$ ls –sort=WORD |
37. To sort by modification time
$ ls -t |
38. To assume tab stops at each COLS instead of 8
$ ls -T $ ls –tabsize=COLS |
39. To not to sort
$ ls -U |
40. For natural sort of (version) numbers within text
$ ls -v |
41. To assume screen width instead of current value
+$ ls -w $ ls –width=COLS |
42. To list entries by lines instead of by columns
$ ls -x |
43. To sort alphabetically by entry extension
$ ls -X |
44. To list one file per line
$ ls -1 |
45. To display the security context
$ ls –lcontext |
46. To display security context so it fits on most displays
$ ls -Z $ ls –context |
47. To display only security context and file name
$ ls –scontext |
48. To display the help
$ ls –help |
49. To output version information
$ ls –version |