From the course: Linux CentOS 7: Files and Permissions
Unlock the full course today
Join today to access over 22,600 courses taught by industry experts or purchase this course individually.
Move and rename files and dirs - Linux Tutorial
From the course: Linux CentOS 7: Files and Permissions
Move and rename files and dirs
- [Instructor] When Linux copies a file it copies the file data blocks to a new location on the disk. When moving a file between file systems, Linux copies the data blocks to the new location and then deletes the original data blocks. If, however, the source and destination are on the same file system, Linux treats the file differently. If we have a file at /home/bob/file1.txt and we want to move it to /home/ted we'd use the move command, or mv command. Since both of these locations are on the same hard drive, Linux just updates the file's location in the file system. This is very fast because no data is actually being moved on the disk. We can also move a file from a directory to the same directory as long as we specify a different name. If we move /home/ted/file1.txt to /home/ted/file2.txt it effectively renames it. This is why we use the mv command to rename files in Linux. The syntax for move is mv which is the command name and then the options. The options can take the form of…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.