+3 votes
91 views
in Linux by (242k points)
reopened
Linux file delete - here's how

1 Answer

+4 votes
by (1.6m points)
 
Best answer

Deleting files in the file manager
1st step:
2nd step:
Delete files via console command
1st step
2nd step
Deleting folders via console command
1st step:
2nd step
More examples for the rm command

Deleting files is just as easy on Linux as it is on Windows. We'll show you how to do it and what to look out for..

image image

Of course, you can not only create files with the common Linux distributions, but also delete them again. As with Windows, there is the option of using the file manager or the command line.

Deleting files in the file manager

1st step:

image
Select the files to be deleted with the left mouse button pressed .

2nd step:

image
Call up the context menu by right-clicking on one of the files . Select the entry " Move to the trash ". Alternatively, you can also press the [Del] key. If you are using a different Linux distribution than Ubuntu, the entry in the context menu may have a different name, such as " Delete files " or " Remove ".

Delete files via console command

1st step

image
Right-click to open a new terminal . If your Linux distribution does not offer such an entry, you have to open the console manually and navigate to the desired path.

2nd step

image
The rm command (short for remove ) will delete the specified files for you. For example, if you want to delete multiple files, enter the following into your terminal: rm filename1 filename2 filename3

Deleting folders via console command

1st step:

image
Open your terminal manually or via the right-click menu.

2nd step

image
If you haven't already done so, navigate to the folder that contains the files you want to delete. Now you can delete the folder with rm -r folder name. The -r stands for recursive. This means that not only the folder but also all files in it will be deleted.

More examples for the rm command

Here we show you some examples of the rm command. Before doing this, make sure that you are in the correct directory with the terminal so as not to accidentally delete incorrect files.

  • To delete a single file, use rm filename
  • You can remove multiple files with rm FileName1 FileName2 FileName3
  • For folders, use rm -r OrderName
  • You can also insert placeholders. So rm * .txt can delete all files with the extension .txt in the current directory.
  • With man rm you can call up the help page for rm in the terminal.

...