Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit f9fa07b

Browse files
Added bash as a new language, also added a category and a snippet (#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 9d3aa59 commit f9fa07b

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)

AltStyle によって変換されたページ (->オリジナル) /