ls 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162
  1. .TH LS 1
  2. .SH NAME
  3. ls, lc \- list contents of directory
  4. .SH SYNOPSIS
  5. .B ls
  6. [
  7. .B -dlmnpqrstuFQ
  8. ]
  9. .I name ...
  10. .PP
  11. .B lc
  12. [
  13. .B -dlmnqrstuFQ
  14. ]
  15. .I name ...
  16. .SH DESCRIPTION
  17. For each directory argument,
  18. .I ls
  19. lists the contents of the directory;
  20. for each file argument,
  21. .I ls
  22. repeats its name and any other information requested.
  23. When no argument is given, the current directory is listed.
  24. By default, the output is sorted alphabetically by name.
  25. .PP
  26. .I Lc
  27. is the same as
  28. .IR ls ,
  29. but sets the
  30. .B -p
  31. option and pipes the output through
  32. .IR mc (1).
  33. .PP
  34. There are a number of options:
  35. .TP
  36. .B -d
  37. If argument is a directory, list it, not
  38. its contents.
  39. .TP
  40. .B -l
  41. List in long format, giving mode (see below), file system type
  42. (e.g., for devices, the
  43. .B #
  44. code letter that names it; see
  45. .IR intro (3)),
  46. the instance or subdevice number, owner, group,
  47. size in bytes, and time of last modification
  48. for each file.
  49. .TP
  50. .B -m
  51. List the name of the user who most recently modified the file.
  52. .TP
  53. .B -n
  54. Don't sort the listing.
  55. .TP
  56. .B -p
  57. Print only the final path element of each file name.
  58. .TP
  59. .B -q
  60. List the
  61. .I qid
  62. (see
  63. .IR stat (2))
  64. of each file; the printed fields are in the order
  65. path, version, and type.
  66. .TP
  67. .B -r
  68. Reverse the order of sort.
  69. .TP
  70. .B -s
  71. Give size in Kbytes for each entry.
  72. .TP
  73. .B -t
  74. Sort by time modified (latest first) instead of
  75. by name.
  76. .TP
  77. .B -u
  78. Under
  79. .B -t
  80. sort by time of last access;
  81. under
  82. .B -l
  83. print time of last access.
  84. .TP
  85. .B -F
  86. Add the character
  87. .B /
  88. after all directory names
  89. and the character
  90. .B *
  91. after all executable files.
  92. .TP
  93. .B -L
  94. Print the character
  95. .B t
  96. before each file if it has the temporary flag set, and
  97. .B -
  98. otherwise.
  99. .TP
  100. .B -Q
  101. By default, printed file names are quoted if they contain characters special to
  102. .IR rc (1).
  103. The
  104. .B -Q
  105. flag disables this behavior.
  106. .PP
  107. The mode printed under the
  108. .B -l
  109. option contains 11 characters,
  110. interpreted
  111. as follows:
  112. the first character is
  113. .TP
  114. .B d
  115. if the entry is a directory;
  116. .PD 0
  117. .TP
  118. .B a
  119. if the entry is an append-only file;
  120. .TP
  121. .B -
  122. if the entry is a plain file.
  123. .PD
  124. .PP
  125. The next letter is
  126. .B l
  127. if the file is exclusive access (one writer or reader at a time).
  128. .PP
  129. The last 9 characters are interpreted
  130. as three sets of three bits each.
  131. The first set refers to owner permissions;
  132. the next to permissions to others in the same user-group;
  133. and the last to all others.
  134. Within each set the three characters indicate
  135. permission respectively to read, to write, or to
  136. execute the file as a program.
  137. For a directory, `execute' permission is interpreted
  138. to mean permission to search the directory
  139. for a specified file.
  140. The permissions are indicated as follows:
  141. .TP 3
  142. .B r
  143. if the file is readable;
  144. .PD 0
  145. .TP 3
  146. .B w
  147. if the file is writable;
  148. .TP 3
  149. .B x
  150. if the file is executable;
  151. .TP 3
  152. .B -
  153. if none of the above permissions is granted.
  154. .PD
  155. .SH SOURCE
  156. .B /sys/src/cmd/ls.c
  157. .br
  158. .B /rc/bin/lc
  159. .SH SEE ALSO
  160. .IR stat (2)
  161. .IR mc (1)