nerdexam
CompTIACompTIA

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.

Troubleshooting

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 occmd and would not make occmd executable.
  • E. /etc/bin/ is not a standard directory for executables; /etc is for configuration files.
  • F. While chmod +x is necessary to make a file executable, and restorecon handles 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

Reference. https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/7/html/system_administrators_guide/sect-setting-environment-variables

Topics

#PATH variable#Symbolic Links#Shell Configuration#Command Execution

Community Discussion

No community discussion yet for this question.

Full XK0-005 PracticeBrowse All XK0-005 Questions