# How to delete files in Linux

In [Linux](https://www.ionos.com/digitalguide/server/know-how/linux-the-cost-effective-alternative-to-windows/ "Linux – the cost-effective alternative to Windows"), you can easily **delete single files, groups of files, or entire folders**. However, this works differently in Linux than in Windows. Keep reading to find out about different methods for removing files in Linux.

## Deleting files in Linux with a file manager

Depending on the distribution and desktop environment you’re using, you’ll have Nautilus, Dolphin or another Linux [file manager](https://www.ionos.com/digitalguide/server/tools/alternative-file-managers-for-windows-linux-and-mac/ "Alternative file managers for Windows, Linux, and Mac") on your computer. Using these standard file managers, you can **remove Linux files in just a few simple steps**.

1. Navigate in the file manager to the files that you want to delete.
2. Hold down the left mouse button and select the files that you want to delete.

[![Image: Select the files that you want to delete in the file manager](https://www.ionos.com/digitalguide/fileadmin/_processed_/8/3/csm_Deleting-files-in-Linux-1_5c1b689c31.webp "Select the files that you want to delete in the file manager")](https://www.ionos.com/digitalguide/fileadmin/DigitalGuide/Screenshots_2021/Deleting-files-in-Linux-1.png) You can select multiple files by holding down the left mouse button.       3\. Right-click on one of the files to open the context menu. Depending on the distribution you’re using, you’ll find a menu item such as “**Move to Trash**” or “**Delete File**”.

[![Image: Right click on the files to view the menu](https://www.ionos.com/digitalguide/fileadmin/_processed_/a/5/csm_Deleting-files-in-Linux-2_ab2d34eaa6.webp "Right click on the files to view the menu")](https://www.ionos.com/digitalguide/fileadmin/DigitalGuide/Screenshots_2021/Deleting-files-in-Linux-2.png) Select “Move to trash” from the menu.       ---

### Tip

Instead of right-clicking, you can simply press \[Del\] to remove the selected files.

---

## Deleting files in Linux with the terminal

Considering the large array of [commands available in the terminal](https://www.ionos.com/digitalguide/server/configuration/linux-commands-an-overview-of-terminal-commands/ "Linux commands: An overview of terminal commands"), it’s no surprise that you can use the command line to delete files in Linux. To do so, complete the following steps:

1. Open the file manager and navigate to the files that you want to delete. Alternatively, you can use the command “**cd/path/to/the/file**” to go directly to the files in the terminal.
2. Right-click on the window to open the context menu, and then click on “**Open in Terminal**”.

[![Image: The context menu for using the file manager to open files in the terminal](https://www.ionos.com/digitalguide/fileadmin/_processed_/c/4/csm_Deleting-files-in-Linux-3_6ea357ee59.webp "The context menu for using the file manager to open files in the terminal")](https://www.ionos.com/digitalguide/fileadmin/DigitalGuide/Screenshots_2021/Deleting-files-in-Linux-3.png) You can use the file manager to open files in the terminal.       3\. Use the **command “rm”** (short for “remove”) to delete a single file or multiple files.

## A closer look at the “rm” command

Depending on whether you want to delete a single file, multiple files, or all of the files of a certain file type, the “rm” command will look slightly different.

### Deleting a single file

You can quickly and easily delete a single file with the command “rm” followed by the file name.

```none
rm DeleteMe.odt
```

[![Image: The command for deleting single files in the terminal](https://www.ionos.com/digitalguide/fileadmin/_processed_/3/a/csm_Deleting-files-in-Linux-4_b3084a511f.webp "The command for deleting single files in the terminal")](https://www.ionos.com/digitalguide/fileadmin/DigitalGuide/Screenshots_2021/Deleting-files-in-Linux-4.png) With the command “rm” followed by a file name, you can easily delete single files in Linux.       ###  Deleting multiple files

To delete multiple files at once, simply **list all of the file names** after the “rm” command. File names should be separated by a space.

```none
rm DeleteMe.odt DeleteMe2.odt
```

[![Image: The command for deleting multiple files in the terminal](https://www.ionos.com/digitalguide/fileadmin/_processed_/9/8/csm_Deleting-files-in-Linux-5_42ffe47c88.webp "The command for deleting multiple files in the terminal")](https://www.ionos.com/digitalguide/fileadmin/DigitalGuide/Screenshots_2021/Deleting-files-in-Linux-5.png) With the command “rm” followed by multiple file names, you can delete multiple files at once.       ###  Deleting files with a specific file name

You can also **remove all Linux files with a certain file name** in the terminal.

```none
rm *Delete*
```

[![Image: The command for deleting all files with a certain file name](https://www.ionos.com/digitalguide/fileadmin/_processed_/3/0/csm_Deleting-files-in-Linux-6_5f51b9669a.webp "The command for deleting all files with a certain file name")](https://www.ionos.com/digitalguide/fileadmin/DigitalGuide/Screenshots_2021/Deleting-files-in-Linux-6.png) This command deletes all files that contain the name written between the asterisks.       ###  Deleting files of a certain file type

If you have a folder that contains different file types and want to **delete all the files of a certain type** - for example, .*pdf* or .*odt* - simply enter the command “rm” followed by an asterisk and the file type.

```none
rm *.odt
```

In this case, you’ll delete all files with the ending .*odt*.

[![Image: Deleting a certain file type using the terminal](https://www.ionos.com/digitalguide/fileadmin/_processed_/0/6/csm_Deleting-files-in-Linux-7_4049c4c5a2.webp "Deleting a certain file type using the terminal")](https://www.ionos.com/digitalguide/fileadmin/DigitalGuide/Screenshots_2021/Deleting-files-in-Linux-7.png) Enter an asterisk followed by a file ending to delete all files of this type.       ##  Deleting all the files in a folder

If you want to **delete all of the files and subfolders** of a certain folder, enter the following command into the terminal:

```none
rm -r Files/*
```

In this case, all of the files in the folder “Files” will be deleted. The folder itself will remain. Of course it’s also possible to delete a Linux directory, including all the files it contains.

[![Image: Command for deleting all the files and subfolders in a specific folder](https://www.ionos.com/digitalguide/fileadmin/_processed_/a/9/csm_Deleting-files-in-Linux-8_bfdeb2bd78.webp "Command for deleting all the files and subfolders in a specific folder")](https://www.ionos.com/digitalguide/fileadmin/DigitalGuide/Screenshots_2021/Deleting-files-in-Linux-8.png) This command will delete all the subfolders and files in a specific folder.       ---

### Tip

Your files are taking up too much space, but you still don’t want to delete them? It’s very easy to [archive and compress files in Linux](https://www.ionos.com/digitalguide/server/tools/archiving-and-compression-using-linux/ "Archiving and Compression Using Linux")!

---


This is a markdown version of: [https://www.ionos.com/digitalguide/server/configuration/deleting-files-in-linux/](https://www.ionos.com/digitalguide/server/configuration/deleting-files-in-linux/) for AI/LLM consumption.