Linux Commands Helper
💬 Your AI-powered Linux assistant
ls Command - List Directory Contents
The ls command is used to list information about files and directories within the file system.
Syntax
ls [options] [file...]
Common Options
-a
: Include directory entries whose names begin with a dot (.).-l
: Use a long listing format.-h
: With -l, print sizes in human readable format (e.g., 1K 234M 2G).-t
: Sort by modification time, newest first.-S
: Sort by file size, largest first.
Examples
ls -l /home/user
List files in /home/user in long format.
ls -a
List all files including hidden files.
ls -lh
List files with human-readable file sizes.
Notes
- The ls command is one of the most frequently used commands in Linux for file and directory operations.
- Options can be combined (e.g.,
ls -lha
).