Close Menu
Pineapples Update –Pineapples Update –

    Subscribe to Updates

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

    What's Hot

    The Ranch at Rock Creek’s brilliant 5-star business strategy

    December 4, 2025

    Your favorite AI tool just barely missed this security review – why that’s a problem

    December 4, 2025

    I saw drone delivery launch in Atlanta – how they work and which cities are next

    December 4, 2025
    Facebook X (Twitter) Instagram
    Facebook X (Twitter) Instagram Pinterest Vimeo
    Pineapples Update –Pineapples Update –
    • Home
    • Gaming
    • Gadgets
    • Startups
    • Security
    • How-To
    • AI/ML
    • Apps
    • Web3
    Pineapples Update –Pineapples Update –
    Home»Startups»Two ways to delete a directory in Linux – plus a bonus method for added security
    Startups

    Two ways to delete a directory in Linux – plus a bonus method for added security

    PineapplesUpdateBy PineapplesUpdateNovember 13, 2025No Comments4 Mins Read
    Share Facebook Twitter Pinterest LinkedIn Tumblr Reddit Telegram Email
    Two ways to delete a directory in Linux – plus a bonus method for added security
    Share
    Facebook Twitter LinkedIn Pinterest Email

    Two ways to delete a directory in Linux – plus a bonus method for added security

    Jack Wallen/Elyse Batters Picaro/ZDNET

    Follow ZDNET: Add us as a favorite source On Google.


    Linux makes it quite simple to interact with your PC and your apps. Anything you can do on proprietary operating systems like Windows and macOS, you can do with open-source OSes, ranging from simple to complex.

    However, often the simplest tasks can be a little confusing, especially when you are new to something. For example, 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 done 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 offers a more secure way to delete a directory.

    Method 1: From File Manager

    what you’ll need: All you need for this is a desktop Linux distribution and a directory to delete. I will demonstrate this on Pop!_OS with the COSMIC desktop, but the process will be the same regardless of Linux distro or desktop environment.

    I recommend creating a test directory to avoid accidentally deleting the wrong directory. To create a new directory within the file manager, right-click on any empty space in the directory and click New Folder. If you are using KDE Plasma, you will need to right-click on an empty space in the file manager and then click New > Create 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

    Right-click the folder menu.

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

    Screenshot by Jack Wallen/ZDNET

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

    Also: My Top 5 Password Managers for Linux – And My Favorites Work on Windows and macOS Too

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

    Method 2: From command line

    Deleting a directory from the command line is a little tricky, 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 to correct directory

    Next, go to the location where the directory to be deleted is located. For example, let’s say the directory to be deleted is located in /home/jack/Documents. To change to that directory, issue the command:

    cd ~/documents

    ~/ is shorthand for your home directory.

    Note: you don’t do this to pass To change the location of the directory to be deleted. If you don’t do this, you must use the full path to the directory you want to delete.

    delete directory

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

    rm-rf test

    If you just use the command rm TESTING, it will fail because you are deleting a directory. -RF options are:

    • R – Recursively – Deletes all files/folders within a directory and then deletes the directory itself.
    • F – forces deletion.

    You do not need to use the f option. For whatever reason, I automatically use it.

    You can also use the interactive mode, which will:

    rm-ri test

    When deleting in interactive mode, you will be asked to OK at each step.

    bonus method

    For some people, using one of the above methods is not enough, especially if a directory contains files containing sensitive information that needs to be deleted.

    Also: 5 Obscure Linux Distros You’ve Probably Never Heard Of – But Should Definitely Try

    If this is the case, you will 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 above methods.

    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 delete the file after overwriting.
    • -z – Add a final overwrite with zeros to obscure shredding.
    • -n x – (where x is a number above 3) indicates how many iterations are used for overwriting. Default is 3.

    After you’ve fragmented all the files you have, delete the directory from your file manager or with the rm command.

    added bonus delete directory Linux method Security ways
    Share. Facebook Twitter Pinterest LinkedIn Tumblr Email
    Previous ArticleThey turned $1k into a $100k monthly side hustle, 8-figure business
    Next Article I’m a Photoshop fanatic, but Canva’s free tools won me over — and saved me money
    PineapplesUpdate
    • Website

    Related Posts

    Startups

    The Ranch at Rock Creek’s brilliant 5-star business strategy

    December 4, 2025
    Startups

    Your favorite AI tool just barely missed this security review – why that’s a problem

    December 4, 2025
    Startups

    I saw drone delivery launch in Atlanta – how they work and which cities are next

    December 4, 2025
    Add A Comment
    Leave A Reply Cancel Reply

    Top Posts

    Microsoft’s new text editor is a VIM and Nano option

    May 19, 2025797 Views

    The best luxury car for buyers for the first time in 2025

    May 19, 2025724 Views

    Massives Datenleck in Cloud-Spichenn | CSO online

    May 19, 2025650 Views
    Stay In Touch
    • Facebook
    • YouTube
    • TikTok
    • WhatsApp
    • Twitter
    • Instagram
    Latest Reviews

    Subscribe to Updates

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

    Most Popular

    10,000 steps or Japanese walk? We ask experts if you should walk ahead or fast

    June 16, 20250 Views

    FIFA Club World Cup Soccer: Stream Palmirus vs. Porto lives from anywhere

    June 16, 20250 Views

    What do chatbott is careful about punctuation? I tested it with chat, Gemini and Cloud

    June 16, 20250 Views
    Our Picks

    The Ranch at Rock Creek’s brilliant 5-star business strategy

    December 4, 2025

    Your favorite AI tool just barely missed this security review – why that’s a problem

    December 4, 2025

    I saw drone delivery launch in Atlanta – how they work and which cities are next

    December 4, 2025

    Subscribe to Updates

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

    Facebook X (Twitter) Instagram Pinterest
    • About Us
    • Contact Us
    • Privacy Policy
    • Terms And Conditions
    • Disclaimer
    © 2025 PineapplesUpdate. Designed by Pro.

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