Linux & Terminal Mastery
Set up a Linux environment on Windows and write your first bash automation script.
Introduction
30 Second Summary
Every cloud server you'll ever manage runs Linux. Every Docker container, every AWS instance, every CI/CD pipeline. If you can't navigate a Linux terminal, you can't do cloud engineering.
In this project, you will set up a real Linux environment on your Windows machine, learn the commands cloud engineers use daily, and write a bash script that automates a server health check.
What You'll Build
A complete Linux cloud engineering workspace with a working automation script that checks system health and generates a report.
By the end of this project, you'll have:
- WSL2 + Ubuntu installed and configured, giving you a real Linux terminal on your Windows machine.
- A cloud-tools/ workspace with organized folders for scripts, logs, and notes.
- A health-check.sh bash script that monitors CPU, memory, and disk usage on your system.
- Secret Mission: Extend your health check script with network monitoring, colored output, and persistent logging.
Are there any prerequisites?
None. You just need a Windows machine (Windows 10 version 2004 or higher, or Windows 11). This project walks you through installing everything from scratch.
Before We Start
Before We Start...
Install WSL2 and Ubuntu
Every cloud server, every Docker container, and every CI/CD pipeline runs on Linux. To work with these systems, you need a Linux terminal on your own machine.
WSL2 (Windows Subsystem for Linux) gives you a full Linux environment inside Windows with near-native performance. In this step, you'll install WSL2 with Ubuntu, create your Linux user account, and verify everything is running correctly.
In this step, get ready to:
- Install WSL2 with Ubuntu on your Windows machine.
- Create your Linux username and password.
- Verify your setup and connect VS Code to WSL.
Open PowerShell as administrator and install WSL2
WSL2 requires a single command to install, but it must be run with administrator privileges. This command enables the Virtual Machine Platform, downloads the Linux kernel, and installs Ubuntu all at once.
What is WSL2?
WSL2 stands for Windows Subsystem for Linux version 2. It runs a real Linux kernel inside a lightweight virtual machine managed by Windows.
This gives you full Linux compatibility without needing to dual-boot or run a heavy VM. It requires Windows 10 version 2004 (Build 19041) or higher, or Windows 11.
- Press the Windows key to open your search bar.
- Type PowerShell in the search bar.
- Right-click Windows PowerShell in the results.
- Select Run as administrator.
- Click Yes if a User Account Control prompt appears.
- Install WSL2 and Ubuntu by running this command in the administrator PowerShell window:
wsl --install
What does this command do?
The wsl --install command does four things in one step:
- Enables the WSL and Virtual Machine Platform components.
- Downloads and installs the latest Linux kernel.
- Sets WSL 2 as the default version.
- Downloads and installs the Ubuntu distribution.
- Wait for the installation to complete. You will see progress messages as components are downloaded and enabled.
- Restart your machine when prompted. The restart is required to finish enabling the Virtual Machine Platform.
Seeing an error about Windows version?
The wsl --install command requires Windows 10 version 2004 (Build 19041) or higher, or Windows 11. If you see an error, check your Windows version by pressing Windows + R, typing winver, and pressing Enter.
If your build number is below 19041, you need to update Windows before proceeding. Open Settings, select Update & Security, and install all available updates.
Help me fix my WSL installation error
Create your Linux username and password
After your machine restarts, Ubuntu launches automatically and asks you to create a Linux user account. This account is separate from your Windows login.
- Wait for Ubuntu to finish its initial setup. You will see a message asking you to create a new UNIX username.
- Type a username (lowercase, no spaces) and press Enter.
- Type a password and press Enter. The characters will not appear on screen as you type.
- Re-type the same password to confirm and press Enter.
Why can't I see my password?
Linux hides password characters as a security feature. Even though nothing appears on screen, your keystrokes are being recorded. Just type carefully and press Enter.
Now that your user account is ready, update your system packages to make sure everything is current.
- Update your Ubuntu packages by running this command:
sudo apt update && sudo apt upgrade -y
What does this command do?
This is actually two commands joined with && (which means "run the second command only if the first succeeds"):
- sudo apt update refreshes the list of available packages from Ubuntu's servers.
- sudo apt upgrade -y installs all available updates. The -y flag automatically answers "yes" to confirmation prompts.
- Wait for the update to finish. You will see a list of packages being downloaded and installed. This may take a minute or two.
Update command failing?
If you see a "Could not resolve host" error, check your internet connection. WSL uses your Windows network settings, so if Windows can browse the web, WSL should be able to download packages.
If you're asked for a password, enter the Linux password you just created (not your Windows password).
Help me fix my package update error
Verify your WSL2 installation
You've installed WSL and Ubuntu, but you need to confirm that Ubuntu is running under WSL version 2 (not version 1). You also need to connect VS Code to your new Linux environment.
- Open a new PowerShell window (you do not need administrator mode this time).
- Check your WSL installation by running this command:
wsl -l -v
You should see output showing your installed distributions, their state, and their WSL version number.
✔️ I see Ubuntu with VERSION 2
Your output looks something like this:
NAME STATE VERSION
* Ubuntu Running 2
Ubuntu is installed and running under WSL 2. You're all set to continue.
ⓧ I see VERSION 1 instead of 2
If Ubuntu shows VERSION 1, you need to convert it to version 2.
- Convert your Ubuntu distribution to WSL 2 by running this command in PowerShell:
wsl --set-version Ubuntu 2
- Wait for the conversion to complete. This may take a few minutes.
- Run wsl -l -v again to confirm Ubuntu now shows VERSION 2.
ⓧ I see an error or no distributions listed
If the command is not recognized or no distributions appear, the installation may not have completed successfully.
- Try restarting your machine one more time.
- After restart, open PowerShell as administrator and run:
wsl --install
If the issue persists, your Windows version may not support WSL2. Check your build number with winver and confirm it is 19041 or higher.
Help me fix my WSL installation
Now connect VS Code to your WSL environment so you can edit Linux files directly from your editor.
- Press the Windows key to open your search bar.
- Type VS Code and press Enter to open it.
- Open the Extensions view by pressing Ctrl+Shift+X.
- Type WSL in the search bar at the top of the Extensions panel.
- Find the extension called WSL published by Microsoft.
- Click Install.
Why install the WSL extension?
The WSL extension lets VS Code open folders and files directly inside your Linux environment. Without it, you would have to switch between Windows tools and the Linux terminal constantly.
With this extension, your editor runs on Windows but all file operations, terminals, and extensions execute inside WSL. You get the best of both worlds.
- Confirm the extension is installed by checking that the Install button has changed to a gear icon.
Your Linux environment is ready. Next up, you'll learn to navigate the Linux file system and build your workspace.
Navigate the Linux File System
Your Linux environment is up and running. Now it's time to learn how to move around inside it.
The Linux file system is organized like a tree with a single root directory at the top. Every cloud server you'll manage uses this same layout, so understanding how to navigate it is essential for any cloud engineering work.
In this step, get ready to:
- Explore key Linux directories to understand how the system is organized.
- Create a workspace folder structure for your cloud engineering projects.
- Create, read, copy, and search files from the command line.
Explore your system with navigation commands
Before you build anything, you need to know where you are and how to look around. Three commands form the foundation of all Linux navigation.
- In your Ubuntu terminal, check your current location by running this command:
pwd
You should see something like /home/your-username. This is your home directory.
- See all the files and folders in your current directory (including hidden ones) by running:
ls -la
What does ls -la show?
The ls command lists directory contents. The -l flag shows detailed information (permissions, owner, size, date). The -a flag reveals hidden files that start with a dot.
- Move to the root of the entire file system by running:
cd /
- List the contents of the root directory by running:
ls
You should see directories like bin, etc, home, var, and tmp. Every Linux system has this same structure.
- Explore a few key directories by running these commands one at a time:
ls /etc
ls /var/log
ls /home
ls /tmp
What are these directories?
- /etc holds system configuration files. When you configure a service on a cloud server, this is where its settings live.
- /var/log stores system logs. This is the first place cloud engineers look when debugging server issues.
- /home contains user home directories. Your personal files and projects go here.
- /tmp is for temporary files that get cleared on reboot.
- Return to your home directory by running:
cd ~
Create your workspace structure
Cloud engineers keep their projects organized in dedicated workspace folders. You'll create a cloud-tools directory with subdirectories for scripts, logs, and notes.
- Install the tree utility so you can visualize directory structures by running:
sudo apt install tree -y
Seeing a permission denied error?
Make sure you're typing your Linux password when prompted. The sudo command requires your password, and the characters won't appear on screen as you type. This is normal Linux security behavior.
If the install fails with a network error, run sudo apt update first, then try the install command again.
Help me fix my apt install error
- Create your workspace with all three subdirectories in one command by running:
mkdir -p ~/cloud-tools/{scripts,logs,notes}
What does this command do?
This single command creates four directories at once. The -p flag tells mkdir to create parent directories as needed.
The curly braces {scripts,logs,notes} are called brace expansion. Bash expands them into three separate paths: ~/cloud-tools/scripts, ~/cloud-tools/logs, and ~/cloud-tools/notes.
- Verify your workspace was created correctly by running:
ls -la ~/cloud-tools/
You should see scripts, logs, and notes listed as directories.
- Visualize the full structure with the tree command by running:
tree ~/cloud-tools/
You should see a tree diagram showing cloud-tools at the top with three branches underneath it.
- Practice moving between directories by running these commands one at a time:
cd ~/cloud-tools/scripts
cd ..
cd ~
What do these navigation shortcuts mean?
- cd ~/cloud-tools/scripts jumps directly to the scripts folder. The ~ is a shortcut for your home directory.
- cd .. moves up one level to the parent directory.
- cd ~ takes you straight back to your home directory from anywhere.
Work with files
Navigating directories is only half the story. Cloud engineers constantly create, read, copy, and search through files. Let's practice the core file commands.
- Create a new file in your notes folder by running:
touch ~/cloud-tools/notes/day1.txt
- Write some text into the file by running:
echo "I started learning Linux today" > ~/cloud-tools/notes/day1.txt
What does the > symbol do?
The > symbol is called output redirection. It takes the output of echo and writes it into the file instead of printing it to the screen. If the file already has content, > replaces it entirely.
- Read the file contents to confirm your text was saved by running:
cat ~/cloud-tools/notes/day1.txt
You should see I started learning Linux today printed in your terminal.
- Make a backup copy of the file by running:
cp ~/cloud-tools/notes/day1.txt ~/cloud-tools/notes/day1-backup.txt
- Confirm the copy exists by running:
ls ~/cloud-tools/notes/
You should see both day1.txt and day1-backup.txt listed.
- Search inside a file for specific text by running:
grep "Linux" ~/cloud-tools/notes/day1.txt
The grep command finds and highlights the matching text. You should see your line with "Linux" highlighted or returned.
Why is grep important for cloud engineers?
On a real cloud server, log files can be thousands of lines long. The grep command lets you instantly find the one error message in a sea of normal output. You'll use it constantly when debugging.
Not seeing the expected output?
Double-check that you're using straight quotes (") around the text, not curly or smart quotes. Smart quotes from word processors cause errors in the terminal.
If cat shows an empty file, re-run the echo command. Make sure there's a > between the quoted text and the file path.
Help me troubleshoot my file commands
Your workspace is set up and you're navigating the file system with confidence. Next up, you'll learn about permissions and processes, the tools that let you control who can access your files and what's running on your system.
Master Permissions and Processes
You've got a well-organized workspace and can move around the file system with confidence. Now it's time to learn how Linux decides who gets to do what.
On a cloud server, knowing who can access a file and which process is eating all the memory is the difference between a smooth deployment and a 3am incident. This step teaches you to read permissions, monitor system health, and install new tools.
In this step, get ready to:
- Read and change Linux file permissions.
- Monitor running processes and system resources.
- Install packages using the Linux package manager.
Understand file permissions
Every file and folder in Linux has a set of permissions that controls who can read, write, or execute it. These permissions are the first layer of security on any cloud server.
- View the permissions on your workspace by running this command:
ls -la ~/cloud-tools/
You should see a list of your folders with details including a string of letters and dashes in the first column (like drwxr-xr-x). This string is the permission notation.
What do these permission letters mean?
The permission string has three sections after the first character. Each section has three letters representing r (read), w (write), and x (execute).
- The first group of three is for the owner of the file.
- The second group is for the group the file belongs to.
- The third group is for everyone else on the system.
A dash (-) means that permission is turned off. So rwxr-xr-x means the owner can do everything, but the group and everyone else can only read and execute.
- Change the permissions on your scripts folder by running this command:
chmod 755 ~/cloud-tools/scripts
What does 755 mean?
The number 755 is a shorthand for setting permissions. The first digit (7) gives the owner read + write + execute. The second digit (5) gives the group read + execute. The third digit (5) gives everyone else read + execute.
This is the standard permission for scripts you want to run. The owner can edit them, and others can execute but not modify them.
- Confirm the permission change by running:
ls -la ~/cloud-tools/
Look at the scripts row. You should see drwxr-xr-x in the permission column, confirming your change to 755.
Still seeing the old permissions?
Make sure the path is exactly ~/cloud-tools/scripts with no typos. If you see "No such file or directory", double check the folder exists by running ls ~/cloud-tools/.
Help me troubleshoot my chmod permissions issue
Manage processes
When a cloud server slows down, the first thing you do is check what processes are running and how much CPU, memory, and disk they are using. These commands give you that visibility.
- See all running processes by running this command:
ps aux
You should see a table listing every process on your system, including the user running it, the CPU and memory percentage, and the command that started it.
- Open a live process dashboard by running this command:
top
What is top?
The top command opens a live, auto-refreshing view of CPU and memory usage. It's interactive, so your terminal will look different from a normal prompt.
Press q to quit and return to your normal terminal.
- Press q to exit top, then check your disk space by running:
df -h
You should see a table of disk partitions with their size, used space, and available space in human-readable format.
- Check your memory usage by running:
free -m
You should see total, used, and available memory displayed in megabytes.
Why these commands matter on a cloud server
These are the first commands you would run when debugging a slow server. A full disk, maxed-out memory, or a runaway process are the most common causes of outages. Knowing how to read this output quickly is a core cloud engineering skill.
Install and manage packages
Linux uses a package manager to install, update, and remove software. On Ubuntu, that package manager is apt. This is how you install tools on every Linux server in the cloud.
- Install an improved process viewer called htop by running this command:
sudo apt install htop -y
What does this command do?
- sudo runs the command as the administrator (root user).
- apt install tells the package manager to download and install a package.
- htop is the package name.
- -y automatically answers "yes" to the confirmation prompt.
- Verify htop was installed by checking its location:
which htop
You should see a path like /usr/bin/htop printed in your terminal, confirming the tool is installed and ready to use.
Seeing 'Unable to locate package'?
Your package list may be out of date. Run sudo apt update first to refresh the list, then try the install command again.
Help me troubleshoot my apt install failure in WSL2
- Launch htop to see it in action by running:
htop
What does htop show?
Htop is a colourful, interactive process viewer. It shows CPU bars, memory bars, and a sortable list of every running process. It is a more user-friendly alternative to top.
Press q to quit and return to your terminal.
You can now read permissions, monitor processes, and install tools on your Linux system. Next up, you'll combine everything you've learned into your first bash script that automates a real cloud engineering task.
Write Your First Bash Script
You now know how to navigate files, set permissions, and monitor processes. Those are the building blocks.
In this step, you will combine everything into a bash script that automates a real cloud engineering task. The script checks system health (CPU, memory, disk) and generates a formatted report. This is the exact type of automation cloud engineers write on production servers.
In this step, get ready to:
- Create a bash script file and make it executable.
- Write health check logic that reports system resource usage.
- Run the script and save its output to a log file.
Create the script file and make it executable
Before you can run a script, the file needs to exist and Linux needs permission to execute it. You will create the file, grant execute permission, and then open it in VS Code for editing.
- Create the script file and make it executable by running these commands:
touch ~/cloud-tools/scripts/health-check.sh
chmod +x ~/cloud-tools/scripts/health-check.sh
What do these commands do?
- touch creates an empty file at the path you specify.
- chmod +x adds execute permission to the file. Without this, Linux will refuse to run it as a script.
- Confirm the file exists by running:
ls -la ~/cloud-tools/scripts/
You should see health-check.sh listed with an x in its permissions (e.g., -rwxr-xr-x).
- Open the script in VS Code from your WSL terminal by running:
code ~/cloud-tools/scripts/health-check.sh
How does this open VS Code?
The code command launches VS Code from the terminal. Because you have the WSL extension installed, VS Code connects directly to your Linux file system. The file opens in the editor ready to edit.
VS Code should open with an empty health-check.sh file. If this is the first time using the code command from WSL, you may see a brief message about VS Code fetching components.
- Type the following as the very first line of the file:
#!/bin/bash
What is a shebang?
The #!/bin/bash line is called a shebang. It tells Linux which program to use when running this script. Without it, the system would not know to use bash as the interpreter.
VS Code did not open?
- Make sure you are running the code command from inside the Ubuntu terminal, not from Windows PowerShell.
- If you see a "command not found" error, close and reopen your Ubuntu terminal. The code command requires VS Code to be in your PATH.
Help me open VS Code from my WSL terminal
Write the health check logic
Your script will report five things: hostname, date/time, CPU load, memory usage, and disk usage. It uses echo to print text and command substitution $(command) to capture live system data into the output.
- In health-check.sh, add the following code below the #!/bin/bash line:
echo "=============================="
echo " SYSTEM HEALTH CHECK REPORT"
echo "=============================="
echo ""
echo "Hostname: $(hostname)"
echo "Date: $(date)"
echo "Uptime: $(uptime -p)"
echo ""
echo "--- CPU Load ---"
echo "Load Average: $(cat /proc/loadavg | awk '{print $1, $2, $3}')"
echo ""
What does this code do?
- The first three echo lines print a banner header for the report.
- $(hostname), $(date), and $(uptime -p) are command substitutions. They run the command inside $(...) and insert the output directly into the text.
- The CPU load line reads /proc/loadavg (a Linux system file) and uses awk to extract the first three numbers, which represent load averages over 1, 5, and 15 minutes.
- Save the file.
- Continue adding the memory, disk, and process checks below the code you just wrote:
echo "--- Memory Usage ---"
free -m | awk 'NR==2{printf "Used: %sMB / %sMB (%.1f%%)\n", $3, $2, $3*100/$2}'
echo ""
echo "--- Disk Usage ---"
DISK_USAGE=$(df -h / | awk 'NR==2{print $5}' | tr -d '%')
echo "Root partition: ${DISK_USAGE}% used"
if [ "$DISK_USAGE" -gt 80 ]; then
echo "WARNING: Disk usage is above 80%!"
else
echo "Status: OK"
fi
echo ""
What does this code do?
- free -m shows memory in megabytes. The awk command picks the second row and calculates a percentage from the used and total columns.
- DISK_USAGE=$(...) captures the disk usage percentage into a variable. The tr -d '%' strips the percent sign so you can compare it as a number.
- The if block is a conditional. It checks whether disk usage exceeds 80% and prints a warning if it does. Otherwise, it prints "Status: OK".
- Save the file.
- Add the final section below your disk usage code to list the top memory-consuming processes and close the report:
echo "--- Top 5 Processes by Memory ---"
ps aux --sort=-%mem | awk 'NR<=6{printf "%-10s %-6s %s\n", $1, $4"%", $11}'
echo ""
echo "=============================="
echo " Health check complete."
echo "=============================="
What does this code do?
- ps aux --sort=-%mem lists all processes sorted by memory usage (highest first).
- NR<=6 in awk grabs the header row plus the top 5 processes. The printf formats them into neat columns showing the user, memory percentage, and command name.
- The closing banner marks the end of the report so you can clearly see where output stops.
- Save health-check.sh.
Seeing syntax errors in your file?
- Make sure every opening quote " has a matching closing quote. Unmatched quotes cause most bash syntax errors.
- Check that the if block has spaces inside the square brackets: [ "$DISK_USAGE" -gt 80 ]. Missing spaces before ] or after [ will cause an error.
- Verify the shebang #!/bin/bash is on line 1 with no spaces or blank lines above it.
Help me fix a syntax error in my bash script
✔️ Awesome, I've got everything!
Great. Make sure you have saved health-check.sh before moving on.
ⓧ I'd like to double check the full code
Here is the complete health-check.sh file. Compare it against yours:
#!/bin/bash
echo "=============================="
echo " SYSTEM HEALTH CHECK REPORT"
echo "=============================="
echo ""
echo "Hostname: $(hostname)"
echo "Date: $(date)"
echo "Uptime: $(uptime -p)"
echo ""
echo "--- CPU Load ---"
echo "Load Average: $(cat /proc/loadavg | awk '{print $1, $2, $3}')"
echo ""
echo "--- Memory Usage ---"
free -m | awk 'NR==2{printf "Used: %sMB / %sMB (%.1f%%)\n", $3, $2, $3*100/$2}'
echo ""
echo "--- Disk Usage ---"
DISK_USAGE=$(df -h / | awk 'NR==2{print $5}' | tr -d '%')
echo "Root partition: ${DISK_USAGE}% used"
if [ "$DISK_USAGE" -gt 80 ]; then
echo "WARNING: Disk usage is above 80%!"
else
echo "Status: OK"
fi
echo ""
echo "--- Top 5 Processes by Memory ---"
ps aux --sort=-%mem | awk 'NR<=6{printf "%-10s %-6s %s\n", $1, $4"%", $11}'
echo ""
echo "=============================="
echo " Health check complete."
echo "=============================="
Run your script and save the output
The script is written and executable. Now you will run it to verify it produces correct output, then pipe the results to a log file.
- Navigate to your scripts directory and run the health check by running these commands:
cd ~/cloud-tools/scripts && ./health-check.sh
You should see a formatted report with your hostname, today's date, CPU load averages, memory usage in MB, disk usage percentage with a status message, and a list of top processes.
Why use ./ before the filename?
The ./ tells Linux to look for the script in the current directory. Without it, Linux searches the system PATH and will not find your script.
Seeing "Permission denied" or "No such file"?
- If you see "Permission denied", run chmod +x ~/cloud-tools/scripts/health-check.sh again. The execute permission may not have been set correctly.
- If you see "No such file or directory", check you are in the right folder with pwd. You should be in ~/cloud-tools/scripts.
- If you see "bad interpreter" errors, open the file and make sure #!/bin/bash is on the very first line with no blank lines or spaces above it.
Help me fix a permission or path error running my bash script
- Run the script again and save the output to a log file using tee:
./health-check.sh | tee ~/cloud-tools/logs/health-$(date +%Y%m%d).log
What does tee do?
The tee command splits output into two streams. It prints to your screen AND writes to the file at the same time. The $(date +%Y%m%d) part generates today's date as a filename suffix (e.g., health-20260519.log).
- Verify the log file was created by running:
ls ~/cloud-tools/logs/
You should see a file named something like health-20260519.log (with today's date).
- Read the log file contents to confirm everything was captured by running:
cat ~/cloud-tools/logs/health-$(date +%Y%m%d).log
You should see the same health check report output you saw on screen, now saved permanently in the log file.
Your first bash script is working and logging results. Next up, you will build a personal cheat sheet of everything you have learned and push it to GitHub.
Build Your Cheat Sheet and Push to GitHub
Your health check script is running and logging results to a file. That's a real automation skill cloud engineers use every day.
Now it's time to document everything you've learned and share it with the world. You'll create a commands cheat sheet and push your entire workspace to GitHub using Git.
In this step, get ready to:
- Create a personal commands cheat sheet with 25+ Linux commands organized by category.
- Set up Git in WSL and commit your workspace.
- Push your project to GitHub so it lives in your portfolio.
Create your personal commands cheat sheet
A cheat sheet is a reference document you can return to any time you forget a command. Cloud engineers keep these handy because memorizing 25+ commands takes time.
- Open a new file called commands-cheatsheet.md in VS Code by running this command:
code ~/cloud-tools/notes/commands-cheatsheet.md
What does this command do?
The code command opens VS Code directly from the terminal. Because you installed the WSL extension earlier, VS Code knows how to open Linux files seamlessly.
- Paste the following cheat sheet content into the file. This covers all the commands you've used across navigation, file operations, permissions, processes, packages, and text processing:
# Linux Commands Cheat Sheet for Cloud Engineers
## Navigation
| Command | Description | Example |
|---------|-------------|----------|
| `pwd` | Print current directory | `pwd` |
| `ls -la` | List all files with details | `ls -la /etc` |
| `cd` | Change directory | `cd /var/log` |
| `tree` | Show directory structure | `tree ~/cloud-tools` |
## File Operations
| Command | Description | Example |
|---------|-------------|----------|
| `touch` | Create empty file | `touch newfile.txt` |
| `mkdir -p` | Create directory (with parents) | `mkdir -p project/src/config` |
| `cp` | Copy files | `cp file.txt backup.txt` |
| `mv` | Move or rename | `mv old.txt new.txt` |
| `rm` | Delete file | `rm unwanted.txt` |
| `cat` | Display file contents | `cat config.yaml` |
| `less` | Scroll through large files | `less /var/log/syslog` |
| `head` | Show first N lines | `head -20 app.log` |
| `tail -f` | Stream live log output | `tail -f /var/log/syslog` |
| `find` | Search for files | `find / -name "*.log"` |
| `grep` | Search inside files | `grep "error" app.log` |
## Permissions
| Command | Description | Example |
|---------|-------------|----------|
| `chmod` | Change file permissions | `chmod 755 script.sh` |
| `chown` | Change file owner | `chown user:group file` |
## Process Management
| Command | Description | Example |
|---------|-------------|----------|
| `ps aux` | List all processes | `ps aux` |
| `top` | Live process monitor | `top` |
| `htop` | Better process monitor | `htop` |
| `kill` | Stop a process | `kill 1234` |
| `df -h` | Check disk space | `df -h` |
| `free -m` | Check memory | `free -m` |
## Packages
| Command | Description | Example |
|---------|-------------|----------|
| `sudo apt update` | Update package list | `sudo apt update` |
| `sudo apt install` | Install software | `sudo apt install git -y` |
| `which` | Find where a tool is | `which python3` |
## Text Processing
| Command | Description | Example |
|---------|-------------|----------|
| `echo` | Print text | `echo "hello"` |
| `grep -r` | Search recursively | `grep -r "TODO" ~/project/` |
| `wc -l` | Count lines | `wc -l access.log` |
| `awk` | Process text columns | `awk '{print $1}' file` |
What does this cheat sheet cover?
This file organizes 25+ commands into six categories that mirror real cloud engineering workflows. Navigation and file operations are the most common. Permissions and process management come up when debugging servers.
You can always add more commands to this file as you learn them. It's your personal reference.
- Save commands-cheatsheet.md in VS Code with Ctrl+S.
- Verify the file was saved by running:
cat ~/cloud-tools/notes/commands-cheatsheet.md
You should see the full cheat sheet content printed in your terminal.
File looks empty or missing?
Make sure you saved the file in VS Code before running cat. Check that the file path matches exactly: ~/cloud-tools/notes/commands-cheatsheet.md.
If VS Code opened a blank file with a different path, close it and re-run the code command from above.
Help me troubleshoot why my cheat sheet file is empty or not showing content when I run cat.
✔️ Awesome, I've got everything!
Great. Make sure your file is saved before moving on.
ⓧ I'd like to double check the full code
Here is the complete commands-cheatsheet.md file for comparison:
# Linux Commands Cheat Sheet for Cloud Engineers
## Navigation
| Command | Description | Example |
|---------|-------------|----------|
| `pwd` | Print current directory | `pwd` |
| `ls -la` | List all files with details | `ls -la /etc` |
| `cd` | Change directory | `cd /var/log` |
| `tree` | Show directory structure | `tree ~/cloud-tools` |
## File Operations
| Command | Description | Example |
|---------|-------------|----------|
| `touch` | Create empty file | `touch newfile.txt` |
| `mkdir -p` | Create directory (with parents) | `mkdir -p project/src/config` |
| `cp` | Copy files | `cp file.txt backup.txt` |
| `mv` | Move or rename | `mv old.txt new.txt` |
| `rm` | Delete file | `rm unwanted.txt` |
| `cat` | Display file contents | `cat config.yaml` |
| `less` | Scroll through large files | `less /var/log/syslog` |
| `head` | Show first N lines | `head -20 app.log` |
| `tail -f` | Stream live log output | `tail -f /var/log/syslog` |
| `find` | Search for files | `find / -name "*.log"` |
| `grep` | Search inside files | `grep "error" app.log` |
## Permissions
| Command | Description | Example |
|---------|-------------|----------|
| `chmod` | Change file permissions | `chmod 755 script.sh` |
| `chown` | Change file owner | `chown user:group file` |
## Process Management
| Command | Description | Example |
|---------|-------------|----------|
| `ps aux` | List all processes | `ps aux` |
| `top` | Live process monitor | `top` |
| `htop` | Better process monitor | `htop` |
| `kill` | Stop a process | `kill 1234` |
| `df -h` | Check disk space | `df -h` |
| `free -m` | Check memory | `free -m` |
## Packages
| Command | Description | Example |
|---------|-------------|----------|
| `sudo apt update` | Update package list | `sudo apt update` |
| `sudo apt install` | Install software | `sudo apt install git -y` |
| `which` | Find where a tool is | `which python3` |
## Text Processing
| Command | Description | Example |
|---------|-------------|----------|
| `echo` | Print text | `echo "hello"` |
| `grep -r` | Search recursively | `grep -r "TODO" ~/project/` |
| `wc -l` | Count lines | `wc -l access.log` |
| `awk` | Process text columns | `awk '{print $1}' file` |
Set up Git in WSL
Git is the version control tool that tracks changes to your files and lets you push them to remote repositories like GitHub. Every cloud engineering team uses Git daily.
- Install Git by running this command:
sudo apt install git -y
- Verify Git is installed by running:
git --version
You should see a version number printed, confirming Git is ready.
Command not found after installing?
Try closing and reopening your Ubuntu terminal, then run git --version again. If it still fails, re-run sudo apt install git -y and check for error messages during the install.
Help me troubleshoot why git is not found after installing it in WSL.
- Configure Git with your name and email by running these commands:
git config --global user.name [[GIT_NAME="your full name"]]
git config --global user.email [[GIT_EMAIL="your email address"]]
What do these config commands do?
Git attaches your name and email to every commit you make. This is how teammates know who made each change. Use the same email you used to sign up for GitHub.
- Initialize your workspace as a Git repository, stage all files, and create your first commit by running these commands:
# Move into your workspace
cd ~/cloud-tools
# Initialize a new git repository
git init
# Stage all files for commit
git add .
# Create your first commit
git commit -m "Initial commit: Linux workspace setup"
What does this sequence do?
The git init command turns ~/cloud-tools into a Git repository by creating a hidden .git folder. The git add . stages every file in the folder. The git commit saves a snapshot of your project with a descriptive message.
- Verify the commit worked by running:
git log --oneline
You should see one line showing your commit message: Initial commit: Linux workspace setup.
Seeing an error about identity?
If Git says it cannot determine your identity, you need to run the git config commands from earlier. Make sure you included the --global flag.
Help me fix a Git identity error when trying to commit.
Push your workspace to GitHub
Your project is committed locally. Now you'll push it to GitHub so it's backed up and visible in your portfolio.
- Open your browser and go to github.com.
- Sign in to your GitHub account.
- Click the + icon in the top right corner, then click New repository.
- Enter cloud-tools as the repository name.
- Leave the repository set to Public.
- Do NOT check any of the initialization options (no README, no .gitignore, no license). You already have files to push.
- Click Create repository.
Why skip the initialization options?
GitHub offers to create a README and .gitignore for you, but that would create a commit on GitHub's side. Since you already have local commits ready to push, starting with an empty repository avoids merge conflicts.
- Back in your Ubuntu terminal, link your local repository to GitHub and push your code by running these commands:
git remote add origin https://github.com/[[GITHUB_USERNAME="your GitHub username"]]/cloud-tools.git
git branch -M main
git push -u origin main
What do these commands do?
The git remote add origin command tells Git where your remote repository lives on GitHub. The git branch -M main renames your default branch to main. The git push -u origin main uploads all your committed files to GitHub.
GitHub will ask you to authenticate
When you run git push, GitHub will prompt you for a username and password. GitHub no longer accepts your account password for Git operations over HTTPS.
Instead, you need a Personal Access Token. Go to Settings on GitHub, then Developer settings, then Personal access tokens. Generate a new token with the repo scope selected. Copy the token and paste it when prompted for a password.
- Verify the push succeeded by visiting your repository in your browser at https://github.com/ followed by your username and /cloud-tools.
You should see all your files listed: the scripts/ folder with health-check.sh, the notes/ folder with your cheat sheet, and the logs/ folder.
Push failed or permission denied?
Make sure you created the repository on GitHub with the exact name cloud-tools. Check that the remote URL matches your GitHub username. Run git remote -v to verify the URL.
If you see an authentication error, make sure you're using a Personal Access Token (not your GitHub password) when prompted. The token needs the repo scope to push code.
Help me fix a permission denied or authentication error when pushing to GitHub from WSL.
Secret mission
Extend Your Health Check With Network Monitoring and Logging
Your basic health check script works, but real cloud engineers need more. Can you add network connectivity monitoring, colored output for quick scanning, and persistent timestamped logging so you can track system health over time?
Clean Up Your Resources
Clean Up Your Resources
This project runs entirely on your local machine using WSL2. There are no cloud resources or ongoing costs to worry about.
Decide whether to keep your resources running, pause them to come back later, or delete them entirely.
Resources you used:
- WSL2 with Ubuntu installed on your Windows machine.
- The ~/cloud-tools/ directory (scripts, logs, notes).
- VS Code WSL extension.
- GitHub repository cloud-tools at github.com/alphaleo01.
- Packages installed inside Ubuntu (git, htop, tree).
Keep everything running
No action needed. Choose this if you plan to keep learning Linux, writing more bash scripts, or using this workspace for future cloud projects.
- Your WSL2 Ubuntu environment stays ready to use whenever you open a terminal.
- Your ~/cloud-tools/ workspace remains available for new scripts and notes.
- Your GitHub repository stays live as a portfolio piece.
Pause - I'll come back to this later
Shut down WSL to free up memory while keeping all your files intact.
- Open PowerShell and shut down WSL by running:
wsl --shutdown
- This stops the Ubuntu virtual machine and frees the memory it was using.
- All your files in ~/cloud-tools/ remain intact. Next time you open Ubuntu, everything will be exactly where you left it.
Delete - I don't want to use this again
Remove all project resources and start fresh. Follow these steps in order.
- Delete the GitHub repository. Go to your cloud-tools repository on github.com.
- Click Settings.
- Scroll down to the Danger Zone section and click Delete this repository.
- Follow the confirmation prompts and type the repository name to confirm.
- Unregister Ubuntu from WSL. Open PowerShell as Administrator and run:
wsl --unregister Ubuntu
This permanently deletes everything
Running wsl --unregister Ubuntu permanently deletes all data, settings, and software inside your Ubuntu installation. This includes your ~/cloud-tools/ directory, all installed packages, and your Linux user account. Make sure you have pushed any work you want to keep to GitHub before running this command.
- Remove the VS Code WSL extension. Open VS Code, click the Extensions icon in the left sidebar, search for WSL, and click Uninstall.
Nice Work!
Nice Work!
Nice work! You just went from zero Linux knowledge to having a fully working cloud engineering environment on your Windows machine.
You've learned how to:
- Installed WSL2 with Ubuntu and navigated the Linux file system to create a professional workspace with organized directories for scripts, logs, and notes.
- Managed file permissions, monitored running processes, and installed packages using the same commands cloud engineers run on production servers every day.
- Wrote a bash script that automates a real cloud engineering task, pushed it to GitHub, and built your first piece of a cloud engineering portfolio.
- Extended your health check script with network monitoring, colored output, and persistent logging with timestamps.
Ready to quiz yourself?