ls -l prints one line per file in the long listing format: file type and permissions, hard link count, owner, group, size, modification time and name. Read each line left to right, and the first ten characters tell you what the file is and who may read, write or run it.
What the output looks like
Example output (names and users are made up):
$ ls -l
total 28
drwxr-xr-x 2 alex staff 4096 Nov 2 09:14 docs
-rw-r--r-- 1 alex staff 1830 Nov 2 09:12 notes.txt
-rwxr-xr-x 1 alex staff 212 Oct 30 17:40 backup.sh
lrwxrwxrwx 1 alex staff 9 Oct 30 17:41 latest -> notes.txt
Take the notes.txt line apart:
| Field | Value | Meaning |
|---|---|---|
| 1. Type and permissions | -rw-r--r-- | Regular file; owner can read and write, group and others can read |
| 2. Hard links | 1 | Number of hard links to the file |
| 3. Owner | alex | User that owns the file |
| 4. Group | staff | Group that owns the file |
| 5. Size | 1830 | Size in bytes |
| 6. Modified | Nov 2 09:12 | Time of last modification |
| 7. Name | notes.txt | File name |
The first character: file type
The first character of the mode string is the file type. The kernel distinguishes sockets, symbolic links, regular files, block devices, directories, character devices and FIFOs (inode(7) lists them), and ls gives each its own letter:
| Character | Type |
|---|---|
- | Regular file |
d | Directory |
l | Symbolic link |
b | Block device |
c | Character device |
p | Named pipe (FIFO) |
s | Socket |
? | Some other file type |
For a symbolic link, the name column shows latest -> notes.txt: the link's name, an arrow, and the path it points to. The size shown for a link is the length of that path (9 characters for notes.txt in the example), not the size of the target.
The next nine characters: permissions
After the type come three groups of three characters, in this order: the owner (user), the file's group, and everyone else. Within each group the letters are always in the same positions:
rin the first position: read.win the second: write.xin the third: execute, or for a directory, search. A dash in any position means that permission is off.
So rwxr-xr-- means the owner can read, write and execute, the group can read and execute, and everyone else can only read.
The same bits map to the octal numbers you give to chmod. Per chmod(1), read is 4, write is 2 and execute is 1, and you add them for each group. That makes rw-r--r-- equal to 644 (6 for the owner, 4 for the group, 4 for others) and rwxr-xr-x equal to 755:
chmod 644 notes.txt
chmod 755 backup.sh
What permissions mean for directories
On a directory, x is the search permission: you need it to enter the directory or to reach anything inside it by path. Read lets you list the names, and write lets you create, rename or delete entries. A directory with r-- but no x can have its names listed, but you cannot open the files in it.
Special characters: s, t and +
Sometimes the third character of a group is not x or -:
sin the owner or group position: the set-user-ID or set-group-ID bit is set and the matching execute bit is also set. When an executable has set-user-ID, a process that runs it takes on the file owner's effective user ID.tin the last position: the sticky bit. On a directory, a file in it can be renamed or deleted only by the file's owner, the directory's owner, or a privileged process./tmpnormally shows this, asdrwxrwxrwt.+after the ten characters, as in-rw-r--r--+: the file has alternate access methods, such as an access control list, so the nine characters are not the whole story.
GNU ls also uses capital S and T when the special bit is set but the matching execute bit is not. The GNU manual's table of these characters is the reference to check if you hit an unfamiliar one.
The link count, owner and group
The number after the permissions is the count of hard links. A regular file with one name has 1. Owner and group come next as names. If the system cannot map an ID to a name, ls prints the number instead. You can force numbers with -n, which the man page describes as "like -l, but list numeric user and group IDs". That is useful when comparing ownership across a container, a mounted disk or another machine, where the names may not match.
Size and date
By default the size is in bytes. Add -h for human-readable sizes:
ls -lh
Example output:
-rw-r--r-- 1 alex staff 1.8K Nov 2 09:12 notes.txt
-rw-r--r-- 1 alex staff 234M Oct 12 2025 archive.tar
The date is the modification time. To change how it is displayed, use --time-style, or --full-time, which the man page defines as "like -l --time-style=full-iso". That shows the full date, time and time zone offset, which is the quickest way to compare two files that changed within the same minute.
What the "total" line means
The first line, total 28 in the example, is not a file count. The GNU manual says it prefaces the listing with "total blocks": the amount of file system space allocated to the files listed, not the sum of the sizes in the size column. It appears when listing a directory's contents, and it is why the number rarely matches what you would add up by hand.
Flags that make ls -l more useful
| Command | What it does |
|---|---|
ls -la | Long listing including entries that start with a dot (-a: "do not ignore entries starting with .") |
ls -lh | Sizes as 1K, 234M, 2G |
ls -lt | Newest first (-t sorts by time) |
ls -ltr | Oldest first, so the newest file is at the bottom, next to your prompt |
ls -lS | Largest first (-S sorts by size) |
ls -ld docs | Show the directory docs itself, not its contents |
ls -li | Add each file's inode (index) number as a first column |
ls -lR | Recurse into subdirectories |
ls -lF | Append an indicator such as / to directories and * to executables |
Single-letter options can be combined, so ls -lhtr gives a long listing with readable sizes, sorted oldest to newest.
ls -ld is the one people forget. Running ls -l docs lists what is inside the directory, so to check the permissions on the directory itself you need -d.
If the output looks different
These details vary by system, and the descriptions above follow GNU ls from coreutils, which is the default on most Linux distributions. Minimal systems such as Alpine ship BusyBox's ls, and macOS and the BSDs use their own, so some options (--full-time, --time-style) may be missing or behave differently. Run ls --version to see which one you have: GNU ls prints a version line mentioning coreutils, while others print an error or nothing useful.
If you see Permission denied when you list a directory, check the permissions on the directory itself and on each parent directory with ls -ld. You need x on every directory along the path and r on the one you are listing.
Frequently asked questions
- What does the first character in ls -l mean?
- It is the file type. A dash means a regular file, d a directory, and l a symbolic link. Block devices, character devices, named pipes (FIFOs) and sockets each have their own letter too. The nine characters after it are the permissions.
- What does the number after the permissions mean?
- It is the number of hard links to the file. For a regular file it is usually 1. For a directory it is typically at least 2, because of the directory's own entry and its '.' entry, and it grows with each subdirectory.
- How do I show file sizes in KB, MB and GB with ls -l?
- Add -h: ls -lh. With -l, the -h option prints sizes like 1K, 234M or 2G instead of raw bytes.
- Why does ls -l show a number or a plus sign instead of a name or letter?
- A number in the owner or group column means the system could not map that ID to a name, or you used -n, which lists numeric IDs. A plus sign right after the permission characters means the file has alternate access methods, such as an access control list.
- Does ls -l show hidden files?
- No. Names that begin with a dot are skipped unless you add -a, as in ls -la.