Under /usr/bin, find regular files that contain the SGID bit.
Which condition is appropriate?
SGID is represented by octal 2000, so -type f -perm -2000 finds regular files containing that bit.
Detailed explanation
-type f -perm -4000Incorrect. 4000 represents SUID.
Incorrect. 4000 represents SUID.
-type f -perm -2000Correct. It requires the SGID bit on a regular file.
Correct. It requires the SGID bit on a regular file.
-type f -perm -1000Incorrect. 1000 represents the sticky bit.
Incorrect. 1000 represents the sticky bit.
-type f -perm -0200Incorrect. 0200 is a regular write permission bit, not SGID.
Incorrect. 0200 is a regular write permission bit, not SGID.
Try it yourself
An example you can run in a temporary verification environment.
printf '%s
' '4000=SUID' '2000=SGID' '1000=sticky'Expected result
4000=SUID
2000=SGID
1000=stickyKey points
- SGID is 2000
- SUID is 4000
- Sticky is 1000
Notes
- Environment: permission bit対応表
- Command output formatting can vary slightly by distribution or tool version.
- Run the example in a temporary directory or process when possible.
Foundation review
Read the scope first
Check whether the command acts on the current shell, a new process, an existing process, or a file.
Verify the observable result
Use the supplied command and compare the output with the expected result.