GNU Find Permission Flashcards: Exact, All & Any Bits
Practice GNU find -perm with original mode-bit exercises: predict matches, build masks, and fix exact, all-bit, any-bit, and grouped searches.
Über dieses Lernkartenset
Practice GNU find’s three permission tests: exact mode, all selected bits, and any selected bit. Predict matching files, work backward from a bit requirement to a predicate, translate selected numeric masks into symbolic forms, and repair common mistakes. Later cards combine predicates and group OR branches while keeping regular-file scope clear.
Start with the few bit-position rules needed for the exercises, then move from single-file decisions to short file lists and expressions. Related prompts are separated so the next card does not give away the answer. Each exercise specifies the file type and mode; all fixtures have special bits cleared. Answers name the result first and briefly explain the deciding bit.
This is focused mode-bit practice, not a chmod course or an access-control test. It excludes special-bit exercises, ACL calculations, recursive permission changes, and automatic command-to-description reversals that add little retrieval value. The cards also distinguish permission bits from actual write access, cover current GNU zero-mask behavior, and identify the GNU-only any-bit prefix. Shell examples assume a POSIX-like shell; result questions ask for sets, not traversal order.
Questions, explanations, fixtures, sequence, and cover are independently authored with AI assistance. The executable exercises were checked with GNU findutils 4.11.0. Original contributions are offered under CC0 1.0 to the extent applicable rights exist; no rights are claimed over facts or GNU documentation. No manual examples or text were copied.
Independent, unofficial study material; not affiliated with or endorsed by the GNU Project or the Free Software Foundation. Technical reference: GNU findutils manual.
Karten in diesem Lernkartenset
Karte 1
Frage
A regular file has mode
0541(special bits 0). Which octal bit would add owner write permission?Antwort
0200. Owner permissions occupy the hundreds digit; write contributes 2.Karte 2
Frage
In GNU find, what does
-perm 0640require?Antwort
Exactly mode
0640, including no special bits. Extra read, write, execute, or special bits prevent a match.Karte 3
Frage
In GNU find, what does the minus prefix in
-perm -0240mean?Antwort
Both selected bits must be set: owner write and group read. Unselected bits may have either value.
Karte 4
Frage
In GNU find, what does the slash prefix in
-perm /0104mean?Antwort
At least one selected bit must be set: owner execute or other read. Both may also be set.
Karte 5
Frage
Which files lack owner execute permission?
Regular files; special bits are 0:
memo 0640 runner 0750 shared 0660Antwort
memoandshared. Their owner digit is 6 (read + write);runnerhas owner digit 7.Karte 6
Frage
Which file matches GNU
find . -type f -perm 0620?Regular files; special bits are 0:
note 0620 copy 0660 tool 0720 open 0622Antwort
noteonly. Each other mode has at least one extra bit.Karte 7
Frage
Which files match GNU
find . -type f -perm -0410?Regular files; special bits are 0:
amber 0410 birch 0650 cedar 0600 dune 0040Antwort
amberandbirch. Both have owner read (0400) and group execute (0010).Karte 8
Frage
Which files match GNU
find . -type f -perm /0022?Regular files; special bits are 0:
iris 0600 jade 0620 kelp 0602 lime 0622Antwort
jade,kelp, andlime. Group write or other write is enough.Karte 9
Frage
Write one numeric GNU
-permpredicate requiring owner write AND other execute, allowing any extra bits.Antwort
-perm -0201The mask combines owner write (
0200) and other execute (0001).Karte 10
Frage
Write a numeric GNU
-permpredicate for exactly owner read/write, group execute, no other permissions, and no special bits.Antwort
-perm 0610There is no prefix: every mode bit must agree.
Karte 11
Frage
Rewrite GNU
-perm -0050using a symbolic mode.Antwort
-perm -g=rxGroup read AND group execute are required; other bits are ignored.
Karte 12
Frage
Rewrite GNU
-perm /0102using a symbolic mode.Antwort
-perm /u=x,o=wOwner execute OR other write is enough.
Karte 13
Frage
Which files match GNU
find . -type f ! -perm /0111?Regular files; special bits are 0:
draft 0660 public 0644 private 0600 script 0750Antwort
draft,private, andpublic. Negating an any-execute test selects files with no execute bits.Karte 14
Frage
Which files match GNU
find . -type f -perm /0000in current GNU find?Regular files; special bits are 0:
sealed 0000 text 0640 run 0700Antwort
All three files. GNU find treats an empty any-bit mask as matching everything; this is a special case.
Karte 15
Frage
A regular file has mode
0641(special bits 0). Which single bit makes GNU-perm 0640fail?Antwort
Other execute (
0001). Exact matching rejects that extra bit.Karte 16
Frage
Does GNU
-perm -0200prove the invoking user can successfully write the file?Antwort
No. It checks the owner-write mode bit, regardless of who invokes find. ACLs, the filesystem, and other conditions can affect access; even
-writableis not a guarantee that a later write succeeds.Karte 17
Frage
Write two GNU
-permpredicates joined by implicit AND: require group write, but forbid other read. Extra bits are allowed.Antwort
-perm -0020 ! -perm -0004The first requires group write; the negated second excludes other read.
Karte 18
Frage
GNU
-perm /0041also accepts files with just one selected bit. Replace only its mode argument to require group read AND other execute.Antwort
-0041, giving-perm -0041.Both selected bits must be present.
Karte 19
Frage
A regular file
logand a directoryboxboth have mode0750(special bits 0). Which matches GNUfind . -type f -perm 0750?Antwort
logonly.-type frestricts the result to regular files;-permalone does not.Karte 20
Frage
Write one numeric GNU
-permpredicate selecting a file with owner execute OR group write, allowing extra bits.Antwort
-perm /0120Either selected bit is sufficient.
Karte 21
Frage
Write a complete GNU find command under
.selecting only regular files with mode exactly0604OR exactly0640. All mode bits must agree.Antwort
find . -type f \( -perm 0604 -o -perm 0640 \) -printThe parentheses keep the regular-file condition outside both alternatives.
Karte 22
Frage
Which file matches GNU
find . -type f -perm g=r?Regular files; special bits are 0:
a 0040 b 0640 c 0440Antwort
aonly. In this exact symbolic test, the mask starts from zero, sog=rmeans exactly0040.Karte 23
Frage
Which files match GNU
find . -type f ! -perm -0050?Regular files; special bits are 0:
a 0650 b 0640 c 0610 d 0600Antwort
b,c, andd. At least one required group bit is missing; the negation does not require both bits to be absent.Karte 24
Frage
Which GNU
-permmatching prefix is a GNU extension: no prefix,-, or/?Antwort
/(any selected bit).Exact and minus-prefixed matching are specified by POSIX. Do not use obsolete GNU
+modeas an alternative.Karte 25
Frage
Does this GNU command restrict BOTH branches to regular files?
find . -type f -perm 0604 -o -perm 0640Antwort
No. Implicit AND binds more tightly than
-o, so the0640branch can also match a directory. Group the two permission alternatives after-type f.Karte 26
Frage
Which files match GNU
find . -type f -perm 0000?Regular files; special bits are 0:
a 0000 b 0400 c 0600Antwort
aonly. With no matching prefix, zero means exactly no ordinary or special mode bits.Karte 27
Frage
Write a GNU
-permexpression selecting files with NEITHER group write NOR other write, allowing all other bits.Antwort
! -perm /0022Negate the any-bit test.
! -perm -0022would also accept files that have just one of the two write bits.
27 Karten
GNU Find Permission Flashcards: Exact, All & Any Bits
Nibomo wird geöffnet, damit du mit dem Lernen beginnen kannst.