0

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.

1
  • If you open folder from a flash disk that was Write Protected in Windows, then it is natural you can not see Delete option on your menu. Jul 18, 2014 at 17:28

5 Answers 5

3

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: screen0


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: screen1

Now you can see "Delete" option (after right-clicking) as follows:

screen2


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
  • 1
    @pandya - Thanks for the edits - I tend to get a little lazy! Jul 18, 2014 at 16:48
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!

0

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

2
  • What makes you think that the OP needs to run Nautilus as root? Jul 18, 2014 at 16:14
  • 2
    Please do not recommend running Nautilus as root to a beginner. This can turn out to be evil.
    – Takkat
    Jul 18, 2014 at 17:19
0

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.

0

choose the file and press the "delete" button. If you want to delete directly bypassing the trash then press "shift+delete".

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .