The ls
command is used to list directory contents in Unix and Unix-like operating systems. It provides information about files and directories within the file system.
ls [OPTION]... [FILE]...
-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-r
: Reverse order while sortingList all files, including hidden files:
ls -a
List files with detailed information:
ls -l
List files with human-readable file sizes:
ls -lh
List files sorted by modification time:
ls -lt
List files in reverse order:
ls -r
For more options and detailed usage, refer to the ls
command manual by typing man ls
in the terminal.