Skip to content
shellmap

mvMove or rename files and directories across all 5 shells

Equivalents in every shell

Bashunix
mv source dest
Zshunix
mv source dest
Fishunix
mv source dest
PowerShellwindows
Move-Item source dest

Aliased as `mv`, `move`, `mi`.

cmd.exewindows
move source dest

Or `ren oldname newname` for in-place rename.

Worked examples

Rename a file

Bash
mv old.txt new.txt
PowerShell
Rename-Item old.txt new.txt
cmd.exe
ren old.txt new.txt

Move multiple files into a directory

Bash
mv *.log logs/
PowerShell
Move-Item *.log logs/
cmd.exe
move *.log logs\

Move without overwriting existing files

Bash
mv -n source dest
PowerShell
Move-Item source dest -ErrorAction Stop

Gotchas

  • On Unix, `mv` across filesystems copies + deletes; on the same fs it is an atomic rename.
  • cmd `move` cannot rename and move simultaneously across drives; use `move` then `ren`.
  • PowerShell `Move-Item` with wildcards requires the destination to be a directory.

WSL & PowerShell Core notes

pwshThe `mv` alias for `Move-Item` is removed in PowerShell Core on Linux/macOS — `/bin/mv` resolves first. Windows pwsh keeps the alias. Cross-platform scripts should call `Move-Item` directly.
WSLRenaming inside `/mnt/c/...` writes through DrvFs and is not atomic relative to other Windows processes; an Explorer file handle on the target will block the rename with EBUSY. For atomic renames stay on the Linux side, then `cp` the final file to `/mnt/c`.

Common tasks using mv

Related commands