Deleting a file does nothing

Asked by Not Telling

I followed the Help application instructions in Ubuntu 16.04 LTS on deleting a file by selecting the file I want to delete and pressing the delete key, but nothing happens. Why won't my file delete?

Question information

Language:
English Edit question
Status:
Solved
For:
Ubuntu Edit question
Assignee:
No assignee Edit question
Solved by:
actionparsnip
Solved:
Last query:
Last reply:
Revision history for this message
Manfred Hampl (m-hampl) said :
#1

If you click the right mouse button and select 'delete' on the pop-up, is it the same (i.e. doing nothing)?

Maybe you do not have the required access rights for deleting the file.

What happens if you open a terminal window and delete the file in command line mode with
rm /directory/path/filename

Revision history for this message
Not Telling (c4529218) said :
#2

There is no 'delete' when I right click the mouse button.

How do I find out if I have the required access rights for deleting the file?

This happens:
rm: cannot remove '/directory/path/filename': No such file or directory

Thanks

Revision history for this message
Manfred Hampl (m-hampl) said :
#3

You have to provide the real directory path and file name instead of the placeholder '/directory/path/filename'

Revision history for this message
Ronaldo R.Oliveira (morcberry) said :
#4

First the file exists really ?
if yes, change for the directory where is the file.
then make ls -lsh
the file appear ?
if yes, then makes : sudo rm xxxx ( where xxxx is the file that you wish delete )

Revision history for this message
Not Telling (c4529218) said :
#5

Manfred Hampl (m-hampl): I provided the real directory path and file name and got this (quoted):

'rm: remove write-protected regular file '/etc/ufw/after6.rules.20160622_171343'?'

I answered 'Yes' and it told me this (quoted):

'rm: cannot remove '/etc/ufw/after6.rules.20160622_171343': Permission denied'

Ronaldo R.Oliveira (morcberry):

Yes the file exists.
I'm not sure what you are saying about change for the directory where the file is. What does this mean?
What does making ls -lsh mean?

Revision history for this message
Best actionparsnip (andrew-woodhead666) said :
#6

sudo rm /etc/ufw/after6.rules.20160622_171343

Will remove it. If you don't prefix with sudo then the command will run as your user which has very little access. Adding sudo runs the command as root which has complete system access.

Revision history for this message
Manfred Hampl (m-hampl) said :
#7

"ls" is the command to list the contents of a directory (or folder), similar to the command "dir" that exists on other operating systems.
The parameters -lsh modify the output
-l is for long output (including security settings and file size)
-h is for displaying the size in multiples of KB, or MB, or GB
etc.

The background of your problem apparently is the following:
On Ubuntu a user usually has write (and delete) access to the own files only. System files are owned by "root", and most of them can be read by all users, but not be modified.
If you want to modify a system file, you have to temporarily gain administrative authorizations. And this cane be done with the sudo command prefix. You might find some more details in https://help.ubuntu.com/community/RootSudo

Revision history for this message
Not Telling (c4529218) said :
#8

Thanks actionparsnip, that solved my question.

Revision history for this message
Not Telling (c4529218) said :
#9

actionparsnip (andrew-woodhead666): THANK YOU very much of for that! It solved my problem! :D

Manfred Hampl (m-hampl): Thanks so much about telling me about the command 'ls'. I was actually just wondering that! Also thank you for telling me about the 'sudo' command!!!!! :) :D

What is a prefix and parameter?

Revision history for this message
Manfred Hampl (m-hampl) said :
#10

"What is a prefix and parameter?"

My wording probably was a bit inexact.

Prefix is something you put in front (e.g. of a word):

You have changed the command
rm /etc/ufw/after6.rules.20160622_171343
into
sudo rm /etc/ufw/after6.rules.20160622_171343
by putting "sudo" in front of it, to temporarily gain administrative privileges.

And instead of "parameter(s)" I should better have used the wording "option(s)".
That is a flag, changing the behavior of a command, like
ls
giving a short directory listing, only providing file names but nothing else
but
ls -l
giving a long listing, adding also access rights settings, ownership, size and creation date