An administrator installed an application from source into /opt/operations1/ and has received numerous reports that users are not able to access the application without having to use the full path /opt/operations1/bin/*.
Which of the following commands should be used to resolve this issue?
A . echo ‘export PATH=$PATH:/opt/operations1/bin’ >> /etc/profile
B . echo ‘export PATH=/opt/operations1/bin’ >> /etc/profile
C . echo ‘export PATH=$PATH/opt/operations1/bin’ >> /etc/profile
D . echo ‘export $PATH:/opt/operations1/bin’ >> /etc/profile
Answer: A
Explanation:
The command echo ‘export PATH=$PATH:/opt/operations1/bin’ >> /etc/profile should be used to resolve the issue of users not being able to access the application without using the full path. The echo command prints the given string to the standard output. The export command sets an environment variable and makes it available to all child processes. The PATH variable contains a list of directories where the shell looks for executable files. The $PATH expands to the current value of the PATH variable. The : separates the directories in the list. The /opt/operations1/bin is the directory where the application is installed.
The >> operator appends the output to the end of the file. The /etc/profile file is a configuration file that is
executed when a user logs in. The command echo ‘export PATH=$PATH:/opt/operations1/bin’ >>
/etc/profile will add the /opt/operations1/bin directory to the PATH variable for all users and allow them to
access the application without using the full path. This is the correct command to use to resolve the issue. The other options are incorrect because they either overwrite the PATH variable (echo ‘export
PATH=/opt/operations1/bin’ >> /etc/profile) or do not use the correct syntax (echo ‘export
PATH=$PATH/opt/operations1/bin’ >> /etc/profile or echo ‘export $PATH:/opt/operations1/bin’ >>
/etc/profile).
References: CompTIA Linux+ (XK0-005) Certification Study Guide, Chapter 9: Working with the Linux Shell, page 295.
Latest XK0-005 Dumps Valid Version with 136 Q&As
Latest And Valid Q&A | Instant Download | Once Fail, Full Refund