ls for filesystem
List the filenames, sizes, and modification times of items in a directory.
Signature
> ls {flags} ...rest
Flags
-
--all, -a: Show hidden files. -
--long, -l: Get all available columns for each entry (slower; columns are platform-dependent). -
--short-names, -s: Only print the file names, and not the path. -
--full-paths, -f: Display paths as absolute paths. -
--du, -d: Display the apparent directory size ("disk usage") in place of the directory metadata size. -
--directory, -D: List the specified directory itself instead of its contents. -
--mime-type, -m: Show mime-type in type column instead of 'file' (based on filenames only; files' contents are not examined). -
--threads, -t: Use multiple threads to list contents. Output will be non-deterministic.
Parameters
-
...rest: The glob pattern to use.
Input/output types:
| input | output |
|---|---|
| nothing | table |
Examples
List visible files in the current directory.
> ls
List visible files in a subdirectory.
> ls subdir
List visible files with full path in the parent directory.
> ls -f ..
List Rust files.
> ls *.rs
List files and directories whose name do not contain 'bar'.
> ls | where name !~ bar
List the full path of all dirs in your home directory.
> ls -a ~ | where type == dir
List only the names (not paths) of all dirs in your home directory which have not been modified in 7 days.
> ls -as ~ | where type == dir and modified < ((date now) - 7day)
Recursively list all files and subdirectories under the current directory using a glob pattern.
> ls -a **/*
Recursively list *.rs and *.toml files using the glob command.
> ls ...(glob **/*.{rs,toml})List given paths and show directories themselves.
> ['/path/to/directory' '/path/to/file'] | each {|| ls -D $in } | flatten
Copyright © 2019–2026 The Nushell Project DevelopersLicensed under the MIT License.
https://www.nushell.sh/commands/docs/ls.html