by Megan Tran
- Practice using awk and bash shell scripting on Windows Subsystem for Linux (WSL) on Visual Studio Code.
- Alert user if their disk space were to run out.
- Practice applying mathematical operations.
Final output from bash script.
Languages/ Technologies used:
- Bash
- Awk
- Visual Studio Code
- WSL Ubuntu
- Download Ubuntu
-
Ensure virtualization is enabled This can be done by going on the BIOS screen. To get here reset your computer and repeatedly press esc, F2, or the keyboard button that you need to press according to your device version/model.

-
Turn on Windows Subsystem for Linux (Beta)
- (Optional) Download Visual Studio Code
- Get the extension WSL
- Type into Ubuntu terminal
wslconfig.exe /s Ubuntu
The wsl terminal should now be avaliable on VSC application.
- What I did differently was adding an if-else statement into the program. If the user's disk space was above 90%, the program would alert the user that they have low disk space. Otherwise, they would only be shown the amount of disk space avaliable.
- Get the numerical value of disk space used in a user's computer by typign this in terminal:
df -h | grep drivers | awk '{print $5}' | cut -d '%' -f1
- Create the bash script, I assigned a variable for the code above and create my own if-else statement. You can customize your bash script if preferred.
- Source code from Linuxtopia
