🐧 Linux / Shell Scripting
Beginner
How do you list files and directories in Linux?
Answer
Use the ls command to list files and directories. ls alone shows files in the current directory. Common options: ls -l shows a long listing with permissions, owner, size, and date; ls -a shows hidden files (those starting with a dot); ls -lh shows human-readable file sizes; ls -R lists recursively; ls -lt sorts by modification time. Example: ls -lah /var/log lists all files in /var/log with human-readable sizes including hidden ones.