Which UNIX/Linux command is used to make all files and sub-directories in the…

2018

Which UNIX/Linux command is used to make all files and sub-directories in the directory “progs” executable by all users ?

  1. A.

    chmod− R a+x progs

  2. B.

    chmod −R 222 progs

  3. C.

    chmod−X a+x progs

  4. D.

    chmod −X 222 progs

Attempted by 44 students.

Show answer & explanation

Correct answer: A

Correct command: chmod -R a+x progs

  • -R (recursive): apply the permission change to progs and all files and subdirectories inside it.

  • a+x: add the execute bit for all users (owner, group, others). This makes files and directories executable by all users.

  • Be careful with syntax: use a standard ASCII hyphen (-) before R and no stray characters so the shell interprets the option correctly.

  • Caveat and safer alternative: chmod -R a+x progs will make every file executable which may be undesirable. To add execute only to directories (and to files that already have an execute bit), use chmod -R a+X progs. To set execute only on directories explicitly, you can use a find-based command like:

  • find progs -type d -exec chmod a+x {} +

A video solution is available for this question — log in and enroll to watch it.

Explore the full course: Nta Ugc Net Paper 2

Loading lesson…