ls command
The ls command in Unix/Linux is used to list files and directories in the current
working directory or a specified directory.
It provides information such as file names, directories, and optionally file
permissions, sizes, and timestamps.
-----Detailed Listing (-l):
Lists files in a long format, providing detailed information such as:
File permissions: Access rights for the file.
Number of links: Number of hard links to the file.
Owner: The user who owns the file.
Group: The group that owns the file.
File size: Size of the file in bytes.
Timestamp: The last modification time of the file.
Filename: The name of the file or directory
Examples:
drwxr-xr-x 2 user group 4096 Sep 19 10:30 folder1
-rw-r--r-- 1 user group 123 Sep 19 10:30 [Link]
-----Show Hidden Files (-a):
-----List in Human-Readable Format (-lh):
---Lists files in a human-readable format,
showing file sizes in KB, MB, or GB rather than in bytes.
Example:
-rw-r--r-- 1 user group 1.2M Sep 19 10:30 [Link]
-----Sorting by File Size (-lS):
-----ls -alh: This command will:
1. List all files (including hidden ones).
2. Show detailed information in human-readable format (KB, MB, GB).