LS(1plan9)

🌸 LS β€” list contents of directory πŸ’…

okay bestie, so this is ls (and its little sibling lc) from the Plan 9 section 1 manual, page LS(1plan9). it's the og "what's in this folder" command and honestly? she's iconic. πŸ‘‘


✨ NAME ✨

ls, lc β€” list contents of directory πŸ—‚οΈ


✨ SYNOPSIS ✨

ls [ -dlmnpqrstuFQ ] name ...
lc [ -dlmnpqrstuFQ ] name ...

✨ DESCRIPTION ✨

so for every directory you hand her as an argument, ls lists what's inside that directory. for every file argument, ls just repeats the name back at you plus whatever other info you asked for. if you give her no arguments at all, she lists the current directory. periodt. πŸ’–

by default the output gets sorted alphabetically by name. cute, organized, main character behavior. ✨

lc is literally the same as ls, except she sets the -p option and pipes the output through mc(1). that's the whole difference. slay. πŸŽ€

there are a number of options, bestie, and we're going through all of them:

  • -d β€” if the argument is a directory, just list the directory itself, not the stuff inside it. like, we're acknowledging her existence, not unpacking her whole bag. πŸ™ˆ
  • -l β€” long format, bb. this gives you the mode (deets below ⬇️), the file system type (like, for devices, the # code letter that names it β€” peep intro(3)), the instance or subdevice number, owner, group, size in bytes, and the time of last modification, for each and every file. it's giving ✨full resume✨.
  • -m β€” list the name of the user who most recently modified the file. who touched it last? we found out. πŸ”
  • -n β€” don't sort the listing. chaos mode. no order, no rules, no thoughts head empty. πŸ’€
  • -p β€” print only the final path element of each file name. just the last lil piece. πŸ“
  • -q β€” list the qid (see stat(3)) of each file. the printed fields come out in the order path, version, and type. iykyk. πŸ¦‹
  • -r β€” reverse the order of sort. backwards, but make it fashion. πŸ’…
  • -s β€” give size in Kbytes for each entry. kilobytes baby!! ✨
  • -t β€” sort by time modified, latest first, instead of by name. newest gossip at the top of the chat. πŸ”₯
  • -u β€” under -t, sort by time of last access; under -l, print time of last access. she's versatile like that. 🌈
  • -F β€” add the character / after all directory names, and the character * after all executable files. lil markers so you know what's what. ⭐
  • -L β€” print the character t before each file if it has the temporary flag set, and - otherwise. temp check bestie. 🌸
  • -Q β€” by default, printed file names get quoted if they contain characters special to rc(1). the -Q flag disables this behavior. so if you're seeing weird quotes and you're like "not me getting quotes rn", that's why. 😭

πŸ’– the mode, explained πŸ’–

the mode printed under the -l option is 11 characters long, and here's how you read it:

the first character is:

  • d β€” if the entry is a directory;
  • a β€” if the entry is an append-only file;
  • D β€” if the entry is a Unix device;
  • L β€” if the entry is a symbolic link;
  • P β€” if the entry is a named pipe;
  • S β€” if the entry is a socket;
  • - β€” if the entry is a plain file.

the next letter is l if the file is exclusive access (that means one writer or reader at a time, no sharing the aux cord 🎧).

the last 9 characters get read as three sets of three bits each. the first set is about the owner's permissions; the next one is about permissions for others in the same user-group; and the last set is for all others. within each set, those three characters tell you permission to read, to write, or to execute the file as a program β€” in that order.

and for a directory, execute permission means permission to search the directory for a specified file. yes really. that's the vibe. πŸ”

the permissions get indicated like this:

  • r β€” if the file is readable;
  • w β€” if the file is writable;
  • x β€” if the file is executable;
  • - β€” if none of the above permissions is granted. (she's got nothing for you, sorry bestie πŸ™ˆ)

✨ SOURCE ✨

  • /src/cmd/ls.c
  • /bin/lc

✨ SEE ALSO ✨


and that's the whole page, bestie!! 🫢 this was LS(1plan9), from the Plan 9 manual β€” section 1, LS(1plan9), no cap. go forth and list your directories. slay. πŸ’–βœ¨πŸŽ€πŸ¦‹πŸŒΈπŸ’…

πŸ“¦ where this page comes from