Skip to main content
added 57 characters in body
Source Link
Chris Stryczynski
  • 32.6k
  • 54
  • 197
  • 311
ls -Art | tail -n 1

This will return the latest modified file or directory. Not very elegant, but it works.

Used flags:

-A list all files except . and ..

-r reverse order while sorting

-t sort by time, newest first

ls -Art | tail -n 1

Not very elegant, but it works.

Used flags:

-A list all files except . and ..

-r reverse order while sorting

-t sort by time, newest first

ls -Art | tail -n 1

This will return the latest modified file or directory. Not very elegant, but it works.

Used flags:

-A list all files except . and ..

-r reverse order while sorting

-t sort by time, newest first

Added explanation of used flags
Source Link
mgutt
  • 6.1k
  • 2
  • 58
  • 81
ls -Art | tail -n 1

Not very elegant, but it works.

Used flags:

-A list all files except . and ..

-r reverse order while sorting

-t sort by time, newest first

ls -Art | tail -n 1

Not very elegant, but it works.

ls -Art | tail -n 1

Not very elegant, but it works.

Used flags:

-A list all files except . and ..

-r reverse order while sorting

-t sort by time, newest first

Fix for Jared
Source Link
ls -Art | tail -n 1

ls -rth | tail -n 1 ? Not very elegant, but it works.

ls -rth | tail -n 1 ?

ls -Art | tail -n 1

Not very elegant, but it works.

removed extra backquote
Source Link
Zifre
  • 26.8k
  • 11
  • 86
  • 105
Loading
Source Link
Loading