4 different ways to print file content reversely

view story

http://www.linuxandlife.com – Let's have some fun with the command line. In this article, I will list 4 different ways that I know with which we can print the file content in a reverse order. Let's say we have a sample file like this: 1 2 3 4 Here are the 4 methods we can use to print the file reversely: 1. Use tac This is the simplest way. The tac command is the reverse of "cat", so it just prints the file content in reverse order: 2. Use sort The sort command write sorted concatenation of the file to output. And with the "-nr" option, we will have a reversed output of the file content: 3. Us (Distributions)