Categories
Linux Tutorial Series

Linux Tutorial Series – 35 – The mv command

Here is the video version, if you prefer it:

The mv command is used to move or rename files or directories, depending on its usage. (Shotts, 2019)⁠ To rename or move files or directories, use it like this:

mv oldFileName newFileName

If you want to move one or more files from the source directory to the destination directory, use:

mv file1 file2 … desination

A couple of remarks: Use the -i option to prevent the mv command from silently overwriting files (files are overwritten when they have the same name in both the source and the destination) and use the -u option only move files that either don’t exist or are newer than the corresponding files in the destination directory.

Hope you learned something useful!

References

Shotts, W. (2019). The Linux Command Line, Fifth Internet Edition. Retrieved from http://linuxcommand.org/tlcl.php. Pages 54-55