-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbin bash Internet Speed.sh
More file actions
60 lines (48 loc) · 1.18 KB
/
bin bash Internet Speed.sh
File metadata and controls
60 lines (48 loc) · 1.18 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
#!/bin/bash
# Internet Speed Test Script
# Tests download and upload speeds using speedtest-cli
# Check if speedtest-cli is installed
if ! command -v speedtest-cli &> /dev/null; then
echo "speedtest-cli is not installed."
echo "Install it with: sudo apt install speedtest-cli"
exit 1
fi
echo "Testing internet speed..."
echo "This may take a moment..."
echo ""
# Run speedtest and format output
speedtest-cli --simple
echo ""
echo "Test completed at $(date)"
```
### killport.sh
```bash
#!/bin/bash
# Kill Process on Port Script
# Terminates any process using the specified port
# Check if port number is provided
if [ $# -eq 0 ]; then
echo "Usage: $0 "
echo "Example: $0 8080"
exit 1
fi
PORT="$1"
# Find process using the port
PID=$(lsof -t -i:$PORT)
# Check if a process was found
if [ -z "$PID" ]; then
echo "No process found running on port $PORT"
exit 0
fi
# Display process information
echo "Process using port $PORT:"
ps -p $PID -o pid,cmd
# Ask for confirmation
read -p "Do you want to kill this process? (y/n) " -n 1 -r
echo
if [[ $REPLY =~ ^[Yy]$ ]]; then
kill -9 $PID
echo "Process $PID killed successfully"
else
echo "Operation cancelled"
fi