O'Reilly logo

Practical Linux by Bill Ball, John Ray, Michael Turner, M. Drew Streib

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required