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?
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. It only takes a minute to sign up.
Sign up to join this communityI 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?
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 :-).
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".