How to sudo chmod -R 777 * including hidden files?
5,106
Universal:
chmod 777 -R ./* ./.[!.]*
Bash has this command
shopt -s dotglob
to also include hidden files in commands (shopt -u dotglob
to disable that behaviour) if you want to stick to using sudo chmod -R 777 *
.
- It will break your system if you execute it from the wrong directory.
- NEVER use a bare
*
but use./*
. - the shopt method is more secure than the universal one
Author by
Blackbam
Updated on September 18, 2022Comments
-
Blackbam over 1 year
Basically what I want to do is all in the title. If I want to grant read, write and execute permissions for everybody in a folder then I usually do:
sudo chmod -R 777 *
How can I extend this command to include hidden files and folders (starting with a dot) e.g. like
.env
? Because in the command above those are not affected. -
Marc Vanhoomissen over 3 yearsOnly files starting by .* will be affected. The OP wants ALL files.