ls -ltr command to sort files by time

$ls
greedy-algorithm-example-coin-change-problem.js
longest-common-substring.js
memoization-top-down-approach.js
solving-knapsack-problem-a-recursive-solution.js
solving-knapsack-problem.js
tabulation-bottom-up-approach.js
$
ls shows the contents of the current directory


$ls -ltr
total 24
-rw-rw-r-- 1 jeffrin jeffrin 591 Feb 9 21:37 memoization-top-down-approach.js
-rw-rw-r-- 1 jeffrin jeffrin 436 Feb 9 21:56 tabulation-bottom-up-approach.js
-rw-rw-r-- 1 jeffrin jeffrin 2133 Feb 16 22:13 longest-common-substring.js
-rw-rw-r-- 1 jeffrin jeffrin 2288 Feb 18 21:54 solving-knapsack-problem.js
-rw-rw-r-- 1 jeffrin jeffrin 1303 Feb 19 22:24 solving-knapsack-problem-a-recursive-solution.js
-rw-rw-r-- 1 jeffrin jeffrin 1366 Feb 21 23:17 greedy-algorithm-example-coin-change-problem.js
$
-l use a long listing format
-r reverse order while sorting
-t sort by time, newest first
here you can see that the oldest date comes first because -r is given for reverse sorting.
Here you can see the latest file for checking new things.


Leave a comment

Your email address will not be published. Required fields are marked *