Skip to content

MeganTran6023/User_Disk_Space

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 

Repository files navigation

Alerting User - Disk Space

by Megan Tran

Table of Contents

Purpose of Program

  • 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.

Screenshots

image

Final output from bash script.

Technologies

Languages/ Technologies used:

  • Bash
  • Awk
  • Visual Studio Code
  • WSL Ubuntu

Setup

  1. 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. image

  • Turn on Windows Subsystem for Linux (Beta)

image

  1. (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.

  1. Download awk by following intructions here.

  2. Download bash by following instructions here.

Using the Program

  • 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.
  1. 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
  1. 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.

Credits

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages