osx - Find newest file in folder via the terminal (seconds apart) -


i trying extract newest file in folder. tried this:

ls -1t | head -1 

but problem is, command doesn't seem differentiate in second file created - if multiple files created in the same, command give first file in minute.

is there way make command more precise?

you should add t argument options that:

ls -1tt | head -1 

see output when l argument added:

ls -ttl  -rw-r--r--  1 user  wheel      0 apr 23 17:54:27 2016 1 -rw-r--r--  1 user  wheel      0 apr 23 17:54:19 2016 3  -rw-r--r--  1 user  wheel      0 apr 23 17:54:12 2016 2 

Comments

Popular posts from this blog

html - Styling progress bar with inline style -

java - Oracle Sql developer error: could not install some modules -

How to use autoclose brackets in Jupyter notebook? -