Answer the question
In order to leave comments, you need to log in
How to get the output of the last line of the last file in a directory in Centos7?
Good afternoon!
There is a directory in which once a day a file is created in which data is written during the day.
What is the command to display this data on the screen? (We need a permanent command that will take a fresh file from this directory and output the data of the last line from it)
Answer the question
In order to leave comments, you need to log in
Most recent file ls -t | head -n1
Last line of file xxx.txt cat xxx.txt | tail -n1
All togethercat $(ls -t | head -n1) | tail -n1
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question