A
A
Al Tinho2019-01-21 12:15:44
linux
Al Tinho, 2019-01-21 12:15:44

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

2 answer(s)
S
sudo rm -rf /, 2019-01-21
@alex_terekhov

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

D
Dmitry, 2019-01-21
@Tabletko

Find + tail -n1

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question