Unable to delete files through Terminal
It seems that your file was created using superuser sudo
(root/admin) attributes so, in order to modify o delete this file you would need to authenticate as a sudo
, to do this simply type:
sudo rm -rf path/to/file
here rm -rf
stands as remove recursively so that if path/to/file
is a folder all its content will be removed. Your machine will ask you for sudo password
. Consider that after this instruction the files will be completely removed!.
Related videos on Youtube
![ALX](https://i.stack.imgur.com/GXO3G.png?s=256&g=1)
ALX
Updated on September 18, 2022Comments
-
ALX almost 2 years
More recently, I have been using
rm -r /path/to/file
to delete files, but when deleting from certain locations, I get the error:override rw-r--r-- root/admin for filename?
I have tried enteringy
, but I get the error:rm: filename: Permission denied
. I have also triedrm -rf
andyes | rm -r
with the errorrm: filename: Permission denied
again. Is there any way to bypass this strange issue? My operating system is Mac OSX Yosemite, and I am using Terminal.-
text almost 8 yearsIt probably has to do with the permissions on the directory not the file.
-
ALX almost 8 yearsI believe that is true @mdpc, I am asking how to override that I guess. I probably should have made that more clear.
-
text almost 8 yearsA solution would be to change the directory permission.
-
thrig almost 8 yearsWhat are the permissions on
/path/to
, doeschflags
show anything interesting on any of the files or directories involved, and you might need to boot in rescue mode to delete some of the really restricted files in recent OS X releases. -
ALX almost 8 yearsAnd that is with the shift key, correct?
-
Gilles 'SO- stop being evil' almost 8 yearsWhich files, precisely? IIRC recent versions of OSX make some parts of the system read-only even to root.
-
-
zyy over 4 yearsI thought
sudo
is deprecated on mac, but it worked! -
Admin about 2 yearsWhen I
sudo
it still doesn't work. I think something is really messed up on my system.