If you want to display the contents of a file on a Linux system, you can use the cat command - the "cat" is shorthand for "concatenate.
$ cat sample.txt Adhere to your purpose and you will soon feel as well as you ever did. On the contrary, if you falter, and give up, you will lose the power of keeping any resolution, and will regret it all your life. ~ Abraham Lincoln in a June 28, 1862 letter to Quintin Campbell $
Should you ever need to display the characters on a line in reverse order,
on a Linux system you can use the
rev command to do so - the
"rev" is shorthand for "reverse". E.g., suppose I want to display the same file
as in the example above. If I type
rev sample.txt, I will see
every line displayed in reverse with the last character in the line becoming
the first and the first the last.
$ rev sample.txt .did reve uoy sa llew sa leef noos lliw uoy dna esoprup ruoy ot erehdA ,pu evig dna ,retlaf uoy fi ,yrartnoc eht nO ,noituloser yna gnipeek fo rewop eht esol lliw uoy .efil ruoy lla ti terger lliw dna llebpmaC nitniuQ ot rettel 2681 ,82 enuJ a ni nlocniL maharbA ~ $
If you wanted to display the last line as the first line and the first line as the last rather than reversing the characters on each line, you can use the tac command - "tac" is "cat" in reverse. E.g., for the same sample.txt file:
$ tac sample.txt ~ Abraham Lincoln in a June 28, 1862 letter to Quintin Campbell and will regret it all your life. you will lose the power of keeping any resolution, On the contrary, if you falter, and give up, Adhere to your purpose and you will soon feel as well as you ever did. $
On a CentOS
Linux system, the
commands are part of the coreutils package while the
command is part of the util-linux package.
$ rpm -q --whatprovides /usr/bin/cat coreutils-8.22-11.el7.x86_64 $ rpm -q --whatprovides /usr/bin/rev util-linux-2.23.2-22.el7_1.x86_64 $ rpm -q --whatprovides /usr/bin/tac coreutils-8.22-11.el7.x86_64 $
The util-linux package can be obtained using whatever
management utility you normally use for your distribution of Linux,
e.g., yum for CentOS, or you can obtain the utility via
from the Linux Kernel Archive at ftp.kernel.org. You can login using
"anonymous" as the userid and anything for the password, then type
cd pub/linux/utils/util-linux to see the available versions.