Which UNIX command is used to remove a file?

Which UNIX command is used to remove a file?

a) rm
b) mv
c) delete
d) erase

Answer:

a) rm

Explanation:

The rm command is used to remove files in UNIX. When you use rm filename, it deletes the specified file from the directory. If you want to remove directories along with files, you can use rm -r (recursive delete) to remove directories and their contents.

Deleting files in UNIX is permanent, meaning the file is gone once you run the rm command unless you have backups. This makes it a powerful command, but it should be used with caution, especially when dealing with important files or directories.

Learning to use rm properly is crucial for UNIX users. It’s also useful to explore additional options like rm -f for forced deletion or rm -i to prompt for confirmation before deleting each file.

Reference:

Top 50 Unix MCQ Questions & Answers

Scroll to Top