1 | 2 | 3 | 4 | 5 | 6 | Current Level: 7 | 8
ls
OptionsThe ls
command can be used with more than one option at a time. Options change how the output is displayed.
Try the -l
option
Type:
ls -l
This shows a long list format with extra details like file size, permissions, and dates.
Try -l
with -h
Type:
ls -lh
This shows the same list, but file sizes are shown in a readable format (like 1K
, 2M
, etc.).
Combine options You can write options together:
ls -lh
is the same as:
ls -l -h
List files in reverse chronological order
Try:
ls -lt
This lists files by last modified time (newest first).
Add -r
to reverse the order:
ls -ltr
Now the oldest files appear first.
Add -h
to make sizes easier to read:
ls -ltrh
Use this to answer:
Which file was changed last?
Look at the bottom of the list — that’s the most recently changed file when using -ltr
.