News for hackers. Stuff that matters.

Ask HN: What tricks and tips do you know for $ls Linux command? Thank you

What tricks & tips do you know for $ls Linux command?

I found few of them interesting:

$ls -d */ # to list all directories from current location

$ls -l | grep '^-' # to list all regular files from current location

$ls -l --time-style=long-iso # print time format yyyy-mm-dd hh:mm

Other nice combinations:

$ls -Qm # output between quotes delimited by a comma

$ls -alsSh # print all files in a long list format, using size option + sort, in a human readable format

( 1 comment | 4 points | on HN )
Re:Ask HN: What tricks and tips do you know for $ls Linux co... by enchiridion on Monday February 01, 2021 @12:03PM (#25990489)
ls -ltr or ll -tr if you have it aliased like Ubuntu

Verbose list in reverse order by time (newest last, so it appears closest to the cursor if you're looking for most recently modified).