2022-02-14 03:22:51 +01:00
|
|
|
---
|
|
|
|
title: ls
|
|
|
|
layout: command
|
|
|
|
version: 0.59.0
|
|
|
|
---
|
2021-05-30 02:57:04 +02:00
|
|
|
|
2022-02-14 03:22:51 +01:00
|
|
|
List the files in a directory.
|
2021-05-30 02:57:04 +02:00
|
|
|
|
2022-02-14 03:22:51 +01:00
|
|
|
## Signature
|
2021-05-30 02:57:04 +02:00
|
|
|
|
2022-02-14 03:22:51 +01:00
|
|
|
```> ls (pattern) --all --long --short-names --full-paths --du```
|
2021-05-30 02:57:04 +02:00
|
|
|
|
2022-02-14 03:22:51 +01:00
|
|
|
## Parameters
|
2021-05-30 02:57:04 +02:00
|
|
|
|
2022-02-14 03:22:51 +01:00
|
|
|
- `pattern`: the glob pattern to use
|
|
|
|
- `--all`: Show hidden files
|
|
|
|
- `--long`: List all available columns for each entry
|
|
|
|
- `--short-names`: Only print the file names and not the path
|
|
|
|
- `--full-paths`: display paths as absolute paths
|
|
|
|
- `--du`: Display the apparent directory size in place of the directory metadata size
|
2021-05-30 02:57:04 +02:00
|
|
|
|
2022-02-20 02:13:33 +01:00
|
|
|
## Examples
|
|
|
|
|
|
|
|
List all files in the current directory
|
|
|
|
```shell
|
|
|
|
> ls
|
|
|
|
```
|
|
|
|
|
|
|
|
List all files in a subdirectory
|
|
|
|
```shell
|
|
|
|
> ls subdir
|
|
|
|
```
|
|
|
|
|
|
|
|
List all rust files
|
|
|
|
```shell
|
|
|
|
> ls *.rs
|
|
|
|
```
|