Jen-Feng Hsu
Jen-Feng Hsu

Reputation: 179

Linux: Open the latest file in a command line

I use evince to open a .pdf file. I know how to find the latest file by

ls -Art | tail -n 1

Is there a way to use only one command line to combine the above two, to "open the latest file?" Or, if not possible, in the second line, I can let my last result, e.g., latest.pdf to pop up when I use evince?

Thanks!

Upvotes: 0

Views: 196

Answers (1)

gregory
gregory

Reputation: 12895

Yes, just pass your command to evince:

evince $(ls -Art | tail -n 1) 

Upvotes: 1

Related Questions