Fundamentals 6 min read

Comprehensive Guide to Using the ls Command in Linux

This tutorial explains the Linux ls command in depth, covering its basic usage, a wide range of options for detailed listings, sorting, displaying hidden files, size units, recursive traversal, and how to interpret output columns, all illustrated with command examples and screenshots.

DevOps Operations Practice
DevOps Operations Practice
DevOps Operations Practice
Comprehensive Guide to Using the ls Command in Linux

ls is a fundamental Linux command for listing directory contents. By default it shows names of files and directories in the current directory.

Common options include:

$ ls – basic listing without details.

$ ls -l – long format showing permissions, links, owner, group, size, modification time, and name.

$ ls -lh – human‑readable sizes.

$ ls -a – include hidden entries (those starting with a dot).

$ ls -lhS – sort by size, largest first, with human‑readable units.

$ ls -li – display inode numbers.

$ ls -p – append ‘/’ to directories.

$ ls -r – reverse order.

$ ls -R – recursive listing of subdirectories.

$ ls -lX – sort by file extension.

$ ls -lt – sort by modification time, newest first.

$ ls -d */ – list only directories.

$ ls -g – omit owner information.

$ ls -lG – omit group information.

$ ls --color=never – disable colored output.

$ ls -si – size in 1000‑byte units.

$ ls --block-size=M – display sizes in megabytes.

$ ls ~ – show the home directory.

$ ls ../ – list the parent directory.

$ ls --version – print ls version.

The article also explains how to interpret the columns of the long listing, the meaning of permission bits, and how to combine options for more powerful queries.

LinuxShellCommand LineUnixfile listingls command
DevOps Operations Practice
Written by

DevOps Operations Practice

We share professional insights on cloud-native, DevOps & operations, Kubernetes, observability & monitoring, and Linux systems.

0 followers
Reader feedback

How this landed with the community

login Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.