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:
-
Moving Files: You can move a file from one directory to another.
mv source_file.txt /path/to/destination/ -
Renaming Files: You can rename a file by specifying a new name in the same directory.
mv oldname.txt newname.txt -
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.
