Reputation: 542
I'm trying to find a simple command in bash that opens the last added file in a directory. I came across this and a few other questions but they were always about the last modified, in contrast with last added. Is there a simple way to do this?
Upvotes: 0
Views: 1089
Reputation: 56
I think this answers why the thing you need is not possible.
Linux filesystems either just don't record creation time or if they do there is no way to access it through standard command line tools. However, there are ways to access it as described here for example.
For systems that do record the time, such as Mac OS X as mentioned in the other question, you can adapt the code you found by using:
ls -tU | head -n1
Upvotes: 4