`ls` by time modified
One of the regular commands I employ when working on the command line is the
ls
command. A few years ago I set up a couple aliases for ls
and have used
them exclusively.
|
|
Aliasing ls
to ls -GF
has given me the ability to list directory contents in
colour and with some applied formatting to quickly distinguish the type of file
presented.
ll
provides the same functionality as my ls
alias, but outputs all the directory
contents in their long format, while ensuring their size suffixes are made human
readable.
Recently I found myself wanting to list the contents of a directory chronologically,
how this has never come up before is beyond me, but I cracked open the man page
for ls
and saw:
|
|
Now that’s a whole host of operands, a simple tool it may be, but ls
packs a
punch 👊🏼
Scanning the operands available to me, I’ve found what I wanted t
.
The t
operand allows me to sort output based on time modified, though I should note
that on a personal level for the output to feel usable to me I need to couple
the output with the l
operand so that I can actually see the time associated
with each file.
|
|
|
|
In short, I’ve ended up with a brand new alias for all
my ls
needs:
|
|
You can also use the T
operand to display time including seconds
|
|