ls
FilesBeginner In simulator In real LinuxList directory contents
Name: ls = list
You can practise it right away in the simulator, and use it in real Linux mode too.
Description
ls lists the files and subdirectories of a directory: the current one by default, or the files you name. Entries are sorted by name and those starting with . are hidden.
With -l each entry gets a line of details: type and permissions, link count, owner, group, size, modification time and name. It is the usual way to inspect file attributes.
Now and then the permissions show an s or a t (as in /tmp, drwxrwxrwt): those are the special bits setuid, setgid and sticky; see chmod.
Syntax
ls [OPTION]... [FILE]...Common options
| -l | Long format: permissions, owner, size, mtime |
| -a / --all | Show all files, including hidden dotfiles |
| -A / --almost-all | Like -a but without . and .. |
| -h / --human-readable | With -l, print sizes like 4.0K, 2M |
| -t | Sort by modification time, newest first |
| -r / --reverse | Reverse the order (ls -ltr puts the newest last) |
| -S | Sort by size, largest first |
| -R / --recursive | List subdirectories recursively |
| -d / --directory | List directories themselves, not their contents |
| -1 | One name per line |
| -F / --classify | Mark types after names: / directory, * executable, @ symbolic link |
| -i / --inode | Show each file’s inode number |
| -n / --numeric-uid-gid | Like -l, with numeric user and group IDs |
| --color WHEN | Colour: auto (only on a terminal), always or never |
| --time-style STYLE | How times are shown, e.g. long-iso (2026-01-15 09:30) |