1
0

ls 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155
  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. .PP
  93. .B -Q
  94. By default, printed file names are quoted if they contain characters special to
  95. .IR rc (1).
  96. The
  97. .B -Q
  98. flag disables this behavior.
  99. .PP
  100. The mode printed under the
  101. .B -l
  102. option contains 11 characters,
  103. interpreted
  104. as follows:
  105. the first character is
  106. .TP
  107. .B d
  108. if the entry is a directory;
  109. .PD 0
  110. .TP
  111. .B a
  112. if the entry is an append-only file;
  113. .TP
  114. .B -
  115. if the entry is a plain file.
  116. .PD
  117. .PP
  118. The next letter is
  119. .B l
  120. if the file is exclusive access (one writer or reader at a time).
  121. .PP
  122. The last 9 characters are interpreted
  123. as three sets of three bits each.
  124. The first set refers to owner permissions;
  125. the next to permissions to others in the same user-group;
  126. and the last to all others.
  127. Within each set the three characters indicate
  128. permission respectively to read, to write, or to
  129. execute the file as a program.
  130. For a directory, `execute' permission is interpreted
  131. to mean permission to search the directory
  132. for a specified file.
  133. The permissions are indicated as follows:
  134. .TP 3
  135. .B r
  136. if the file is readable;
  137. .PD 0
  138. .TP 3
  139. .B w
  140. if the file is writable;
  141. .TP 3
  142. .B x
  143. if the file is executable;
  144. .TP 3
  145. .B -
  146. if none of the above permissions is granted.
  147. .PD
  148. .SH SOURCE
  149. .B /sys/src/cmd/ls.c
  150. .br
  151. .B /rc/bin/lc
  152. .SH SEE ALSO
  153. .IR stat (2)
  154. .IR mc (1)