Forrest logo
back to the tac tool

tac:tldr:ac218

tac: Use a specific [s]eparator.
$ tac -s ${separator} ${filename1 filename2 ---}
try on your machine

The "tac" command is used to concatenate and display files in reverse order (line by line).

Here is an explanation of the command:

  • "tac" is the command itself.
  • "-s" is an option that specifies the separator to be used between files.
  • "${separator}" is a placeholder for the actual separator you want to use. It can be any character or string.
  • "${filename1, filename2, ---}" represents the list of files you want to concatenate and display in reverse order. You can provide multiple filenames separated by spaces.

For example, if you want to reverse the lines and concatenate the contents of two files "file1.txt" and "file2.txt" using a comma (',') as the separator, the command would be:

tac -s , file1.txt file2.txt

This command will display the combined contents of "file2.txt" followed by "file1.txt", with each line reversed, and separated by commas.

This explanation was created by an AI. In most cases those are correct. But please always be careful and never run a command you are not sure if it is safe.
back to the tac tool