Linux list files

Linux list files

To display the files in a directory in Linux, we know we can use ls command, but we also want to sort the files by different order.
If you are using Mac, you don’t have ll. You can set alias.

vi ~/.bash

Then add the following code.

alias 'ls -lG'

Update the shell without restarting computer.

source ~/.bash

Sort by file size

ll -S

Reverse order

ll -Sr

List files only without directory

ll -S | grep -v '^d'

Sort by date

ll -t
,