I'm new to Ubuntu and I have installed android-studio in /opt/ .today when I opened my android studio it notified for update but when I clicked upon update it said permission error .So i searched for it and came to know that for resolving it I can move the directory from /opt to my home and I did that with following command :

sudo cp -r /opt/android-studio ~/

then I checked my home and I found a folder named android-studio there .but then I found that this android-studio directory exist at two places one at /opt/ and another at home so why I need two ,it will only misuse space . then I found that I can easily change my android-studio directory to current user so that it will allow updates and I did same with following command :

sudo chown -R $USER:$USER /opt/android-studio

It worked so well and I am capable of updating my android-studio.Now I feel that android-studio directory which I made earlier at my home is useless so i want to delete it .I tried to deleting it by :

rm -r android-studio

and it has given following message:

rm: descend into write-protected directory 'android-studio'?

as I am new to Ubuntu so I want to know what this message exactly mean and how should I proceed to delete this android-studio directory at my home .thank you!

1 Answer 1


The -r option enables recursive deletion, so rm wants to descend into directories and go over everything in it as well. cp copies retaining the permissions, so they are unchanged and you might not have write access to the directory, that's what the message suggests. Without write access you'll not be permitted to remove anything either. There are two ways to proceed from here:

  • Run rm with root permissions. Root is in any case permitted to delete the directory and its content.

    sudo rm -r ~/android-studio
  • Change the directory's and its content's permissions first and run rm as you tried it.

    sudo chmod -R a+w ~/android-studio && rm -r ~/android-studio

Especially in combination with root permissions and recursively, deleting stuff is dangerous and should only be done if you are absolutely sure you do the right thing. I advise to use absolute paths (~/android-studio vs. android-studio) because of that. It goes without saying that you should always have a backup at hand.

You must log in to answer this question.

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