Skip to content
shellmap

lsList directory contents across all 5 shells

Equivalents in every shell

Bashunix
ls -la
Zshunix
ls -la

Identical to bash. Zsh adds `**` recursive glob if you prefer `print -l **/*`.

Fishunix
ls -la

Same external `ls` binary. Fish ships no built-in `ls` of its own.

PowerShellwindows
Get-ChildItem -Force

Aliased as `ls`, `gci`, and `dir` inside PowerShell.

cmd.exewindows
dir /a

`/a` includes hidden + system files. There is no native `ls`.

Worked examples

List all files including hidden

Bash
ls -la
Fish
ls -la
PowerShell
Get-ChildItem -Force
cmd.exe
dir /a

List only directories

Bash
ls -d */
PowerShell
Get-ChildItem -Directory
cmd.exe
dir /ad

List sorted by modification time, newest first

Bash
ls -lt
PowerShell
Get-ChildItem | Sort-Object LastWriteTime -Descending
cmd.exe
dir /o-d

Gotchas

  • PowerShell `ls` is an alias for `Get-ChildItem`, not the Unix binary — flags like `-la` will error.
  • cmd `dir` formats output in column blocks; pipe through `more` to page on long listings.
  • On Windows, `ls.exe` from Git Bash or WSL behaves like Unix `ls`; native cmd/PowerShell do not.

WSL & PowerShell Core notes

pwshOn Linux/macOS PowerShell Core (`pwsh`), the `ls` alias for `Get-ChildItem` is removed so the system `/bin/ls` resolves first. On Windows pwsh, the alias still wins — use `Get-ChildItem` (or `gci`) in scripts you intend to run on both platforms.
WSLListing `/mnt/c/...` walks NTFS through the DrvFs adapter, which is roughly 10× slower than listing native `~`. Permissions also display as `0777` on NTFS mounts unless `metadata` is enabled under `[automount]` in `/etc/wsl.conf`.

Common tasks using ls

Related commands