What single command would you use?

You want to list a file line by line, but in reverse order. What single command would you use? Give only the command, without any parameters.

You want to list a file line by line, but in reverse order. What single command would you use? Give only the command, without any parameters.

Answer: tac

Explanation:
About tac

Concatenate and print files in reverse.

Syntax

tac [OPTION]… [FILE]…
-b, –before attach the separator before instead of after
-r, –regex interpret the separator as a regular expression
-s, –seperator=STRING use STRING as the separator instead of newline
–help display this help and exit
–version output version information and exit

Example:
tac /var/log/maillog | grep [email protected] | head -n 10



Leave a Reply 0

Your email address will not be published. Required fields are marked *