Made in collaboration with DeianGG
The script is made entirely in bash and built specifically for Ubuntu and similar Debian based distros and it is intended to be used in the CLI. It uses 2 packages for analyzing the system resources. The script creates a history file where each time a user runs the script it automatically logs historic usage data. Based on the current and last 2 dates the script prompts a graph showing memory usage and CPU usage. The script has numerous error handling functions and it is built to be light weight and portable.
- Install or copy the code in a .sh file.
- Open the terminal.
- Make the file an executable( if you are not sure how just run
$chmod 777 resourceful.sh
or the name of your file). - Run the script with the command
$./resourceful.sh
or the name of your file. - The script will prompt a few installations, enter Y for each one, otherwise the script won't work.
- Now the script has created in your current directory a new directory named resourceful that contains:
- a history file which logs the resources every time you run it
- the script
- Now you can run the script again. :)
- The name of the user who ran the script.
- CPU usage (colored depending on how much is used: green for low, yellow for medium and red for high).
- Memory usage (colored the same way CPU usage is colored) and how much available memory is left.
- Network information (ping, upload and download speed, if available).
- Number of manually installed packages.
- I/O devices such as an SSD or HDD(both of which appear only if available).
The script shows on each run two different graphs. These graphs are the CPU usage and the Memory usage graphs.
Each part of the graph has 3 types of states as seen in the image below:
- LOW is if the usage is under 33%
- MEDIUM if the usage is between 33% and 66%
- HIGH if the usage is over 66%
Each individual graph can show from 1 to 3 states depending on how many times the script was ran. The script retrieves the previous usages from the history file.
The graph is made using ASCII art in order to make the script lightweight and portable.