6

I tried to move a file into the rubbish bin (because I followed some instructions about installing sage and it involved moving a file to that directory) and it gave me errors saying that I didn't have permission. Even though I'm signed in as an administrator.

1 Answer 1

13

Open a terminal with Ctrl-Alt-T and Use sudo like this.

cd /usr/local/src
sudo rm ./file-name

If you want to delete the entire content of a folder, you should use -r switch. like this:

cd /usr/local/src
sudo rm -r ./folder-name

Please, make sure you aren't deleting any system files. Also double check the file and folder name before hitting Enter key.

4
  • 7
    I recommend never to use rm -r with a path containing a /. If you accidentally type a space in the middle, you might end up deleting the whole /usr tree or something. Rather, change to the parent directory first: cd /usr/local/src, check that it succeeded, sudo rm -r folder-name. Sep 28, 2012 at 17:22
  • @BrentonHorne you can do this by clicking the gray tick icon at the left side of the answer.
    – Anwar
    Sep 28, 2012 at 17:38
  • Oh sorry, I'm new to here. It's done!
    – Josh Pinto
    Sep 28, 2012 at 18:07
  • 1
    Another option is to use the -i flag: rm -ri /usr/local/src , that will give confirmation prior to executing the deletion.
    – Panther
    Sep 28, 2012 at 21:29

You must log in to answer this question.

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