How can I open all and only the n (e.g. 5) most recently modified files in a directory in less
or vim
?
I know I can use ls -t
to sort the output from most recent to oldest. So my intuition would be to use ls -t | head -5 | vim
but that doesn't work since ls
output is treadted by vim as raw text not filenames.
How do I do this with find
? My problem with find
is that I always use ls
to browser directories, so know how to use it - but find
I never use for that purpose.
*(om[1,5])
construct does in a referenced answer: https://unix.stackexchange.com/a/26495/377222 So even if I use fish, there's no harm in usingzsh
just for this one command, right? – Cornelius Roemer Sep 28 '21 at 21:37zsh -c ...
format. – Jeff Schaller Sep 28 '21 at 22:01zsh
my intuition was: oh no, I use fish, what now? – Cornelius Roemer Sep 29 '21 at 12:39