To check the contents of a directory in Linux, you can use the ls command. Here are some common usages:
-
Basic Listing:
lsThis command lists the files and directories in the current directory.
-
Detailed Listing:
ls -lThis command provides a detailed view, including file permissions, number of links, owner, group, size, and modification date.
-
Including Hidden Files:
ls -aThis command lists all files, including hidden files (those starting with a dot).
-
Detailed Listing with Hidden Files:
ls -laThis combines both options to show all files with detailed information.
-
Listing a Specific Directory:
ls /path/to/directoryReplace
/path/to/directorywith the actual path to the directory you want to check. -
Sorting by Modification Time:
ls -ltThis lists files sorted by modification time, with the most recently modified files first.
You can combine options as needed to customize the output.
