You are using Cloud Shell and need to install a custom utility for use in a few weeks.
Where can you store the file so it is in the default execution path and persists across sessions?
Click on the arrows to vote for the correct answer
A. B. C. D.A.
The correct answer is D. /usr/local/bin
.
Cloud Shell is a web-based command-line tool that provides a command-line interface (CLI) to manage your Google Cloud resources. When you open Cloud Shell, it provides you with a temporary Compute Engine virtual machine instance that is pre-configured with the Google Cloud SDK, common command-line tools, and other utilities.
To install a custom utility in Cloud Shell, you need to follow these steps:
Download the custom utility file to your local computer.
Open Cloud Shell by clicking on the Cloud Shell icon in the Google Cloud Console.
Use the Cloud Shell command-line interface to transfer the custom utility file from your local computer to Cloud Shell using the gcloud
command or the scp
command.
Once the custom utility file is transferred to Cloud Shell, you need to store it in a directory that is in the default execution path and persists across sessions.
The default execution path is the set of directories that the shell searches when you enter a command. By default, Cloud Shell's execution path includes the directories /usr/local/bin
, /usr/bin
, /bin
, and /usr/sbin
.
To ensure that the custom utility file is in the default execution path, you should store it in the directory /usr/local/bin
. This directory is commonly used to store user-installed executables, and it is part of the default execution path.
To store the custom utility file in /usr/local/bin
, use the sudo
command to gain administrative privileges and move the file to the directory:
ruby$ sudo mv <custom-utility-file> /usr/local/bin/
Replace <custom-utility-file>
with the name of the file you transferred to Cloud Shell.
Once the file is stored in /usr/local/bin
, it will be in the default execution path and will persist across sessions. You can use the custom utility by entering its name in the Cloud Shell command-line interface.
Therefore, option D. /usr/local/bin
is the correct answer.