I was trying to figure out a way to retrieve the second lastest modified file name
With ls -tr
I can get the list with the latest modified in the bottom. With tail -2
I can get the latest and the second latest
But I'm looking to pick just the second latest.
This is my trick to accomplish this:
ls -tr | tail -2 | tac | tail -1
But not sure if there is some more elegant way to execute this.