Member-only story
GCP Command Line - gcloud
3 min readJun 22, 2022
#Install Gcloud tool
#For Linuxcurl https://packages.cloud.google.com/apt/doc/apt-key.gpg | sudo apt-key add -
echo “deb https://packages.cloud.google.com/apt cloud-sdk main” | sudo tee -a /etc/apt/sources.list.d/google-cloud-sdk.list
sudo apt update
sudo apt install google-cloud-sdk#For Mac OS
curl https://dl.google.com/dl/cloudsdk/channels/rapid/downloads/google-cloud-sdk-364.0.0-darwin-arm.tar.gz -o gcloud.tar.gz
tar -xvf gcloud.tar.gz
cd google-*
CLOUDSDK_CORE_DISABLE_PROMPTS=1
./install.sh#For Windowsopen a PowerShell terminal and run the following PowerShell commands:
(New-Object Net.WebClient).DownloadFile("https://dl.google.com/dl/cloudsdk/channels/rapid/GoogleCloudSDKInstaller.exe", "$env:Temp\GoogleCloudSDKInstaller.exe")
& $env:Temp\GoogleCloudSDKInstaller.exe
#Display version and installed components.
gcloud version
#Info About the Current Project.
gcloud config list
#Switching between different Projects.
gcloud config set project project-name
#List of projects.
gcloud projects list
#Gcloud Authentication
# web based login
gcloud init
gcloud auth application-default login#( Service account based login )
export GOOGLE_APPLICATION_CREDENTIALS="/home/user/sa-file.json"
or…