-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy path20-sysinfo
executable file
·23 lines (20 loc) · 1.1 KB
/
20-sysinfo
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#!/bin/bash
# get free memory
IFS=" " read USED FREE TOTAL <<<$(free -htm | grep "Mem" | awk {'print $3,$4,$2'})
ISF2=" " read USEDSW FREESW TOTALSW <<<$(free -htm | grep "Swap" | awk {'print $3,$4,$2'})
# get processes
PROCESS=`ps -eo user=|sort|uniq -c | awk '{ print $2 " " $1 }'`
PROCESS_ALL=`echo "$PROCESS"| awk {'print $2'} | awk '{ SUM += $1} END { print SUM }'`
PROCESS_ROOT=`echo "$PROCESS"| grep root | awk {'print $2'}`
PROCESS_USER=`echo "$PROCESS"| grep -v root | awk {'print $2'} | awk '{ SUM += $1} END { print SUM }'`
W="\e[0;39m"
G="\e[1;33m"
echo -e "
${W}system info:
$W Uptime.: $W`uptime -p | awk '{if ($1 != "test") printf("%s %s %s %s\n", $2, $3, $4, $5); }' | sed 's/,//g'`
$W Distro.: $W`cat /etc/*release | grep "PRETTY_NAME" | cut -d "=" -f 2- | sed 's/"//g'`
$W Kernel.: $W`uname -sr`
$W Proc...: $W$G$PROCESS_ROOT$W (r), $G$PROCESS_USER$W (u) | $G$PROCESS_ALL$W (t)
$W CPU....:$W`cat /proc/cpuinfo | grep "name" | cut -d : -f2 | uniq | cut -f1 -d"@" | sed 's/(TM)//;s/(R)//;s/CPU//'`
$W Memory.: $G$USED$W used | $G$TOTAL$W in total$W
$W Swap...: $G$USEDSW$W used | $G$TOTALSW$W in total$W"