- #1
shivajikobardan
- 674
- 54
- TL;DR Summary
- When to use "-perm mode", "-perm -mode" and "-perm /mode" in find command Linux?
I am reading the find documentation and find this pretty confusing.
I'll try to explain what I've understood. You can add your explanation to this.
Say we have a scenario like this.
Here the -perm 644 will exactly match for files that have permission 644.
Here the -perm -600 will find any find that have at least 600 as permission.
Here -perm /700 finds files that have any of 7,0,0 as their permission bit set.
Is my understanding correct and what are the potential use cases of these respective commands?
I'll try to explain what I've understood. You can add your explanation to this.
Code:
.
├── file1.txt (Permission: 644)
├── file2.txt (Permission: 600)
└── subdir
├── file3.txt (Permission: 755)
└── file4.txt (Permission: 700)
Say we have a scenario like this.
Code:
$ find . -perm 644
./file1.txt
Here the -perm 644 will exactly match for files that have permission 644.
Code:
$ find . -perm -600
./file1.txt
./file2.txt
Here the -perm -600 will find any find that have at least 600 as permission.
Code:
$ find . -perm /700
./file2.txt
./subdir/file3.txt
./subdir/file4.txt
Here -perm /700 finds files that have any of 7,0,0 as their permission bit set.
Is my understanding correct and what are the potential use cases of these respective commands?