Moving and Renaming Files and Directories

Moving and renaming files and directories, like file navigation and copying, is a basic skill you'll need when organizing information within Linux. The following sections demonstrate how to use the mv command to move and rename files and directories.

Moving and Renaming Files and Directories with the mv Command

The mv (move) command is used to move or rename files and directories. To rename a file or directory, specify the old filename and the new filename on the command line (unlike the cp command, mv does not leave a copy of the original file or directory):

$ mv error.log error.log.oct99

Use the mv command with caution. You can easily overwrite existing files unless you use the -i (interactive) command-line ...

Get Practical Linux now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.