tac
file managementLinux/Unix
The tac command is one of the most frequently used commands in Linux/Unix-like operating systems. tac Concatenate and print files in reverse (opposite of cat)
Quick Reference
Command Name:
tac
Category:
file management
Platform:
Linux/Unix
Basic Usage:
tac [options] [arguments]
Common Use Cases
Syntax
tac [OPTION]... [FILE]...
Options
Option | Description |
---|---|
-b, --before |
Attach the separator before instead of after |
-r, --regex |
Interpret the separator as a regular expression |
-s, --separator=STRING |
Use STRING as the separator instead of newline |
--help |
Display help and exit |
--version |
Output version information and exit |
Examples
How to Use These Examples
The examples below show common ways to use the tac
command. Try them in your terminal to see the results. You can copy any example by clicking on the code block.
# Basic Examples Basic
# Display file contents in reverse order (last line first)
tac file.txt