0

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?

Stephen Kitt
  • 434,908

1 Answers1

2

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)"