TAIL(1plan9)

🌸 TAIL β€” the last-part-of-a-file delivery service πŸ’…

okay bestie, this is tail from the Plan 9 manual, section 1. she delivers the last part of a file. that's the whole job. she's an icon, she's efficient, she eats. ✨


✨ SYNOPSIS ✨

tail [ +-number[lbc][rf] ] [ file ]

tail [ -fr ] [ -n nlines ] [ -c nbytes ] [ file ]

two whole ways to summon her. pick your fighter. 🫢


πŸ’– DESCRIPTION πŸ’–

okay so. tail copies the named file over to the standard output, starting from a designated place. no file named? then she just copies the standard input instead. lowkey flexible of her.

copying begins at position +number measured from the beginning, or -number from the end of the input. and number is counted in lines, 1K blocks, or bytes, according to the appended flag β€” l, b, or c. and if you don't say? the default is -10l (ten ell, as in ten lines, bestie).

the r flag? she prints lines from the end of the file in reverse order. dramatic. love that for her. and f (follow) means that after she's done printing to the end, she keeps watch and prints further data as it appears. she is not leaving. she's staying. main character energy fr fr. πŸ‘‘

and the second syntax up there is the one POSIX put out into the world, where the numbers β€” not the options β€” are the ones that are signed. iykyk. πŸ’€


🌈 EXAMPLES 🌈

  • tail file β€” print the last 10 lines of a file. simple. iconic.
  • tail +0f file β€” print a file, and keep watching data accumulate as it grows. she's glued to it. obsessed.
  • sed 10q file β€” print the first 10 lines of a file. yes this is a different tool, yes she's still slaying, no we're not gatekeeping. πŸ’œ

πŸŽ€ SOURCE πŸŽ€

/src/cmd/tail.c

that's where she lives. that's her address. don't be weird about it. 🏠


πŸ’€ BUGS πŸ’€

heads up babes, there are some things you gotta know.
  • tails relative to the end of the file are treasured up in a buffer, and thus are limited in length. so if your file is huge and you're asking for the tail end of it, she can only hold so much. 😭
  • according to custom, the option +number counts lines from 1, and counts blocks and bytes from 0. yes it's inconsistent. yes it's tradition. we don't make the rules. πŸ™ˆ
  • tail is ignorant of UTF. she does not know her unicode. she does not see the characters. she simply counts. do with that information what you will. πŸ¦‹

okay that's the whole page!! this was TAIL(1plan9) from the Plan 9 manual β€” go forth and read the ends of files responsibly, bestie. mwah. πŸ’–βœ¨πŸŽ€

πŸ“¦ where this page comes from