ExamGecko
Question list
Search
Search

List of questions

Search

Related questions











Question 96 - XK0-005 discussion

Report
Export

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
Answers
A.
echo 'export PATH=$PATH:/opt/operations1/bin' >> /etc/profile
B.
echo 'export PATH=/opt/operations1/bin' >> /etc/profile
Answers
B.
echo 'export PATH=/opt/operations1/bin' >> /etc/profile
C.
echo 'export PATH=$PATH/opt/operations1/bin' >> /etc/profile
Answers
C.
echo 'export PATH=$PATH/opt/operations1/bin' >> /etc/profile
D.
echo 'export $PATH:/opt/operations1/bin' >> /etc/profile
Answers
D.
echo 'export $PATH:/opt/operations1/bin' >> /etc/profile
Suggested 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). Reference: CompTIA Linux+ (XK0-005) Certification Study Guide, Chapter 9: Working with the Linux Shell, page 295.

asked 02/10/2024
P B
41 questions
User
Your answer:
0 comments
Sorted by

Leave a comment first