Using SSH you can look at the last lines of a file in a Linux environment. This can be done using the Linux tail command. In this article, we’ll show the basic usage of tail and how to use it with SSH.
Show last 10 lines of a file using tail and SSH
tail
myTextFile.txt
Showing the last n lines using Linux tail command
Here you should replace n with the number of lines you wish to see
tail -n myTextFile.txt
Watch a file with Linux tail command
This will make tail refresh and display any changes made to the file. It’s useful when watching logs, waiting for an event to occur
tail -F myTextFile.txt