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
Print human-readable sizes -h
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
Top comments (2)
I always use
ls -ltr
, as it show the last modified one at the bottomMy favorites are
ls -laht
ls -1