Advertisement
efxtv

How to setup Google shell in Linux Terminal

Jul 9th, 2024 (edited)
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.82 KB | Cybersecurity | 0 0
  1. RAW commands to set Google Shell in Linux Shell
  2.  
  3. Open a Linux terminal and press CTRL+T
  4. mkdir .gs
  5. cd .gs/
  6. curl -o sdk.sh sdk.cloud.google.com
  7. chmod +x *;./sdk.sh (enter the path of PWD)
  8. cd google-cloud-sdk/bin
  9. ./gcloud auth login --no-launch-browser
  10. ./gcloud cloud-shell ssh
  11. sudo nano /etc/bash.bashrc
  12. alias gshell='~/.gs/google-cloud-sdk/bin/gcloud cloud-shell ssh'
  13. gshell
  14.  
  15. _________________Step By Step
  16. Setting Up Google Cloud Shell on Linux via Command Line
  17.  
  18. 1. Create Directory for Google Shell:
  19. mkdir ~/.gs && cd ~/.gs
  20.  
  21.  
  22. 2. Download and Install Google Cloud SDK:
  23. curl -o sdk.sh sdk.cloud.google.com
  24. chmod +x sdk.sh && ./sdk.sh --install-dir=~/.gs
  25.  
  26.  
  27. 3. Authenticate with Google Cloud:
  28. cd <path>/google-cloud-sdk/bin
  29. ./gcloud auth login --no-launch-browser
  30.  
  31.  
  32. 4. Access Google Cloud Shell:
  33. ./gcloud cloud-shell ssh
  34.  
  35.  
  36. 5. Set Up Alias (Optional):
  37. sudo nano /etc/bash.bashrc
  38. alias gshell='~/.gs/google-cloud-sdk/bin/gcloud cloud-shell ssh'
  39. source /etc/bash.bashrc
  40.  
  41.  
  42. 6. Usage:
  43. gshell
  44.  
  45.  
  46. Additional Notes:
  47. - Update SDK:
  48. gcloud components update
  49.  
  50. - Documentation: Google Cloud SDK Docs: https://cloud.google.com/sdk/docs
  51.  
  52. ____________________________________________________________________________________
  53. # Set Unset Project ID in google-shell
  54. # Set your gshell project_ID
  55. gcloud config set project my-project-name
  56.  
  57. # Verify
  58. gcloud config get-value project
  59.  
  60. # Login with project_ID
  61. alias gshell='~/.gs/google-cloud-sdk/bin/gcloud cloud-shell ssh --project=my-project-name'
  62.  
  63. # Unset project_id
  64. ./gcloud config unset core/project
  65.  
  66. # Login script update
  67. alias gshell='~/.gs/google-cloud-sdk/bin/gcloud cloud-shell ssh'
  68. _____________________________________________________________________________________
  69. # share files from Local to cloud
  70.  
  71.  
  72.  
  73.  
  74.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement