-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbin bash Process Monitor.sh
More file actions
64 lines (51 loc) · 1.37 KB
/
bin bash Process Monitor.sh
File metadata and controls
64 lines (51 loc) · 1.37 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
#!/bin/bash
# Process Monitor Script
# Displays top processes by CPU and memory usage
echo "=== TOP 10 PROCESSES BY CPU USAGE ==="
echo ""
ps aux --sort=-%cpu | head -n 11 | awk 'NR==1{print $0} NR>1{printf "%s\t%s%%\t%s\n", $11, $3, $2}'
echo ""
echo "=== TOP 10 PROCESSES BY MEMORY USAGE ==="
echo ""
ps aux --sort=-%mem | head -n 11 | awk 'NR==1{print $0} NR>1{printf "%s\t%s%%\t%s\n", $11, $4, $2}'
echo ""
echo "=== SYSTEM LOAD ==="
uptime
```
### gitquick.sh
```bash
#!/bin/bash
# Quick Git Commit Script
# Adds all changes and commits with a timestamped message
# Check if we're in a git repository
if ! git rev-parse --git-dir > /dev/null 2>&1; then
echo "Error: Not in a git repository"
exit 1
fi
# Get custom message or use default
MESSAGE="${1:-Quick commit}"
TIMESTAMP=$(date "+%Y-%m-%d %H:%M:%S")
FULL_MESSAGE="$MESSAGE - $TIMESTAMP"
# Show status
echo "Current status:"
git status --short
echo ""
read -p "Commit all changes? (y/n) " -n 1 -r
echo
if [[ $REPLY =~ ^[Yy]$ ]]; then
# Add all changes
git add .
# Commit with message
git commit -m "$FULL_MESSAGE"
echo ""
echo "Changes committed with message: $FULL_MESSAGE"
# Ask to push
read -p "Push to remote? (y/n) " -n 1 -r
echo
if [[ $REPLY =~ ^[Yy]$ ]]; then
git push
echo "Changes pushed successfully"
fi
else
echo "Commit cancelled"
fi