Can anyone give me a simple answer as to how I can delete files on Ubuntu? I have tried seeing if there was a delete option when selecting a file, but it doesn't show.
5 Answers
Open Nautilus, the default file manager for Ubuntu (I assume that you are using that since you are fairly new to AskUbuntu)
By default "Move To Trash" option provided in nautilus (by right clicking on file) as follows:
Go to the menus at the top and click Edit->Preferences
In the window that appears, choose the Behavior tab, then click the button to include a Delete Command as shown in the image below.
Following that you should be able to delete a file directly from the File Manager:
Now you can see "Delete" option (after right-clicking) as follows:
However you can delete files/directories by Delete and Shift+Delete.
In case you don't have write permission for a file or directory Move to Trash or Delete will not work and will be greyed out. This usually is the case for all files outside of your home directory /home/<username>
.
Only if you are in desperate need to delete such files from the graphical file manager it is possible to run nautilus as root by sudo -i nautilus
but this is not recommended. With a wrong command or accidental mouse move you risk to damage your whole system to a state where it can not even boot.
Please make yourself familiar with the Ubuntu concept of sudo, the Debian File System Hierarchy, and most importantly permissions before you do anything as root with Nautilus.
-
1
Assuming that the file is inside your home folder or an external disk, you can delete file by:
- right clicking the file and selecting "delete"
- selecting the file and pressing the delete key on your keyboard
- clicking and dragging the file to your trash, which is in the launcher (left pane of Ubuntu) and in the list of locations on the left of your file browser
- in the terminal, performing rm /path/to/file
If the file is not yours (belongs to another user or to the system), you can use sudo nautilus
, replacing nautilus
with rm /path/to/file
or another file browser. Be warned, deleting system files may make your copy of Ubuntu, other operating systems on your computer, or even your computer itself unusable!
press ctrl + alt + T this opens the terminal then run this command
sudo nautilus
then simply locate your file and now after finding your file you can modify or create it if you have any permission to modify or delete them
-
What makes you think that the OP needs to run Nautilus as root? Jul 18, 2014 at 16:14
-
2Please do not recommend running Nautilus as root to a beginner. This can turn out to be evil.– TakkatJul 18, 2014 at 17:19
Assuming you are using the Files file manager, the Move to Trash option when you right click a file is a delete option in practice, but you have the option to restore files in the trash can would you change your mind.
If you really want to delete files irrevocably, the answer provided by Charles Green shows you how.
choose the file and press the "delete" button. If you want to delete directly bypassing the trash then press "shift+delete".