What does the 'mv' command do?

The mv command in Linux is used to move files and directories from one location to another. It can also be used to rename files and directories.

Key Functions:

  1. Moving Files: You can move a file from one directory to another.

    mv source_file.txt /path/to/destination/
  2. Renaming Files: You can rename a file by specifying a new name in the same directory.

    mv oldname.txt newname.txt
  3. Moving Directories: The command can also move entire directories.

    mv directory_name /path/to/destination/

Important Options:

  • -i: Interactive mode, prompts before overwriting.
  • -f: Force move, overwrites without prompting.
  • -u: Update, moves only if the source is newer than the destination.

Overall, the mv command is a versatile tool for file and directory management in Linux.

0 Comments

no data
Be the first to share your comment!