[LINUX] All up to 775/664, 777/666, 755/644, etc.

chmod has a convenient -R option. If you do chmod -R 775 [dir], the files in [dir], the child directories, the files in it, etc. will all be chmod 775. It's convenient, but it's inconvenient because I want to have different permissions for directories and files, but all of them are 775, so this is a command to prevent that.

Directory is 775 / File is 664

I think there is the number one situation where you need chmod. For example, let's say you have a directory situation like this. image.png If you want the directory to be 775 and the file to be 664, hit this.

775/664.chmod


chmod -R "=r,u+w,g+w,+X" [dir]

image.png ** The directory is now 775 and the file is 664 **.

Directory is 777 / File is 666

You may not have much chance to do it, but I think that there may be times when you do not have an accident when taking over. Here's how to make it 777/666.

777/666.chmod


chmod -R "=r,u+w,g+w,o+w,+X" [dir]

image.png ** The directory is now 777 and the file is 666 **.

Directory is 755 / File is 644

It is when you want to make it so-called normal.

755/644.chmod


chmod -R "=r,u+w,+X" [dir]

image.png ** The directory is now 755 and the file is 644 **.

Remarks

The ls command in the image uses ʻexa. l -T is an alias for ʻexa -la -T. See this article for details on the ʻexacommand that creates colorfulls`. ..

Use exa rather than ls! Introducing modern Linux commands-Qiita https://qiita.com/navitime_tech/items/c249269a3b47666c784b

Recommended Posts

All up to 775/664, 777/666, 755/644, etc.
Script to mysqldump to all MySQL DBs
Numba to speed up as Python
Codeforces Round # 609 (Div. 2) (up to B)
Back up Qiita posts to GitHub
Project Euler 4 Attempt to speed up
Variance, statistics up to standard deviation
How to speed up Python calculations
[DRF] Snippet to speed up PrimaryKeyRelatedField
I want to scrape them all together.
How to set up SVM using Optuna
"Lie ... What have you been up to?"
Django initial setup up to Intellij Debug
Summary of procedures up to PyPI registration
Output user information etc. to Django log
Wait for Aurora Serverless to wake up