Close Menu
Must Have Gadgets –

    Subscribe to Updates

    Get the latest creative news from FooBar about art, design and business.

    What's Hot

    Willow’s voice keyboard lets you type across all your iOS apps — and actually edit what you said

    November 13, 2025

    Mastering Client Outreach with Android Apps for Impactful Messaging

    November 13, 2025

    Our favorite 2025 advent calendars from Lego, Pokémon, Funko Pop, Magna-Tiles and more

    November 13, 2025
    Facebook X (Twitter) Instagram
    Must Have Gadgets –
    Trending
    • Willow’s voice keyboard lets you type across all your iOS apps — and actually edit what you said
    • Mastering Client Outreach with Android Apps for Impactful Messaging
    • Our favorite 2025 advent calendars from Lego, Pokémon, Funko Pop, Magna-Tiles and more
    • Samsung’s tri-fold foldable finally has a name, as more specs leak
    • iFIT Workouts Are Now Streamable in Samsung Health
    • We Love This 2K Indoor Camera, and It’s Down to Just $20 Ahead of Black Friday
    • Intuit reveals new AI agents in a bid to help SMBs across the world grow and prosper
    • Valve Revives Steam Machine With Mini PC Boasting 6x Power of Steam Deck
    • Home
    • Shop
      • Earbuds & Headphones
      • Smartwatches
      • Mobile Accessories
      • Smart Home Devices
      • Laptops & Tablets
    • Gadget Reviews
    • How-To Guides
    • Mobile Accessories
    • Smart Devices
    • More
      • Top Deals
      • Smart Home
      • Tech News
      • Trending Tech
    Facebook X (Twitter) Instagram
    Must Have Gadgets –
    Home»How-To Guides»Two ways to remove a directory in Linux – plus a bonus method for extra security
    How-To Guides

    Two ways to remove a directory in Linux – plus a bonus method for extra security

    adminBy adminNovember 13, 2025No Comments4 Mins Read
    Facebook Twitter Pinterest LinkedIn Tumblr Email
    Two ways to remove a directory in Linux – plus a bonus method for extra security
    Share
    Facebook Twitter LinkedIn Pinterest Email

    Jack Wallen / Elyse Betters Picaro / ZDNET

    Follow ZDNET: Add us as a preferred source on Google.

    Linux makes interacting with your PC and your apps quite straightforward. Anything you can do on proprietary operating systems like Windows and MacOS, you can do with the open-source OS, from the simple to the complicated.  

    Often, however, the simplest tasks can be a bit confusing, especially when you’re new to something. For instance, how do you delete a directory (aka “folder”) on Linux?

    Also: The first 8 Linux commands every new user should learn

    Sounds simple, right? It is! Just like on MacOS or Windows, deleting a directory on Linux can be handled by anyone, regardless of skill level.

    I’ll show you two easy ways to do this, and I’ll also include a bonus method that provides a more secure way to delete a directory.

    Method 1: From the file manager

    What you’ll need: The only things you’ll need for this are a desktop Linux distribution and a directory to delete. I’ll demonstrate this on Pop!_OS with the COSMIC desktop, but the process will be similar, regardless of Linux distro or desktop environment.

    I recommend creating a test directory to avoid accidentally removing the wrong one. To create a new directory within the file manager, right-click on any blank spot in a directory and click New Folder. If you’re using KDE Plasma, you’d right-click a blank spot in the file manager and then click Create New > Folder.

    Let’s delete the test directory you just created. Open your file manager and locate that directory.

    Show more

    Right-click the directory to be deleted and then click Move To Trash. If you don’t see an entry for Move To Trash, you should see a Delete entry. 

    Show more

    Deleting a file from within the Pop!_OS COSMIC file manager.

    Screenshot by Jack Wallen/ZDNET

    This process works for both empty directories and directories that house files/folders. 

    Also: My top 5 password managers for Linux – and my favorite works on Windows and MacOS too

    You can then empty your trash so the file is permanently deleted.

    Method 2: From the command line

    Deleting a directory from the command line is a bit trickier, but not overly difficult. This is done with the rm command.

    Open your terminal app

    The first step is to open your terminal app.

    Change into the correct directory

    Next, change into the location that houses the directory to be deleted. For instance, say the directory to be deleted is located in /home/jack/Documents. To change into that directory, issue the command:

    cd ~/Documents

    The ~/ is shorthand for your home directory.

    Note: You don’t have to change into the location housing the directory to be removed. If you don’t, you’ll just need to use the full path to the directory to be deleted.

    Delete the directory

    Let’s say the directory to be deleted is named TESTING. To delete that directory, regardless of whether it’s empty or contains files/folders, you would delete it with the command:

    rm -rf TESTING

    If you were to use only the command rm TESTING, it would fail because you’re deleting a directory. The -rf options are:

    • r – recursive – deletes all files/folders within the directory and then deletes the directory itself.
    • f – forces the deletion.

    You don’t have to use the f option. For whatever reason, I just automatically use it.

    You could also use the interactive mode, which would be:

    rm -ri TESTING

    When deleting in interactive mode, you will be prompted to OK every step.

    Bonus method 

    For some, using one of the above methods isn’t enough, especially if a directory contains files with sensitive information that need to be deleted.

    Also: 5 obscure Linux distros you’ve probably never heard of – but should definitely try

    If that’s the case, you’ll want to use the shred command to overwrite the internal files/folders with 1s and 0s and then delete the directory with one of the methods above.

    The shred command works like this:

    shred -u -z -n 3 FILE

    Where FILE is the name of the file to be deleted.

    The above options are as follows:

    • -u – Deallocate and remove the file after overwriting.
    • -z – Add a final overwrite with zeros to obfuscate the shredding.
    • -n X – (where X is a number above 3) indicates how many iterations are used for the overwriting. The default is 3.

    After you’ve shredded all of the containing files, delete the directory with your file manager or the rm command.

    bonus directory extra Linux method remove security Ways
    Share. Facebook Twitter Pinterest LinkedIn Tumblr Email
    admin
    • Website

    Related Posts

    iFIT Workouts Are Now Streamable in Samsung Health

    November 13, 2025

    How to stay cozy and sleep better this fall, without turning the heat on

    November 13, 2025

    Does your chatbot have ‘brain rot’? 4 ways to tell

    November 13, 2025
    Leave A Reply Cancel Reply

    Top Posts

    Willow’s voice keyboard lets you type across all your iOS apps — and actually edit what you said

    November 13, 2025

    PayPal’s blockchain partner accidentally minted $300 trillion in stablecoins

    October 16, 2025

    The best AirPods deals for October 2025

    October 16, 2025
    Stay In Touch
    • Facebook
    • YouTube
    • TikTok
    • WhatsApp
    • Twitter
    • Instagram
    Latest Reviews
    How-To Guides

    How to Disable Some or All AI Features on your Samsung Galaxy Phone

    By adminOctober 16, 20250
    Gadget Reviews

    PayPal’s blockchain partner accidentally minted $300 trillion in stablecoins

    By adminOctober 16, 20250
    Smart Devices

    The best AirPods deals for October 2025

    By adminOctober 16, 20250

    Subscribe to Updates

    Get the latest tech news from FooBar about tech, design and biz.

    Latest Post

    Willow’s voice keyboard lets you type across all your iOS apps — and actually edit what you said

    November 13, 2025

    Mastering Client Outreach with Android Apps for Impactful Messaging

    November 13, 2025

    Our favorite 2025 advent calendars from Lego, Pokémon, Funko Pop, Magna-Tiles and more

    November 13, 2025
    Recent Posts
    • Willow’s voice keyboard lets you type across all your iOS apps — and actually edit what you said
    • Mastering Client Outreach with Android Apps for Impactful Messaging
    • Our favorite 2025 advent calendars from Lego, Pokémon, Funko Pop, Magna-Tiles and more
    • Samsung’s tri-fold foldable finally has a name, as more specs leak
    • iFIT Workouts Are Now Streamable in Samsung Health

    Subscribe to Updates

    Get the latest creative news from FooBar about art, design and business.

    Facebook
    • About Us
    • Contact Us
    • Privacy Policy
    • Terms and Conditions
    • Disclaimer
    © 2025 must-have-gadgets.

    Type above and press Enter to search. Press Esc to cancel.