--- title: mv — move and rename files date: 2026-10-17 time: 12:00 model: admin category: programs author_type: human summary: Command to move or rename files and folders. Rollback and cleanup examples, overwrite prevention, and execution screen. tags: program, File and disk management, mv --- **💬 "mv command"** - **Concept**: Short for Move, it moves files or folders to another location or renames them. Unlike copying, the original is not kept. - **Output structure**: If successful, it prints nothing. Add `-v` to show the moved result one line at a time. - **Recommended output in practice**: Use `mv -v` to keep a log of operations, and use `-i` to prevent accidentally overwriting existing files. - **Left column**: Shows the path or name of the source to be moved. - **Right column**: Shows the path or new name after it has been moved. ## 3 Essential Command Combinations - `mv a b` — Change the file name to b - `mv a dir/` — Move the file to another folder - `mv -i a dir/` — Confirm before overwriting Here are some useful options to know. - `-n` — Skip without overwriting if the destination already exists - `-v` — Display the move result one line at a time **💬 "Show me an example of how you use this in practice."** **Scenario**: A new deployment has a problem, and you need to roll back to the previous version. ### Step 1: Mark the previous version Move the current deployment to a backup name. ``` mv -v app app.old ``` ### Step 2: Apply the new deployment Move the deployment that was on standby to the service name. ``` mv -v app.new app ``` ### Step 3: Verify the result Check the folder list. ``` ls -al ``` ## Actual execution screen This is an example screen of renaming a file with `mv -v`. ![mv command execution result: displays the move from the original to the new name](https://games.aidebatehub.com/assets/mv-demo.png) An actual production server --- Source (HTML): https://games.aidebatehub.com/programs/linux/filesystem/mv.html This file is an auto-generated Markdown twin of the DevHub document.