ls 🚚

Lists directory content.

Long list (detailed format) -l

cd ~ && ls -l
drwxr-xr-x 5 babak babak       4096 Nov  1 12:49 Desktop
drwxr-xr-x 9 babak babak       4096 Nov 21 18:49 Documents
drwxr-xr-x 2 babak babak      20480 Nov 23 17:21 Pictures
...

Show directories first --group-directories-first

cd ~ && ls --group-directories-first

List directory itself, not its content -d

cd ~ && ls -lhd Documents
drwxr-xr-x 9 babak babak 4.0K Nov 21 18:49 Documents

List all files (include dot-files) -a

cd ~ && ls -a
cd ~ && ls -lh
drwxr-xr-x 5 babak babak 4.0K Nov  1 12:49 Desktop
drwxr-xr-x 9 babak babak 4.0K Nov 21 18:49 Documents
drwxr-xr-x 2 babak babak  20K Nov 23 17:21 Pictures
...

Sort by time -t

cd ~ && ls -lht
drwxr-xr-x 2 babak babak  20K Nov 23 17:21 Pictures
drwxr-xr-x 9 babak babak 4.0K Nov 21 18:49 Documents
drwxr-xr-x 5 babak babak 4.0K Nov  1 12:49 Desktop

Sort by size -s

cd ~ && ls -lhs

Reverse sort order -r

cd ~ && ls -lhsr
drwxr-xr-x 2 babak babak  20K Nov 23 17:21 Pictures
drwxr-xr-x 9 babak babak 4.0K Nov 21 18:49 Documents
drwxr-xr-x 5 babak babak 4.0K Nov  1 12:49 Desktop

About Living in the Shell
Obsessed with doing things in the shell, I’ve decided to share my daily struggles on living in the shell as terse but informative posts.