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.

Σχετικά με αυτήν τη δέσμη

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.

Κάρτες σε αυτήν τη δέσμη

  1. Κάρτα 1

    Ερώτηση

    A regular file has mode 0541 (special bits 0). Which octal bit would add owner write permission?

    Απάντηση

    0200. Owner permissions occupy the hundreds digit; write contributes 2.

  2. Κάρτα 2

    Ερώτηση

    In GNU find, what does -perm 0640 require?

    Απάντηση

    Exactly mode 0640, including no special bits. Extra read, write, execute, or special bits prevent a match.

  3. Κάρτα 3

    Ερώτηση

    In GNU find, what does the minus prefix in -perm -0240 mean?

    Απάντηση

    Both selected bits must be set: owner write and group read. Unselected bits may have either value.

  4. Κάρτα 4

    Ερώτηση

    In GNU find, what does the slash prefix in -perm /0104 mean?

    Απάντηση

    At least one selected bit must be set: owner execute or other read. Both may also be set.

  5. Κάρτα 5

    Ερώτηση

    Which files lack owner execute permission?

    Regular files; special bits are 0:

    memo  0640
    runner  0750
    shared  0660
    

    Απάντηση

    memo and shared. Their owner digit is 6 (read + write); runner has owner digit 7.

  6. Κάρτα 6

    Ερώτηση

    Which file matches GNU find . -type f -perm 0620?

    Regular files; special bits are 0:

    note  0620
    copy  0660
    tool  0720
    open  0622
    

    Απάντηση

    note only. Each other mode has at least one extra bit.

  7. Κάρτα 7

    Ερώτηση

    Which files match GNU find . -type f -perm -0410?

    Regular files; special bits are 0:

    amber  0410
    birch  0650
    cedar  0600
    dune  0040
    

    Απάντηση

    amber and birch. Both have owner read (0400) and group execute (0010).

  8. Κάρτα 8

    Ερώτηση

    Which files match GNU find . -type f -perm /0022?

    Regular files; special bits are 0:

    iris  0600
    jade  0620
    kelp  0602
    lime  0622
    

    Απάντηση

    jade, kelp, and lime. Group write or other write is enough.

  9. Κάρτα 9

    Ερώτηση

    Write one numeric GNU -perm predicate requiring owner write AND other execute, allowing any extra bits.

    Απάντηση

    -perm -0201

    The mask combines owner write (0200) and other execute (0001).

  10. Κάρτα 10

    Ερώτηση

    Write a numeric GNU -perm predicate for exactly owner read/write, group execute, no other permissions, and no special bits.

    Απάντηση

    -perm 0610

    There is no prefix: every mode bit must agree.

  11. Κάρτα 11

    Ερώτηση

    Rewrite GNU -perm -0050 using a symbolic mode.

    Απάντηση

    -perm -g=rx

    Group read AND group execute are required; other bits are ignored.

  12. Κάρτα 12

    Ερώτηση

    Rewrite GNU -perm /0102 using a symbolic mode.

    Απάντηση

    -perm /u=x,o=w

    Owner execute OR other write is enough.

  13. Κάρτα 13

    Ερώτηση

    Which files match GNU find . -type f ! -perm /0111?

    Regular files; special bits are 0:

    draft  0660
    public  0644
    private  0600
    script  0750
    

    Απάντηση

    draft, private, and public. Negating an any-execute test selects files with no execute bits.

  14. Κάρτα 14

    Ερώτηση

    Which files match GNU find . -type f -perm /0000 in current GNU find?

    Regular files; special bits are 0:

    sealed  0000
    text  0640
    run  0700
    

    Απάντηση

    All three files. GNU find treats an empty any-bit mask as matching everything; this is a special case.

  15. Κάρτα 15

    Ερώτηση

    A regular file has mode 0641 (special bits 0). Which single bit makes GNU -perm 0640 fail?

    Απάντηση

    Other execute (0001). Exact matching rejects that extra bit.

  16. Κάρτα 16

    Ερώτηση

    Does GNU -perm -0200 prove the invoking user can successfully write the file?

    Απάντηση

    No. It checks the owner-write mode bit, regardless of who invokes find. ACLs, the filesystem, and other conditions can affect access; even -writable is not a guarantee that a later write succeeds.

  17. Κάρτα 17

    Ερώτηση

    Write two GNU -perm predicates joined by implicit AND: require group write, but forbid other read. Extra bits are allowed.

    Απάντηση

    -perm -0020 ! -perm -0004

    The first requires group write; the negated second excludes other read.

  18. Κάρτα 18

    Ερώτηση

    GNU -perm /0041 also accepts files with just one selected bit. Replace only its mode argument to require group read AND other execute.

    Απάντηση

    -0041, giving -perm -0041.

    Both selected bits must be present.

  19. Κάρτα 19

    Ερώτηση

    A regular file log and a directory box both have mode 0750 (special bits 0). Which matches GNU find . -type f -perm 0750?

    Απάντηση

    log only. -type f restricts the result to regular files; -perm alone does not.

  20. Κάρτα 20

    Ερώτηση

    Write one numeric GNU -perm predicate selecting a file with owner execute OR group write, allowing extra bits.

    Απάντηση

    -perm /0120

    Either selected bit is sufficient.

  21. Κάρτα 21

    Ερώτηση

    Write a complete GNU find command under . selecting only regular files with mode exactly 0604 OR exactly 0640. All mode bits must agree.

    Απάντηση

    find . -type f \( -perm 0604 -o -perm 0640 \) -print

    The parentheses keep the regular-file condition outside both alternatives.

  22. Κάρτα 22

    Ερώτηση

    Which file matches GNU find . -type f -perm g=r?

    Regular files; special bits are 0:

    a  0040
    b  0640
    c  0440
    

    Απάντηση

    a only. In this exact symbolic test, the mask starts from zero, so g=r means exactly 0040.

  23. Κάρτα 23

    Ερώτηση

    Which files match GNU find . -type f ! -perm -0050?

    Regular files; special bits are 0:

    a  0650
    b  0640
    c  0610
    d  0600
    

    Απάντηση

    b, c, and d. At least one required group bit is missing; the negation does not require both bits to be absent.

  24. Κάρτα 24

    Ερώτηση

    Which GNU -perm matching prefix is a GNU extension: no prefix, -, or /?

    Απάντηση

    / (any selected bit).

    Exact and minus-prefixed matching are specified by POSIX. Do not use obsolete GNU +mode as an alternative.

  25. Κάρτα 25

    Ερώτηση

    Does this GNU command restrict BOTH branches to regular files?

    find . -type f -perm 0604 -o -perm 0640
    

    Απάντηση

    No. Implicit AND binds more tightly than -o, so the 0640 branch can also match a directory. Group the two permission alternatives after -type f.

  26. Κάρτα 26

    Ερώτηση

    Which files match GNU find . -type f -perm 0000?

    Regular files; special bits are 0:

    a  0000
    b  0400
    c  0600
    

    Απάντηση

    a only. With no matching prefix, zero means exactly no ordinary or special mode bits.

  27. Κάρτα 27

    Ερώτηση

    Write a GNU -perm expression selecting files with NEITHER group write NOR other write, allowing all other bits.

    Απάντηση

    ! -perm /0022

    Negate the any-bit test. ! -perm -0022 would also accept files that have just one of the two write bits.

A magnifying glass over an abstract grid of lights in a terminal, beside three file icons.

27 κάρτες

GNU Find Permission Flashcards: Exact, All & Any Bits

Μελετήστε αυτήν τη δέσμη δωρεάν

Το Nibomo ανοίγει για να ξεκινήσετε τη μελέτη.

Παρόμοιες δέσμες