The ls command in Linux is used to list the contents of a directory. It displays files and subdirectories within the specified directory or the current directory if none is specified.
Basic Usage:
ls
This command will show the names of files and directories in the current working directory.
Common Options:
-l: Long format. Displays detailed information, including permissions, owner, size, and modification date.ls -l-a: Shows all files, including hidden files (those starting with a dot).ls -a-h: Human-readable format. Used with-lto display file sizes in a more understandable format (e.g., KB, MB).ls -lh-R: Recursively lists all files and directories in the specified directory and its subdirectories.ls -R
Example:
To list all files, including hidden ones, in long format:
ls -la
The ls command is a fundamental tool for navigating and managing files in the Linux command line.
