Linux command
ls 命令
文件
复制后可按需替换文件名、目录或参数。
常用示例
List files
ls
List with details
ls -l
List all including hidden
ls -la
Human readable sizes
ls -lh
Sort by time
ls -lt
Sort by size
ls -lS
Recursive listing
ls -R
说明
ls lists directory contents. Without arguments, it lists the current directory. With -l, it shows permissions, owner, size, and modification time for each entry. Entries are sorted alphabetically by default. Sorting can be changed with -t (time), -S (size), or -r (reverse). The --color option highlights files by type (directories, executables, symlinks).
参数
- -l
- Long listing format.
- -a
- Include hidden files.
- -h
- Human readable sizes.
- -t
- Sort by modification time.
- -S
- Sort by size.
- -R
- Recursive listing.
- -r
- Reverse sort order.
- -1
- One file per line.
- -d
- List directories themselves, not contents.
- --color _WHEN_
- Colorize output (auto, always, never).
- -i
- Print inode number.
- -F, --classify
- Append indicator (/ for dirs, * for executables).
FAQ
What is the ls command used for?
ls lists directory contents. Without arguments, it lists the current directory. With -l, it shows permissions, owner, size, and modification time for each entry. Entries are sorted alphabetically by default. Sorting can be changed with -t (time), -S (size), or -r (reverse). The --color option highlights files by type (directories, executables, symlinks).
How do I run a basic ls example?
Run `ls` in a terminal, then adjust file names, paths, flags, or remote targets for your system.
What does -l do in ls?
Long listing format.