ls -l Command
The ls -l command displays directory contents in long format, showing detailed information about each file and directory including permissions, ownership, size, and modification dates.
Syntax
ls -l [directory]
Description
The -l option produces a long listing format that displays detailed information about files and directories in columns.
The long format shows:
- File type and permissions
- Number of hard links
- Owner name
- Group name
- File size in bytes
- Last modification date and time
- File or directory name
Output Format
-rw-r--r-- 1 user group 1024 Jan 21 10:30 filename.txt
drwxr-xr-x 2 user group 4096 Jan 21 09:15 directory_name
drwxr-xr-x 2 user group 4096 Jan 21 09:15 directory_name
Each line contains the following columns:
- Permissions: File type and access permissions (10 characters)
- Links: Number of hard links
- Owner: File owner username
- Group: File group name
- Size: File size in bytes
- Date/Time: Last modification timestamp
- Name: File or directory name
Examples
Basic long listing
ls -l
Shows detailed information for all files in current directory
Long listing of specific directory
ls -l /home/user/Documents
Shows detailed listing of specified directory
Long listing with hidden files
ls -la
Combines long format with showing all files (including hidden)
Human-readable file sizes
ls -lh
Shows file sizes in KB, MB, GB format instead of bytes
Sort by modification time
ls -lt
Long listing sorted by modification time (newest first)
Reverse order listing
ls -lr
Long listing in reverse alphabetical order