This question already has an answer here:

ls -t1 | head -n 1 will give me the latest updated file so I want to tail that latest updated file in shell. How do I do that?

marked as duplicate by muru, Stephen Kitt bash Jun 6 at 7:58

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.


One possible solution is to open a subshell for the command you want to run and add the result of the command as the parameter of tail:

tail "$(ls -t1 | head -n 1)"

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