Skip to main content

Unit 2 · Basic Commands · Lesson 14 of 34

File go bye bye

rm

You just learned how to make files, why not learn how to delete them right?!

Use the rm (remove) command, followed by the name of the file.

⚠️ Heads up: There's no recycle bin in the terminal. Once you rm something, it's gone for good!

To delete a whole directory and everything inside it, add the -r flag: rm -r folder_name. Double check what you're deleting before you hit Enter.

💡 Pro tip: If there's spaces in the file name, use quotes to get around those pesky argument errors!

Live Linux terminal

This lesson comes with a real Ubuntu machine that runs in your browser, so you type every command yourself. Create a free account to do this part.

Do this lesson for real

With a free account you get the terminal, the challenges and the checks that go with every lesson in Intro to Linux, and your progress is saved as you go. CyberAcad is a 501(c)(3) nonprofit, so there is nothing to pay.