Skip to content

Commit 0a1e522

Browse files
sponkurtus2ACR1209
authored andcommitted
Added bash as a new language, also added a category and a snippet (quicksnip-dev#204)
* Added a bash as a new language, also added a category and a snippet * Fixed the snippet to make it more like a snippet * Deleted public/consolidated/ and put code into a function * Deleted public/consolidated/
1 parent 64446bc commit 0a1e522

File tree

3 files changed

+24
-0
lines changed

3 files changed

+24
-0
lines changed

public/icons/bash.svg

Lines changed: 1 addition & 0 deletions
Loading

snippets/bash/icon.svg

Lines changed: 1 addition & 0 deletions
Loading
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
---
2+
title: System Resource Monitor
3+
description: Monitors system resources (CPU, RAM, disk, users)
4+
author: sponkurtus2
5+
tags: file,system
6+
---
7+
8+
```bash
9+
system_resources () {
10+
echo "CPU Load: $(top -bn1 | grep "Cpu(s)" | awk '{print $2}')%"
11+
echo "Memory Used: $(free -m | awk 'NR==2{printf "%.2f%%", $3*100/$2}')"
12+
echo "Disk Used: $(df -h / | awk 'NR==2{print $5}')"
13+
echo "Active Users: $(who | wc -l)"
14+
}
15+
16+
system_resources "$@"
17+
18+
// Usage:
19+
chmod a+x system-resource-monitor.sh // First make it executable for all the users
20+
21+
./system-resource-monitor.sh // It will print the following system resources (CPU, RAM, disk, and active users)
22+
```

0 commit comments

Comments
 (0)