From the course: Cert Prep: LPIC-1 Exam 101 (Version 5.0)

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

Move and rename files and dirs - Linux Tutorial

From the course: Cert Prep: LPIC-1 Exam 101 (Version 5.0)

Start my 1-month free trial

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…

Contents