XK0-005 · Question #203
XK0-005 Question #203: Real Exam Question with Answer & Explanation
The correct answer is A: sudo ln -s /opt/occmd/bin/occmd /usr/local/bin/occmd. When a command is installed but not found by the shell, it's typically because its directory is not included in the system's PATH environment variable.
Question
A systems administrator downloads an application's source files, compiles the application, and installs it per the application's installation instructions. When trying to run the application, the system states: $ occmd bash: occmd: command not found... Running the locate command shows it does exist in the following location: /opt/occmd/bin/occmd Which of the following should the administrator do to allow the command to run properly? (Choose two.)
Options
- Asudo ln -s /opt/occmd/bin/occmd /usr/local/bin/occmd
- Becho "export PATH=$PATH:/opt/occmd/bin" >> ~/.bashrc
- Cmv /opt/occmd ~/ && ln -s ~/occmd/bin/occmd ./occmd
- Decho "#!/bin/bash \n ${which occmd}" > /usr/bin/occmd.sh
- Esudo mv /opt/occmd/bin/occmd /etc/bin/
- Fcd /opt/occmd/bin && chmod +x ./occmd && restorecon -rv *
Explanation
When a command is installed but not found by the shell, it's typically because its directory is not included in the system's PATH environment variable.
Common mistakes.
- C. Moving the application to the home directory is not a standard practice for system-wide applications, and the symlink created would only be local.
- D. This command attempts to create a shell script but uses incorrect syntax for executing and redirecting the output of
which occmdand would not makeoccmdexecutable. - E.
/etc/bin/is not a standard directory for executables;/etcis for configuration files. - F. While
chmod +xis necessary to make a file executable, andrestoreconhandles SELinux contexts, these actions do not solve the 'command not found' error if the executable's directory is not in the system's PATH.
Concept tested. Linux PATH variable and symbolic links for executables
Topics
Community Discussion
No community discussion yet for this question.