ls 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160
  1. .TH LS 1
  2. .SH NAME
  3. ls, lc \- list contents of directory
  4. .SH SYNOPSIS
  5. .B ls
  6. [
  7. .B -dlmnpqrstuFQT
  8. ]
  9. .I name ...
  10. .PP
  11. .B lc
  12. [
  13. .B -dlmnqrstuFQT
  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 -T
  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. .TP
  117. .B a
  118. if the entry is an append-only file;
  119. .TP
  120. .B -
  121. if the entry is a plain file.
  122. .PD
  123. .PP
  124. The next letter is
  125. .B l
  126. if the file is exclusive access (one writer or reader at a time).
  127. .PP
  128. The last 9 characters are interpreted
  129. as three sets of three bits each.
  130. The first set refers to owner permissions;
  131. the next to permissions to others in the same user-group;
  132. and the last to all others.
  133. Within each set the three characters indicate
  134. permission respectively to read, to write, or to
  135. execute the file as a program.
  136. For a directory, `execute' permission is interpreted
  137. to mean permission to search the directory
  138. for a specified file.
  139. The permissions are indicated as follows:
  140. .TP 3
  141. .B r
  142. if the file is readable;
  143. .PD 0
  144. .TP 3
  145. .B w
  146. if the file is writable;
  147. .TP 3
  148. .B x
  149. if the file is executable;
  150. .TP 3
  151. .B -
  152. if none of the above permissions is granted.
  153. .PD
  154. .SH SOURCE
  155. .B /sys/src/cmd/ls.c
  156. .br
  157. .B /rc/bin/lc
  158. .SH SEE ALSO
  159. .IR stat (2),
  160. .IR mc (1)