Is there any way to get full filename of latest file (creation time or modification time) in directory?


  • 1
    Welcome, clueless -- this is a reasonable question, but it is really about basic linux usage. Things like that belong on our larger sibling site, Unix & Linux, although I recommend you try and do a bit of research yourself first as you will be expected to demonstrate that you have tried. When searching online for basic command line usage questions like this, do not include "raspberry pi" in your search terms, but do include linux.
    – goldilocks
    Commented Aug 21, 2021 at 20:58

1 Answer 1


This might do what you want:

$ ls -t | head -n 1  

If not, you might try copying and pasting your question directly into your search engine. That's what I did to find this answer - it would work for you, too - even if you didn't know that man ls or man find might be useful commands.

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