What are the different purposes of the `mv` command?

The mv command in Linux is primarily used for two purposes:

  1. Moving Files and Directories: You can use mv to move files or directories from one location to another. For example:

    mv /path/to/source/file.txt /path/to/destination/
  2. Renaming Files and Directories: The mv command can also rename files or directories. For example:

    mv old_filename.txt new_filename.txt

Additional Options

  • Overwrite Confirmation: Use the -i option to prompt before overwriting files:

    mv -i file.txt /path/to/destination/
  • Verbose Output: Use the -v option to see what is being moved or renamed:

    mv -v file.txt /path/to/destination/

These functionalities make mv a versatile command for file management in Linux.

0 Comments

no data
Be the first to share your comment!