mv
Files
SKILL.mdagentsreferences
Install
Install only this skill with npx skills
npx skills add alisonaquinas/llm-shared-skills --skill 'mv' -g -y
Install the containing skill bundle
/plugin install shared-skills@llm-skills
This skill is bundled inside shared-skills. Use
npx skills when you only want this skill, or install the bundle once to make every included skill available through the plugin marketplace flow. Browse the full skill bundle repository at github.com/alisonaquinas/llm-shared-skills.Invoke
Invoke this skill after installation
/shared-skills:mv
SKILL.md
name: mv description: > Move or rename files and directories with mv. Use when the agent needs to rename a file or directory in place, relocate files to a different directory, reorganise a directory tree, or safely replace a destination file with an atomic move on the same filesystem.
mv
Move or rename files and directories, with control over overwrite behaviour and backup creation.
Quick Start
- Verify availability:
mv --version(GNU) orman mv - Rename a file:
mv old-name.txt new-name.txt - Move to a directory:
mv file.txt /target/dir/
Intent Router
references/cheatsheet.md— Rename, move single and multiple files, overwrite control, verbose modereferences/advanced-usage.md— Atomic replacement, backup suffixes, cross-filesystem behaviour, moving directory treesreferences/troubleshooting.md— Cross-filesystem errors, permission denied, destination-exists edge cases
Core Workflow
- Confirm source path and destination before running —
mvis not undoable without a backup - Use
-i(interactive) to prompt before overwriting, or-nto refuse to overwrite - Use
-vto confirm each move in batch operations - For cross-filesystem moves, be aware that
mvfalls back to a copy-then-delete internally - Verify result with
ls -lon the destination
Quick Command Reference
mv old.txt new.txt # Rename a file in place
mv file.txt /target/dir/ # Move file to directory
mv file.txt /target/dir/new.txt # Move and rename in one step
mv -i source.txt dest.txt # Prompt before overwriting
mv -n source.txt dest.txt # Never overwrite an existing destination
mv -v *.log /archive/ # Verbose: print each file moved
mv -b source.txt dest.txt # Back up destination before overwriting
mv --backup=numbered src dest # Numbered backups (GNU)
mv dir/ /new/parent/ # Move entire directory
man mv # Full manual
Safety Notes
| Area | Guardrail |
|---|---|
| Irreversible by default | Unlike cp, mv removes the source. There is no built-in undo. Verify destination before running, especially in scripts. |
| Silent overwrite | mv overwrites the destination without warning by default. Use -i interactively or -n in scripts to prevent accidental data loss. |
| Cross-filesystem | When source and destination are on different filesystems, mv performs a copy-then-delete. If interrupted, data can be left in both or neither location. Use rsync with --remove-source-files for safer cross-filesystem moves. |
| Directory trailing slash | mv src dest where dest is an existing directory moves src inside dest. Omit the trailing slash or check with test -d dest to confirm intent. |
| Root-owned files | Moving files you do not own requires elevated privileges. Prefer sudo mv only after confirming the operation. |
Source Policy
- Treat
man mvandmv --helpas runtime truth. GNU and BSDmvdiffer slightly. - For large or cross-filesystem moves where atomicity matters, use
rsync --remove-source-files. - In scripts, check exit code and destination before deleting any backup.
See Also
$cpfor copying without removing the source$rsyncfor resumable, cross-filesystem, or verified moves$lnfor aliasing instead of relocating