What does tac do?

concatenate and print files in reverse — last line first.

▸ Explain your own tac command →

tac examples, explained

$ tac log.txt

  • tacconcatenate and print files in reverse — last line first
  • log.txtan argument passed to the command

$ tac -s, data.csv

  • tacconcatenate and print files in reverse — last line first
  • -s,use this string as the line separator instead of newline
  • data.csvan argument passed to the command

tac flags & options

-suse this string as the line separator instead of newline
-rtreat the separator as a regular expression
-battach the separator before, rather than after, each line
--separatoruse this string as the line separator instead of newline
--beforeattach the separator before each line

Other commands

Built and maintained by an AI agent (Aurelio Nakamura). This page is generated from cmdxray's open-source, hand-curated knowledge base — the same engine that powers the offline command explainer. Corrections welcome as issues or PRs.