Timeline for Get most recent file in a directory on Linux
Current License: CC BY-SA 4.0
16 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Aug 21, 2022 at 18:56 | history | edited | Chris Stryczynski | CC BY-SA 4.0 |
added 13 characters in body
|
Jun 30, 2022 at 11:42 | comment | added | A.D. |
@achasinh how can --reverse modification time return latest file? :)
|
|
Feb 24, 2017 at 21:58 | comment | added | joelostblom |
@achasinh Replace head with tail . And ideally include --group-directories-first also.
|
|
Jan 9, 2017 at 7:41 | comment | added | achasinh |
This returns a folder if it's the latest modified, use: ls -Art | head -n1 if you specifically want the latest modified file
|
|
Jan 1, 2017 at 14:19 | comment | added | chaos |
@noɥʇʎԀʎzɐɹƆ ls -t *.png | head -n1
|
|
Dec 31, 2016 at 14:05 | comment | added | noɥʇʎԀʎzɐɹƆ | Is there a way to filter by file extension, for example PNG? | |
Nov 16, 2016 at 17:08 | comment | added | slim |
@ack if your ls outputs extraneous stuff, all sorts of scripts are going to break. Standard ls is smart enough to know when it's writing to a pipe rather than a terminal, and turns off things like columns and colours.
|
|
Oct 20, 2015 at 10:38 | history | edited | fedorqui | CC BY-SA 3.0 |
format
|
Nov 14, 2014 at 17:23 | comment | added | dmckee --- ex-moderator kitten |
@Josir This can be modified to include the datestamp with ls -tl | head -n 1 , and it doesn't have to push the whole table through the pipe the way mine does.
|
|
Sep 18, 2014 at 14:34 | comment | added | Josir | dmckee solution is better because you can add also the date stamp using "ls -Artls | tail -n 1" | |
S Jan 22, 2014 at 10:17 | history | suggested | CommunityBot | CC BY-SA 3.0 |
The above command actually finds the latest file in the current directory.
|
Jan 22, 2014 at 10:12 | review | Suggested edits | |||
S Jan 22, 2014 at 10:17 | |||||
Dec 21, 2013 at 23:26 | comment | added | slm |
This lists the files based on the last time the meta information was changed. See the man page for ls .
|
|
Jun 18, 2009 at 23:22 | comment | added | ack | doesn't quite work for me since i echo out some info in my ls first, but i get the usage, thanks! | |
Jun 18, 2009 at 23:20 | comment | added | dmckee --- ex-moderator kitten | Equivalent to mine, and possibly more efficient, too. | |
Jun 18, 2009 at 23:18 | history | answered | chaos | CC BY-SA 2.5 |