Get all your news in one place.
100's of premium titles.
One app.
Start reading
Tom’s Hardware
Tom’s Hardware
Technology
Jo Hinchliffe

How To Delete Files and Directories via the Linux Terminal

Files and directories in a trashcan.

Deleting directories and files is one of the most basic, but important functions in any operating system. In Linux, if you have a windowed environment running, you can locate and delete files using a file manager application. Perhaps you’re logging in remotely via SSH, your Linux computer doesn’t have a GUI installed or you want to have more control over what you’re deleting. As with anything in Linux, there are many reasons why it might be necessary or preferable to delete directories or files via the command line.

In this how-to, we’ll look at the rm command which removes directories and files. We’ll look at the basics of the command and how it can be used to remove both files and directories and we’ll also look at a few other enhancements to get the most out of this command. If you want to change your file’s location instead, you should check out our article on how to move and rename files in Linux.

Sign up to read this article
Read news from 100's of titles, curated specifically for you.
Already a member? Sign in here
Related Stories
Top stories on inkl right now
One subscription that gives you access to news from hundreds of sites
Already a member? Sign in here
Our Picks
Fourteen days free
Download the app
One app. One membership.
100+ trusted global sources.