Linux Commands Helper

💬 Your AI-powered Linux assistant

mv Command - Move or Rename Files

The mv command is used to move files or directories, or rename files or directories.

Syntax

mv [options] source target

Common Options

  • -i: Interactive mode. Prompt before overwriting.
  • -f: Force move without prompting.
  • -u: Move only when the source is newer or the target does not exist.
  • -v: Verbose mode. Show details of the move.

Examples

mv file1.txt /home/user/docs/

Move file1.txt to the /home/user/docs/ directory.

mv oldname.txt newname.txt

Rename oldname.txt to newname.txt.

mv -i file1.txt /home/user/docs/

Move file1.txt to /home/user/docs/ and prompt if the target exists.

Notes

  • The mv command does not modify file content, only the location or name.
  • If the source and target are on the same filesystem, only the directory entry changes (very efficient).
  • If moving across filesystems, mv copies and then deletes the source.

© 2025 Linux Commands Helper. All rights reserved.

This project is under construction. Feedback and contributions are welcome.

Fazier badgeFeatured on Startup Fame