From b0f7803832867ec27616363e6ba98bc50a9c1dbf Mon Sep 17 00:00:00 2001 From: jbranchaud Date: Fri, 18 Aug 2017 18:39:47 -0500 Subject: [PATCH] Add List Files Ordered By Modification Date as a unix til --- README.md | 3 +- ...list-files-ordered-by-modification-date.md | 30 +++++++++++++++++++ 2 files changed, 32 insertions(+), 1 deletion(-) create mode 100644 unix/list-files-ordered-by-modification-date.md diff --git a/README.md b/README.md index ab2d49b..2477bac 100644 --- a/README.md +++ b/README.md @@ -10,7 +10,7 @@ smart people at [Hashrocket](http://hashrocket.com/). For a steady stream of TILs from a variety of rocketeers, checkout [til.hashrocket.com](https://til.hashrocket.com/). -_551 TILs and counting..._ +_552 TILs and counting..._ --- @@ -502,6 +502,7 @@ _551 TILs and counting..._ - [Last Argument Of The Last Command](unix/last-argument-of-the-last-command.md) - [Less With Style](unix/less-with-style.md) - [List All Users](unix/list-all-users.md) +- [List Files Ordered By Modification Date](unix/list-files-ordered-by-modification-date.md) - [List Names Of Files With Matches](unix/list-names-of-files-with-matches.md) - [List Of Sessions To A Machine](unix/list-of-sessions-to-a-machine.md) - [List Parent pid With ps](unix/list-parent-pid-with-ps.md) diff --git a/unix/list-files-ordered-by-modification-date.md b/unix/list-files-ordered-by-modification-date.md new file mode 100644 index 0000000..8abdc92 --- /dev/null +++ b/unix/list-files-ordered-by-modification-date.md @@ -0,0 +1,30 @@ +# List Files Ordered By Modification Date + +The `ls` command lists the files in a directory. Tacking on the `-l` flag +will list it in long format. By default, everything is listed in +lexicographical order. This is what `ls -l` looks like for this repository. + +``` +-rw-r--r-- 1 jbranchaud staff 628 Feb 14 2016 CONTRIBUTING.md +-rw-r--r-- 1 jbranchaud staff 1058 Feb 19 2015 LICENSE +-rw-r--r-- 1 jbranchaud staff 40983 Aug 18 16:59 README.md +drwxr-xr-x 5 jbranchaud staff 170 Apr 1 14:45 ack +drwxr-xr-x 5 jbranchaud staff 170 Feb 24 16:31 chrome +... +``` + +Sometimes you want a sense of what has been modified and when. +Lexicographical order isn't going to help much here. By tacking on the `-t` +flag, the files will be listed in order of their modification dates. Here is +`ls -lt` for the same repository. + +``` +-rw-r--r-- 1 jbranchaud staff 40983 Aug 18 16:59 README.md +drwxr-xr-x 119 jbranchaud staff 4046 Aug 17 11:38 vim +drwxr-xr-x 5 jbranchaud staff 170 Aug 16 10:47 internet +drwxr-xr-x 23 jbranchaud staff 782 Aug 1 10:17 javascript +drwxr-xr-x 7 jbranchaud staff 238 Jul 22 14:04 webpack +... +``` + +See `man ls` for more details.