Which command is used to move files in UNIX?

Which command is used to move files in UNIX?

a) cp
b) mv
c) rm
d) move

Answer:

b) mv

Explanation:

The mv command in UNIX is used to move files or directories from one location to another. It can also be used to rename files. For example, mv file1 /path/to/destination will move file1 to the specified directory.

Unlike the cp command, which copies files, mv physically moves the file to the new location. The original file no longer exists in the source directory after the move is completed. This makes it useful for organizing and restructuring directories.

Understanding how to use the mv command is important for file management. You can also use it for renaming files: mv oldname newname. This flexibility makes it a fundamental command for managing file systems.

Reference:

Top 50 Unix MCQ Questions & Answers

Scroll to Top