The ls
command's -l
option prints a specified directory's contents in a long listing format. If no directory is specified then, by default, the contents of the current directory are listed.
ls -l /etc
Example Output:
total 1204
drwxr-xr-x 3 root root 4096 Apr 21 03:44 acpi
-rw-r--r-- 1 root root 3028 Apr 21 03:38 adduser.conf
drwxr-xr-x 2 root root 4096 Jun 11 20:42 alternatives
...
The output first displays total
, which indicates the total size in blocks of all the files in the listed directory. It then displays eight columns of information for each file in the listed directory. Below are the details for each column in the output:
Column No. | Example | Description |
---|---|---|
1.1 | d | File type (see table below) |
1.2 | rwxr-xr-x | Permission string |
2 | 3 | Number of hard links |
3 | root | Owner name |
4 | root | Owner group |
5 | 4096 | File size in bytes |
6 | Apr 21 03:44 | Modification time |
7 | acpi | File name |
The file type can be one of any of the following characters.
Character | File Type |
---|---|
- | Regular file |
b | Block special file |
c | Character special file |
C | High performance ("contiguous data") file |
d | Directory |
D | Door (special IPC file in Solaris 2.5+ only) |
l | Symbolic link |
M | Off-line ("migrated") file (Cray DMF) |
n | Network special file (HP-UX) |
p | FIFO (named pipe) |
P | Port (special system file in Solaris 10+ only) |
s | Socket |
? | Some other file type |