Learn
Manipulation
rm

The rm command deletes files and directories. Here we remove the file unwanted_file.txt from the filesystem.

rm unwanted_file.txt

The -r is an option that modifies the behavior of the rm command. The -r stands for “recursive,” and it’s used to delete a directory and all of its child directories.

rm -r unwanted_directory

Be careful when you use rm! It deletes files and directories permanently. There isn’t an undelete command, so once you delete a file or directory with rm, it’s gone.

Instructions

1.

From our current working directory movies/, and with a single command, change directory to comedy/slapstick.

Then, list all files and directories in the working directory.

2.

Inside the current directory, remove waterboy.txt.

3.

List all files and directories in the working directory. You should see that waterboy.txt has been removed.

4.

Navigate up one directory from comedy/slapstick/ to comedy/.

5.

Remove the slapstick/ directory using rm.

6.

List all files and directories in the working directory. You should see that the slapstick/ directory has been removed.

Folder Icon

Sign up to start coding

Already have an account?