0

I need to display the content of the recent file in a directory, for my example it's a log file that gets generated for each execution hence I need to display the newest one the command :

ls -Art | tail -n 1 

output the right name, meaning the most recent file in a directory, my goal is to output the content of this file by further piping How could we do this?

1 Answer 1

4
cat `ls -Art | tail -n1`

or,

ls -Art | tail -n 1 | xargs cat

Not the answer you're looking for? Browse other questions tagged or ask your own question.