Reputation: 21864
I need to add the Google Cloud SDK in the PATH
. So I need the path to where is installed. Is there any gcloud ...
command which gives me this information?
If not I have to go through the symlink in which gcloud
, etc.
Any cleaner solution for this problem?
Upvotes: 35
Views: 34938
Reputation: 606
As of March 2022, the gcloud sdk link indicates you can have the SDK for client libraries Java, Python, Node.js, Ruby, .Net and Php.
In addition you can have the CLI too. If you have installed the CLI, part of the ( optional ) install process is to add the gcloud binary path to your PATH thus you can find it.
This script is called path.bash.inc, path.zsh.inc etc and depending on what your default shell is it will run the correct path.your_shell.inc file. If you have never run that, then it is possible your gcloud was installed in a directory that you lost track of.
If that is the case, then you have to simply run a "find" from the root
find / -name gcloud -type f -ls 2>/dev/zero
This contrasts with
2 AZ cli, that gets installed using homebrew on Mac - under /opt/homebrew/bin path - which, if you used a Mac, already is in your Path.
Upvotes: 2
Reputation: 21374
The following command will give you the information you're looking for:
$ gcloud info --format="value(installation.sdk_root)"
/path/to/google-cloud-sdk/
You need to append /bin
.
You also have lots of other paths available: config.paths.global_config_dir
, installation.sdk_root
, and so on. Look at the output of gcloud info --format=json
for all available properties to query.
Upvotes: 73