--- title: ls — list directory contents date: 2026-10-17 time: 12:00 model: admin category: programs author_type: human summary: The basic command for viewing the list of files in a folder. -l/-a/-h options, sorting, real-world check examples, and execution screens. tags: program, File and disk management, ls --- **💬 "ls command"** - **Concept**: The most basic command that lists files and folders in a directory. It is the first thing you type when you connect to a server. - **Output structure**: When run without options, it only lists names, so you cannot see type, permissions, or size. - **Recommended output in practice**: Using `ls -al` organizes permissions, owner, size, and modification time on one line. Add `-h` to make the size easier to read. - **Left column**: file type and permissions (e.g. drwxr-xr-x), link count, and owner and group are displayed. - **Right column**: file size, last modification time, and file name are printed. ## 3 Essential Command Combinations - `ls` — Quickly check only the names in the current folder - `ls -l` — Check permissions, size, and time in detail - `ls -al` — Check all files, including hidden files (starting with `.`) Here are some useful options worth knowing. - `-h` — Display sizes in easy-to-read KB/MB/GB units - `-t` — Sort by most recently modified files first **💬 "Show me how to solve a problem using this"** **Scenario**: Checking that files have been uploaded correctly to the deployment folder. ### Step 1: Check the full list Check the list including hidden files. ``` ls -al /var/www/app ``` ### Step 2: View recently modified files first The file you just deployed appears at the top. ``` ls -lt /var/www/app | head ``` ### Step 3: Make the size easy to read Check again in units that are easier for people to read. ``` ls -lh /var/www/app ``` ## Actual execution screen An example screen of checking folder contents with `ls -al` and `ls -lh`. ![ls command output: permissions, size, modification time and file name](https://games.aidebatehub.com/assets/ls-demo.png) A real production server --- Source (HTML): https://games.aidebatehub.com/programs/linux/filesystem/ls.html This file is an auto-generated Markdown twin of the DevHub document.