CareerByteCode
ByteBlogby CareerByteCode

Linux for Cloud Beginners: 50 Commands on a Free VM

What you build: a free e2-micro Linux VM where you practise 50 everyday commands for files, text, permissions, processes, network and packages, in your own Google Cloud account. Every step tested.

Linux for Cloud Beginners: 50 Commands on a Free VM

✍️ Translate this blog into Hindi, Tamil or Telugu

In this lab you get your own Linux server on Google Cloud, for free, and practise 50 everyday commands on it: moving around, working with files, reading logs, permissions, processes, the network, installing software, services and archives. Every command comes with the real output we got and one line on what it is for. You finish by deleting the server.

Who it is for: absolute beginners to Linux who want to work in cloud, DevOps or support roles. No Linux experience needed. Time: about 1.5 to 2 hours (go slowly, type every command yourself). Cost: free tier (one e2-micro VM in us-east1, us-west1 or us-central1 with a 30 GB standard disk is free every month; the public IP of the VM costs a few paise an hour while it runs).

Every command below was run for real by the CareerByteCode Team on a fresh Debian 12 VM, and every output and screenshot is the real result we got. To record the outputs exactly, we sent each group of commands to the VM as a small file and ran it with bash, which printed each command (after $ ) before its output. You simply type the commands one by one after you log in.

🧪⭐ Recommended by CareerByteCode · ByteLabs project bundleCloud and DevOps Realtime Starterโ‚น499Build the projects →

Part A: Linux in plain English

Linux is the operating system on most cloud servers. You talk to it by typing commands in a shell (here bash). A command is a small program: you type its name, some options (like -l) and some arguments (like a file name), and press Enter.

Where Linux commands act
Files, text, permissions, processes, network and packages, with the commands for each

Six ideas you will use in this lab:

  • Home folder: your own folder, /home/your-name, written ~ for short. Real-life example: your own desk in a shared office.
  • Path: where a file lives. /etc/os-release starts at the top (/); notes/hello.txt starts from where you are now.
  • Pipe |: sends the output of one command into the next. cut ... | sort | uniq -c is three small tools working like a factory line.
  • Redirect > and >>: > writes output to a file (replacing it), >> adds to the end.
  • Permissions: every file has an owner and rules for read (r), write (w) and run (x). Real-life example: a cupboard that everyone can open but only the owner can lock.
  • sudo: run one command as the administrator (root). On Google Cloud VMs your account may use sudo. Use it only when needed.

Before you start

  1. A Google Cloud account (the free trial works) and a project with billing linked. If you are new, do our tested lab "Google Cloud for Absolute Beginners" first (find it on ByteBlog), or create a project at https://console.cloud.google.com/projectcreate.
  2. Open Cloud Shell (the >_ icon at the top right of the Google Cloud console).
  3. Save your project id in a variable. Replace the text in quotes with your own project id:
export PROJECT_ID="your-project-id"

Part B: get your free Linux server

Step 1: create a free e2-micro VM

Why: e2-micro is the free size, debian-12 is a popular, stable Linux, and a 10 GB standard disk fits the free 30 GB. The firewall rule allows SSH only from Google's IAP range (35.235.240.0/20), so only signed-in people with permission can log in.

gcloud config set project $PROJECT_ID
gcloud services enable compute.googleapis.com iap.googleapis.com
gcloud compute instances create linux-lab --zone=us-east1-b --machine-type=e2-micro \
  --image-family=debian-12 --image-project=debian-cloud --boot-disk-size=10GB --boot-disk-type=pd-standard
gcloud compute firewall-rules create linux-lab-ssh-from-iap --network=default --direction=INGRESS \
  --allow=tcp:22 --source-ranges=35.235.240.0/20 --format="value(name)"
Updated property [core/project].
Operation "operations/acat.p2-PROJECT_NUMBER-a2932d0d-55e6-4899-ae96-28397c185c22" finished successfully.
WARNING: You have selected a disk size of under [200GB]. This may result in poor I/O performance. For more information, see: https://developers.google.com/compute/docs/disks#performance.
Created [https://www.googleapis.com/compute/v1/projects/your-project-id/zones/us-east1-b/instances/linux-lab].
NAME       ZONE        MACHINE_TYPE  PREEMPTIBLE  INTERNAL_IP  EXTERNAL_IP    STATUS
linux-lab  us-east1-b  e2-micro                   10.142.0.7   EXTERNAL_IP  RUNNING
Creating firewall...
..Created [https://www.googleapis.com/compute/v1/projects/your-project-id/global/firewalls/linux-lab-ssh-from-iap].
done.
linux-lab-ssh-from-iap

Step 2: log in with SSH

Why: gcloud compute ssh makes an SSH key for you, puts it on the VM and connects through IAP. A new VM takes about half a minute to accept SSH, so the until line tries every 10 seconds until it can connect. When you run it without --command, you get an interactive shell on the VM: that is where you type everything below.

until gcloud compute ssh linux-lab --zone=us-east1-b --tunnel-through-iap --command="echo connected to \$(hostname)" 2>/dev/null | grep -q connected; do sleep 10; done
gcloud compute ssh linux-lab --zone=us-east1-b --tunnel-through-iap --command="echo connected to \$(hostname)"
connected to linux-lab
Create the VM and log in
Steps 1 and 2: linux-lab is RUNNING, the SSH rule is created, SSH works

From here on, log in with gcloud compute ssh linux-lab --zone=us-east1-b --tunnel-through-iap and type each group of commands.

Part C: 50 commands, in 10 small groups

Group 1: where am I, who am I, what is here?

pwd
whoami
hostname
date -u
uname -sr
cat /etc/os-release | head -2
ls
ls -la
$ pwd
/home/you
$ whoami
you
$ hostname
linux-lab
$ date -u
Wed Nov 18 07:37:58 UTC 2026
$ uname -sr
Linux 6.1.0-56-cloud-amd64
$ cat /etc/os-release | head -2
PRETTY_NAME="Debian GNU/Linux 12 (bookworm)"
NAME="Debian GNU/Linux"
$ ls
groups
$ ls -la
total 28
drwxr-xr-x 4 you you 4096 Nov 18 07:37 .
drwxr-xr-x 3 root           root           4096 Nov 18 07:36 ..
-rw-r--r-- 1 you you  220 May  7  2026 .bash_logout
-rw-r--r-- 1 you you 3526 May  7  2026 .bashrc
-rw-r--r-- 1 you you  807 May  7  2026 .profile
drwx------ 2 you you 4096 Nov 18 07:36 .ssh
drwxr-xr-x 2 you you 4096 Nov 18 07:37 groups
Group 1
Group 1: the home folder, the user, the server name, the time, Linux 6.1 on Debian 12, and hidden files
  • pwd (print working directory): the folder you are in now. whoami: your user name. hostname: the server's name.
  • date -u: the time in UTC (servers usually run in UTC). uname -sr: the kernel name and version.
  • cat prints a file; head -2 keeps the first 2 lines. /etc/os-release says which Linux this is.
  • ls lists files; ls -la shows all files (including hidden ones that start with a dot) in a long format: permissions, owner, size, date.

Group 2: make, copy, move and delete files

mkdir -p practice/notes
cd practice
touch empty.txt
echo "Linux is fun" > hello.txt
echo "Cloud is fun too" >> hello.txt
cat hello.txt
cp hello.txt copy.txt
mv copy.txt notes/hello-copy.txt
rm empty.txt
ls -l . notes
$ mkdir -p practice/notes
$ cd practice
$ touch empty.txt
$ echo "Linux is fun" > hello.txt
$ echo "Cloud is fun too" >> hello.txt
$ cat hello.txt
Linux is fun
Cloud is fun too
$ cp hello.txt copy.txt
$ mv copy.txt notes/hello-copy.txt
$ rm empty.txt
$ ls -l . notes
.:
total 8
-rw-r--r-- 1 you you   30 Nov 18 07:38 hello.txt
drwxr-xr-x 2 you you 4096 Nov 18 07:38 notes

notes:
total 4
-rw-r--r-- 1 you you 30 Nov 18 07:38 hello-copy.txt
Group 2
Group 2: a folder, a file with two lines, a copy moved into notes, an empty file deleted
  • mkdir -p makes a folder (and its parents). cd changes folder. touch makes an empty file.
  • echo "..." > file writes a line; >> adds a line. cp copies, mv moves or renames, rm deletes (there is no recycle bin, so check twice).

Group 3: read and search text

Why: logs are text. These tools answer real questions in seconds: how many errors, from which server, on which page?

cd practice
printf "web-01 200 /home\nweb-02 500 /checkout\nweb-01 200 /courses\nweb-03 404 /old\nweb-02 500 /checkout\nweb-01 200 /home\n" > access.log
head -n 3 access.log
tail -n 2 access.log
wc -l access.log
grep 500 access.log
grep -c 200 access.log
cut -d " " -f 1 access.log | sort | uniq -c
sort -k3 access.log | nl
find ~ -name "*.txt"
diff hello.txt notes/hello-copy.txt && echo "the files are the same"
$ cd practice
$ printf "web-01 200 /home\nweb-02 500 /checkout\nweb-01 200 /courses\nweb-03 404 /old\nweb-02 500 /checkout\nweb-01 200 /home\n" > access.log
$ head -n 3 access.log
web-01 200 /home
web-02 500 /checkout
web-01 200 /courses
$ tail -n 2 access.log
web-02 500 /checkout
web-01 200 /home
$ wc -l access.log
6 access.log
$ grep 500 access.log
web-02 500 /checkout
web-02 500 /checkout
$ grep -c 200 access.log
3
$ cut -d " " -f 1 access.log | sort | uniq -c
      3 web-01
      2 web-02
      1 web-03
$ sort -k3 access.log | nl
     1	web-02 500 /checkout
     2	web-02 500 /checkout
     3	web-01 200 /courses
     4	web-01 200 /home
     5	web-01 200 /home
     6	web-03 404 /old
$ find ~ -name "*.txt"
/home/you/practice/hello.txt
/home/you/practice/notes/hello-copy.txt
/home/you/groups/g9.txt
/home/you/groups/g1.txt
/home/you/groups/g7.txt
/home/you/groups/g2.txt
/home/you/groups/g4.txt
/home/you/groups/g3.txt
/home/you/groups/g6.txt
/home/you/groups/g8.txt
/home/you/groups/g5.txt
$ diff hello.txt notes/hello-copy.txt && echo "the files are the same"
the files are the same
Group 3
Group 3: first and last lines, line count, the errors, requests per server, sorted and numbered lines
  • printf writes text with \n as new lines. head and tail show the start and the end (use tail -f to follow a live log).
  • wc -l counts lines. grep 500 keeps lines with "500"; grep -c counts them.
  • cut -d " " -f 1 takes the first column, sort sorts, uniq -c counts repeats: web-01 had 3 requests.
  • sort -k3 sorts by the 3rd column, nl numbers the lines. find searches for files by name. diff compares two files and prints nothing when they are the same.

Group 4: permissions and sudo

cd practice
printf '#!/bin/bash\necho "Hello from a script on $(hostname)"\n' > hi.sh
ls -l hi.sh
chmod +x hi.sh
ls -l hi.sh
./hi.sh
id
sudo whoami
$ cd practice
$ printf '#!/bin/bash\necho "Hello from a script on $(hostname)"\n' > hi.sh
$ ls -l hi.sh
-rw-r--r-- 1 you you 54 Nov 18 07:38 hi.sh
$ chmod +x hi.sh
$ ls -l hi.sh
-rwxr-xr-x 1 you you 54 Nov 18 07:38 hi.sh
$ ./hi.sh
Hello from a script on linux-lab
$ id
uid=1000(you) gid=1003(you) groups=1003(you),4(adm),30(dip),44(video),46(plugdev),1000(google-sudoers),1001(docker),1002(lxd)
$ sudo whoami
root
Group 4
Group 4: rw-r--r-- becomes rwxr-xr-x after chmod +x, and the script runs
  • -rw-r--r-- means: the owner can read and write, everyone else can only read. chmod +x adds run permission: -rwxr-xr-x.
  • ./hi.sh runs the script in this folder. id shows your user and groups (google-sudoers is why you may use sudo). sudo whoami answers root.

Break it and fix it: permission denied

/etc holds system settings, and only root may write there. Watch what happens without and with sudo:

cd practice
echo "not allowed" > /etc/cbc-test.conf
echo "allowed with sudo" | sudo tee /etc/cbc-test.conf
ls -l /etc/cbc-test.conf
sudo rm /etc/cbc-test.conf
$ cd practice
$ echo "not allowed" > /etc/cbc-test.conf
groups/g5.run: line 5: /etc/cbc-test.conf: Permission denied
$ echo "allowed with sudo" | sudo tee /etc/cbc-test.conf
allowed with sudo
$ ls -l /etc/cbc-test.conf
-rw-r--r-- 1 root root 18 Nov 18 07:38 /etc/cbc-test.conf
$ sudo rm /etc/cbc-test.conf
Break it and fix it
Permission denied for a normal user; sudo tee writes the file as root

**Why sudo echo "x" > file would not work either:** the > is done by your shell before sudo runs. tee is a command that writes to a file, so sudo tee writes as root. This is one of the most common beginner surprises.

Group 6: memory, disk and processes

uptime
free -h
df -h /
du -sh ~/practice
ps aux --sort=-%mem | head -5
sleep 300 &
pgrep -a sleep
pkill sleep && echo "sleep stopped"
top -bn1 | head -5
$ uptime
 07:38:52 up 2 min,  0 user,  load average: 0.16, 0.15, 0.06
$ free -h
               total        used        free      shared  buff/cache   available
Mem:           969Mi       337Mi       452Mi       468Ki       313Mi       631Mi
Swap:             0B          0B          0B
$ df -h /
Filesystem      Size  Used Avail Use% Mounted on
/dev/sda1       9.7G  2.1G  7.1G  23% /
$ du -sh ~/practice
24K	/home/you/practice
$ ps aux --sort=-%mem | head -5
USER         PID %CPU %MEM    VSZ   RSS TTY      STAT START   TIME COMMAND
root         449  0.2  5.9 1290456 59328 ?       Ssl  07:36   0:00 /usr/bin/google_osconfig_agent
root         433  0.2  2.7 1279016 27808 ?       Ssl  07:36   0:00 /usr/bin/google_guest_agent_manager
root         469  0.4  2.7 1280352 27804 ?       Sl   07:36   0:00 /usr/lib/google/guest_agent/GuestAgentCorePlugin/core_plugin --protocol=unix --address=/run/google-guest-agent/plugin-connections/GuestAgentCorePlugin_20261021.00.sock --errorlogfile=/var/lib/google-guest-agent/9117681987171183488/agent_state/plugins/GuestAgentCorePlugin/plugin.log
root         480  0.0  2.7 1278196 27312 ?       Sl   07:36   0:00 /usr/lib/google/guest_agent/ManagedWorkloadIdentityExtension/mwlid_extension --protocol=unix --address=/run/google-guest-agent/plugin-connections/ManagedWorkloadIdentityExtension_1.0.sock --errorlogfile=/var/lib/google-guest-agent/9117681987171183488/agent_state/plugins/ManagedWorkloadIdentityExtension/plugin.log
$ sleep 300 &
$ pgrep -a sleep
1288 sleep 300
$ pkill sleep && echo "sleep stopped"
sleep stopped
$ top -bn1 | head -5
top - 07:38:52 up 2 min,  0 user,  load average: 0.30, 0.18, 0.07
Tasks:  95 total,   1 running,  94 sleeping,   0 stopped,   0 zombie
%Cpu(s):  0.0 us,  0.0 sy,  0.0 ni,100.0 id,  0.0 wa,  0.0 hi,  0.0 si,  0.0 st 
MiB Mem :    969.9 total,    451.4 free,    338.8 used,    314.0 buff/cache     
MiB Swap:      0.0 total,      0.0 free,      0.0 used.    631.2 avail Mem
Group 6
Group 6: uptime, about 1 GB of memory, a 9.7 GB disk, the biggest processes, and a process started and stopped
  • uptime: how long the server has run and the load. free -h: memory in human units (969 MiB on e2-micro). df -h /: disk space. du -sh: the size of one folder.
  • ps aux --sort=-%mem: every process, biggest memory first (here Google's guest agents). sleep 300 & starts a process in the background; pgrep -a finds it; pkill stops it.
  • top -bn1: one snapshot of top, the live process view (run plain top and press q to quit).

Group 7: the network

ip -brief address
ss -tln
getent hosts metadata.google.internal
curl -s -H "Metadata-Flavor: Google" http://metadata.google.internal/computeMetadata/v1/instance/zone; echo
curl -s -o /dev/null -w "deb.debian.org answered HTTP %{http_code}\n" https://deb.debian.org/
$ ip -brief address
lo               UNKNOWN        127.0.0.1/8 ::1/128 
ens4             UP             10.142.0.7/32 metric 100 fe80::4001:aff:fe8e:7/64 
$ ss -tln
State  Recv-Q Send-Q Local Address:Port Peer Address:PortProcess
LISTEN 0      4096      127.0.0.54:53        0.0.0.0:*          
LISTEN 0      4096   127.0.0.53%lo:53        0.0.0.0:*          
LISTEN 0      20         127.0.0.1:25        0.0.0.0:*          
LISTEN 0      128          0.0.0.0:22        0.0.0.0:*          
LISTEN 0      4096         0.0.0.0:5355      0.0.0.0:*          
LISTEN 0      20             [::1]:25           [::]:*          
LISTEN 0      128             [::]:22           [::]:*          
LISTEN 0      4096            [::]:5355         [::]:*          
$ getent hosts metadata.google.internal
EXTERNAL_IP metadata.google.internal
$ curl -s -H "Metadata-Flavor: Google" http://metadata.google.internal/computeMetadata/v1/instance/zone; echo
projects/PROJECT_NUMBER/zones/us-east1-b
$ curl -s -o /dev/null -w "deb.debian.org answered HTTP %{http_code}\n" https://deb.debian.org/
deb.debian.org answered HTTP 200
🎓⭐ Recommended by CareerByteCode · Live trainingCloud & DevOps Live Cohort Internshipโ‚น2,360See the training →
Group 7
Group 7: the private IP, the open ports, the metadata server and a web request
  • ip -brief address: the network cards and IPs (ens4 has the private IP). ss -tln: programs listening on TCP ports, as numbers (22 is SSH).
  • getent hosts: look up a name. curl: talk to a web address. Every Google Cloud VM can ask the metadata server about itself, for example its zone.

Group 8: install a package

tree --version
sudo apt-get update -qq
sudo apt-get install -y -qq tree > /dev/null && echo "tree installed"
tree ~/practice
which tree
$ tree --version
groups/g8.run: line 3: tree: command not found
$ sudo apt-get update -qq
$ sudo apt-get install -y -qq tree > /dev/null && echo "tree installed"
debconf: unable to initialize frontend: Dialog
debconf: (Dialog frontend will not work on a dumb terminal, an emacs shell buffer, or without a controlling terminal.)
debconf: falling back to frontend: Readline
debconf: unable to initialize frontend: Readline
debconf: (Can't locate Term/ReadLine.pm in @INC (you may need to install the Term::ReadLine module) (@INC contains: /etc/perl /usr/local/lib/x86_64-linux-gnu/perl/5.36.0 /usr/local/share/perl/5.36.0 /usr/lib/x86_64-linux-gnu/perl5/5.36 /usr/share/perl5 /usr/lib/x86_64-linux-gnu/perl-base /usr/lib/x86_64-linux-gnu/perl/5.36 /usr/share/perl/5.36 /usr/local/lib/site_perl) at /usr/share/perl5/Debconf/FrontEnd/Readline.pm line 7, <> line 1.)
debconf: falling back to frontend: Teletype
dpkg-preconfigure: unable to re-open stdin: 
tree installed
$ tree ~/practice
/home/you/practice
โ”œโ”€โ”€ access.log
โ”œโ”€โ”€ hello.txt
โ”œโ”€โ”€ hi.sh
โ””โ”€โ”€ notes
    โ””โ”€โ”€ hello-copy.txt

2 directories, 4 files
$ which tree
/usr/bin/tree
Group 8
Group 8: command not found, then apt-get installs tree and it draws the folder
  • command not found means the program is not installed. apt-get update refreshes the list of packages; apt-get install -y installs without asking.
  • The debconf: unable to initialize frontend lines are harmless: the installer wanted a screen to ask questions and fell back to plain text, because we ran it from a file. You will not see them when you type the command yourself (or add DEBIAN_FRONTEND=noninteractive in scripts).
  • tree draws folders as a tree; which shows where a program lives.
systemctl is-active ssh
systemctl status ssh --no-pager | head -4
sudo journalctl -u ssh -n 3 --no-pager
tar -czf practice.tar.gz practice
tar -tzf practice.tar.gz
echo $PATH
type cd ls
$ systemctl is-active ssh
active
$ systemctl status ssh --no-pager | head -4
โ— ssh.service - OpenBSD Secure Shell server
     Loaded: loaded (/lib/systemd/system/ssh.service; enabled; preset: enabled)
     Active: active (running) since Wed 2026-11-18 07:36:47 UTC; 2min 37s ago
       Docs: man:sshd(8)
$ sudo journalctl -u ssh -n 3 --no-pager
Nov 18 07:39:24 linux-lab sshd[1677]: Accepted publickey for you from EXTERNAL_IP port 33851 ssh2: RSA SHA256:sM8QxKzHrEH6um1e3HuedmkMZZjpvqwcPb+Q+aPZ75w
Nov 18 07:39:24 linux-lab sshd[1677]: pam_unix(sshd:session): session opened for user you(uid=1000) by (uid=0)
Nov 18 07:39:24 linux-lab sshd[1677]: pam_env(sshd:session): deprecated reading of user environment enabled
$ tar -czf practice.tar.gz practice
$ tar -tzf practice.tar.gz
practice/
practice/hi.sh
practice/hello.txt
practice/access.log
practice/notes/
practice/notes/hello-copy.txt
$ echo $PATH
/usr/local/bin:/usr/bin:/bin:/usr/games
$ type cd ls
cd is a shell builtin
ls is /usr/bin/ls

We ran Group 10 a little later on a fresh copy of the same VM:

mkdir -p demo && cd demo
echo "version 1" > app.conf
ln -s app.conf current.conf
ls -l
stat -c "%n is %s bytes, changed %y" app.conf
sha256sum app.conf
env | grep -E "^(HOME|SHELL|USER)=" | sort
$ mkdir -p demo && cd demo
$ echo "version 1" > app.conf
$ ln -s app.conf current.conf
$ ls -l
total 4
-rw-r--r-- 1 you you 10 Nov 18 07:44 app.conf
lrwxrwxrwx 1 you you  8 Nov 18 07:44 current.conf -> app.conf
$ stat -c "%n is %s bytes, changed %y" app.conf
app.conf is 10 bytes, changed 2026-11-18 07:44:55.228041560 +0000
$ sha256sum app.conf
3a79bf37b571938d1f2907afb6a643f48088b83769dde8bc58f5ee866a5c3636  app.conf
$ env | grep -E "^(HOME|SHELL|USER)=" | sort
HOME=/home/you
SHELL=/bin/bash
USER=you
Groups 9 and 10
Groups 9 and 10: the SSH service, its log, a tar archive, a link, a checksum and environment variables
  • systemctl starts, stops and checks services (programs that run all the time, like SSH). journalctl -u ssh reads that service's log: you can see your own login.
  • tar -czf packs and compresses a folder; tar -tzf lists what is inside. echo $PATH shows where the shell looks for programs; type says what a command is.
  • ln -s makes a shortcut (symbolic link): current.conf -> app.conf. stat shows file details. sha256sum gives a fingerprint that changes if one byte changes, used to check downloads. env lists environment variables.

POC: your 50 commands

You ran these 53 different commands on a real cloud server: pwd, whoami, hostname, date, uname, cat, head, ls, mkdir, cd, touch, echo, cp, mv, rm, printf, tail, wc, grep, cut, sort, uniq, nl, find, diff, chmod, id, sudo, tee, uptime, free, df, du, ps, sleep, pgrep, pkill, top, ip, ss, getent, curl, apt-get, tree, which, systemctl, journalctl, tar, type, ln, stat, sha256sum and env, plus the pipe |, redirects > and >>, and & for background jobs. The outputs above are the proof that each one worked.

Clean up (delete everything)

Why: delete the VM (its disk goes with it) and the SSH rule. Run this in Cloud Shell, not inside the VM.

gcloud compute instances delete linux-lab --zone=us-east1-b --quiet 2>&1 | tail -1
gcloud compute firewall-rules delete linux-lab-ssh-from-iap --quiet 2>&1 | tail -1
echo "VMs left: $(gcloud compute instances list --format="value(name)" | wc -l)"
echo "lab firewall rules left: $(gcloud compute firewall-rules list --filter="name=linux-lab-ssh-from-iap" --format="value(name)" | wc -l)"
Deleted [https://www.googleapis.com/compute/v1/projects/your-project-id/zones/us-east1-b/instances/linux-lab].
Deleted [https://www.googleapis.com/compute/v1/projects/your-project-id/global/firewalls/linux-lab-ssh-from-iap].
VMs left: 1
lab firewall rules left: 0

Because we ran other labs at the same time, VMs left: 1 above was another lab's VM. When all of them had finished, we checked again:

echo "VMs left: $(gcloud compute instances list --format="value(name)" | wc -l)"
echo "disks left: $(gcloud compute disks list --format="value(name)" | wc -l)"
echo "firewall rules left (besides the default ones): $(gcloud compute firewall-rules list --format="value(name)" | grep -vc "^default-")"
VMs left: 0
disks left: 0
firewall rules left (besides the default ones): 0

VMs left: 0, disks left: 0 and no extra firewall rules are your proof.

FAQ

Do I need to remember all 50? No. Use them every day for a week and you will remember 30 without trying. For the rest, man command (for example man grep) opens the manual; press q to quit.

Is Cloud Shell Linux too? Yes, a small Debian VM. You can practise most of these commands there, but a VM of your own lets you use sudo, services and packages freely.

**What is the difference between rm and moving to a recycle bin?** rm deletes at once. On servers, be careful with rm -r (folders) and never run rm -rf / or anything you do not fully understand.

**Why sudo and not log in as root?** sudo runs only one command as root and logs it. Working as root all the time makes mistakes much more dangerous.

**What is the difference between apt and apt-get?** Both install packages on Debian and Ubuntu. apt is nicer to type; apt-get is steadier for scripts, which is why we used it.

**Why does ls -l show my user name twice?** The first is the owner, the second is the group. Each user has a group of the same name by default.

Does the VM keep costing when I am not logged in? Yes, while it is RUNNING. Stop it (gcloud compute instances stop) or delete it when you are done.

Troubleshooting

You seeWhyFix
Permission denied when writing a fileYou are not the ownerWrite in your home folder, or use sudo tee for system files
command not foundThe program is not installed, or a typosudo apt-get install -y <name>, or check the spelling
No such file or directoryWrong path or wrong folderpwd and ls to see where you are
SSH hangs or says failed to connect to backendNo firewall rule for IAP, or the VM is still startingCreate the rule from Step 1 and wait 30 seconds
E: Unable to locate packageThe package list is oldsudo apt-get update first
Operation not permitted with sudoYour account is not in google-sudoersAsk for the Compute OS Admin Login role, or use the VM owner account

What next

Prepared by the CareerByteCode Team from our tested lab, with AI help for the write-up.

Read next →Nginx for Beginners: Web Server, Reverse Proxy and HTTPS⏱ 16 min

⭐ Keep learning with CareerByteCode

Hand-picked to go deeper on this topic
News, guides and updates from the CareerByteCode team
🏅 Contributor writer

The CareerByteCode team writes about what is new on careerbytecode.in: courses, labs, exams, events and the community, which is free to join for influencers and content creators in tech.

Get CareerByteCode Team's next blog by email

One email a week when they publish. Add the weekly Best of ByteBlog too. No spam, unsubscribe with one click.

We email you once to confirm. By subscribing you agree to the privacy policy.

💬 Comments (0)

Top · Newest

Sign in to comment

Related blogs

🧪⭐ Recommended by CareerByteCode · ByteLabs project bundleCloud and DevOps Realtime Starterโ‚น499Build the projects →