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

Each line contains the following columns:

  1. Permissions: File type and access permissions (10 characters)
  2. Links: Number of hard links
  3. Owner: File owner username
  4. Group: File group name
  5. Size: File size in bytes
  6. Date/Time: Last modification timestamp
  7. Name: File or directory name

Permission Format

The first column shows file type and permissions as 10 characters:

Position Meaning Values
1 File type - (file), d (directory), l (link), etc.
2-4 Owner permissions r (read), w (write), x (execute)
5-7 Group permissions r (read), w (write), x (execute)
8-10 Others permissions r (read), w (write), x (execute)

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

See also