I accidentally copied the files from /proc to one of the directory under /home

But now I am not able to delete those copied contents. It says "Permission denied". Folder size is ~300GB

How can I safely delete the copied version of proc folder?

  • As an aside, please specify your OS exactly, not "unix". Not all Unix-like systems have /proc.
    – schaiba
    May 31, 2017 at 7:41

1 Answer 1

  1. How to delete files "safely"
  2. How to solve your "Permission denied" problem

1. How to delete files "safely"

Modern versions of GNU rm will keep you safe from accidentally deleting all of / , but you can still accidentally delete all of /home... The safest way I can think is to first cd into the directory, use ls to check it is the right one, then delete its contents, then cd .. and rmdir proc. rmdir is very safe because it only deletes empty directories.

To delete everything in the current directory, use rm -r -- *

It is probably "safe" to forget the -- in the rm command. However it might not work as expected, for example if there is a file called -i.

You could use a graphical file manager instead, which is generally safer than rm. You can move the file(s) to the "trash". This will leave you a chance to undo the action, until you empty the whole trash, or delete the file(s) from the trash. I prefer using this when possible. It does not always work well. I managed to crash Gnome Files while testing this :-).

2. How to solve your "Permission denied" problem

Your problem is that some of the subdirectories have been marked as "read only". (And you are not running as root, which ignores these markings).

You can allow writes to the current directory and everything inside it, using chmod u+w -R . Then you will be able to delete it.

In some cases, using a graphical file manager to delete a folder will change the permissions for you automatically. Or, you can use the file manager to change permissions manually. If you use Gnome Files: right click -> Properties -> Permissions. Next to Owner, set "Create and delete files". Then do the same again under "Change permission for enclosed files".

  • it worked... this was life saver...thanks :) May 31, 2017 at 7:48

You must log in to answer this question.

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