HACKER Q&A
📣 gotac

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


  👤 enchiridion Accepted Answer ✓
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).