-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathinfo.sh
248 lines (191 loc) · 5.44 KB
/
info.sh
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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
#!/bin/bash
#colours
blue='\033[1;34m'
grn='\033[1;32m'
cyan='\033[1;36m'
red='\033[1;31m'
ylo='\033[1;33m'
# Variables
# OS
OS=$(awk -F'=' '/PRETTY_NAME/ {print $2; exit}' "/etc/os-release")
# Kernal-name
KER_NAME=$(uname -s)
# Kernal-version
KER_VER=$(uname -r)
# Kernal-release
KER_REL=$(uname -v)
# Machine name
MACHI_NAME=$(awk -F':' '/Model/ {print $2; exit}' "/proc/cpuinfo")
# Processor
PROCESSOR=$(awk -F':' '/Hardware/ {print $2; exit}' "/proc/cpuinfo")
# Hostname
HOSTNAME=$(uname -n)
# User
USER=$(whoami)
# ID
ID=$(id)
# Total storage
TOTAL_STO=$(df -h / | awk '{ print $2 }' | tail -1)
# Used storage
USED_STO=$(df -h / | awk '{ print $3 }' | tail -1)
USED_STO_PER=$(df -h / | awk '{ print $5 }' | tail -1)
# Available storage
AVAIL_STO=$(df -h / | awk '{ print $4 }' | tail -1)
# USB Total storage
# TOTAL_USB_STO=$(df -h /dev/sda* | awk '{ print $2 }' | tail -1)
# USB Used storage
# USED_USB_STO=$(df -h /dev/sda* | awk '{ print $3 }' | tail -1)
# USED_USB_STO_PER=$(df -h /dev/sda* | awk '{ print $5 }' | tail -1)
# USB Available storage
# AVAIL_USB_STO=$(df -h /dev/sda* | awk '{ print $4 }' | tail -1)
# Wlan0 IP
WLAN0=$(ifconfig wlan0 | grep -w inet | awk '{printf $2}' | tail -1)
#Eth0 IP
#ETH0=$(ifconfig eth0 | grep -w inet | awk '{printf $2}' | tail -1)
# Temprature
TEMP=$(cat /sys/class/thermal/thermal_zone0/temp)
if [[ "$1" == "-h" ]];
then
echo -e "$ylo""Info ${red}v0.0"
echo -e "$cyan""Usage: info -options"
echo "Options:"
echo -e "$grn""-neo ${blue}neofetch"
echo -e "$grn""-os ${blue}Operating system"
echo -e "$grn""-kn ${blue}Kernal name"
echo -e "$grn""-kv ${blue}Kernal version"
echo -e "$grn""-kr ${blue}Kernal release"
echo -e "$grn""-mn ${blue}Machine name"
echo -e "$grn""-P ${blue}Processor"
echo -e "$grn""-H ${blue}Hostname"
echo -e "$grn""-u ${blue}User"
echo -e "$grn""-i ${blue}User ID"
echo -e "$grn""-is ${blue}Internal storage"
echo -e "$grn""-ius ${blue}Internal used storage"
echo -e "$grn""-ias ${blue}Internal available storage"
# echo -e "$grn""-es ${blue}External storage"
# echo -e "$grn""-eus ${blue}External used storage"
# echo -e "$grn""-eas ${blue}External available storage"
echo -e "$grn""-wi ${blue}Wlan0 IP"
echo -e "$grn""-ei ${blue}Ethernet IP (By default disabled)"
echo -e "$grn""-tp ${blue}Temprature"
echo -e "$grn""-a ${blue}All at once"
exit
elif [[ "$1" == "-neo" ]];
then
neofetch | lolcat
exit
elif [[ "$1" == "-os" ]];
then
echo -e "$blue""Operating system: ""${grn}""${OS}"
exit
elif [[ "$1" == "-kn" ]];
then
echo -e "$blue""Kernal name: ""${grn}""${KER_NAME}"
exit
elif [[ "$1" == "-kv" ]];
then
echo -e "$blue""Kernal version: ""${grn}""${KER_VER}"
exit
elif [[ "$1" == "-kr" ]];
then
echo -e "$blue""Kernal release: ""${grn}""${KER_REL}"
exit
elif [[ "$1" == "-mn" ]];
then
echo -e "$blue""Machine name: ""${grn}""${MACHI_NAME}"
exit
elif [[ "$1" == "-P" ]];
then
echo -e "$blue""Processor: ""${grn}""${PROCESSOR}"
exit
elif [[ "$1" == "-H" ]];
then
echo -e "$blue""Hostname: ""${grn}""${HOSTNAME}"
exit
elif [[ "$1" == "-u" ]];
then
echo -e "$blue""User: ""${grn}""${USER}"
exit
elif [[ "$1" == "-i" ]];
then
echo -e "$blue""ID: ""${grn}""${ID}"
exit
elif [[ "$1" == "-is" ]];
then
echo -e "$blue""Total storage: ""${grn}""${TOTAL_STO}"
exit
elif [[ "$1" == "-ius" ]];
then
echo -e "$blue""Used storage: ""${grn}""${USED_STO}" "${USED_STO_PER}"
exit
elif [[ "$1" == "-ias" ]];
then
echo -e "$blue""Available storage: ""${grn}""${AVAIL_STO}"
exit
# elif [[ "$1" == "-es" ]];
# then
# echo -e "$blue""Total USB storage: ""${grn}""${TOTAL_USB_STO}"
# exit
# elif [[ "$1" == "-eus" ]];
# then
# echo -e "$blue""Used USB storage: ""${grn}""${USED_USB_STO}" "${USED_USB_STO_PER}"
# exit
# elif [[ "$1" == "-eas" ]];
# then
# echo -e "$blue""Available USB storage: ""${grn}""${AVAIL_USB_STO}"
# exit
elif [[ "$1" == "-wi" ]];
then
echo -e "$blue""Wlan0 IP: ""${grn}""${WLAN0}"
exit
#elif [[ "$1" == "-ei" ]];
#then
# echo -e "$blue""Eth0 IP: ""${grn}""${ETH0}"
# exit
elif [[ "$1" == "-tp" ]];
then
echo -e "$blue""CPU Temprature: ""${grn}""${TEMP}"
exit
elif [[ "$1" == "-a" ]];
then
#neofetch | lolcat
# OS
echo -e "$blue""Operating system: ""${grn}""${OS}"
# Kernal-name
echo -e "$blue""Kernal name: ""${grn}""${KER_NAME}"
# Kernal-version
echo -e "$blue""Kernal version: ""${grn}""${KER_VER}"
# Kernal-release
echo -e "$blue""Kernal release: ""${grn}""${KER_REL}"
# Machine name
echo -e "$blue""Machine name: ""${grn}""${MACHI_NAME}"
# Processor
echo -e "$blue""Processor: ""${grn}""${PROCESSOR}"
# Hostname
echo -e "$blue""Hostname: ""${grn}""${HOSTNAME}"
# User
echo -e "$blue""User: ""${grn}""${USER}"
# ID
echo -e "$blue""ID: ""${grn}""${ID}"
# Total storage
echo -e "$blue""Total storage: ""${grn}""${TOTAL_STO}"
# Used storage
echo -e "$blue""Used storage: ""${grn}""${USED_STO}" "${USED_STO_PER}"
# Available storage
echo -e "$blue""Available storage: ""${grn}""${AVAIL_STO}"
# USB Total storage
#echo -e "$blue""Total USB storage: ""${grn}""${TOTAL_USB_STO}"
# USB Used storage
#echo -e "$blue""Used USB storage: ""${grn}""${USED_USB_STO}" "${USED_USB_STO_PER}"
# USB Available storage
#echo -e "$blue""Available USB storage: ""${grn}""${AVAIL_USB_STO}"
# Wlan0 IP
echo -e "$blue""Wlan0 IP: ""${grn}""${WLAN0}"
#Eth0 IP
#echo -e "$blue""Eth0 IP: ""${grn}""${ETH0}"
# Temprature
echo -e "$blue""CPU Temprature: ""${grn}""${TEMP}"
exit
fi
echo "info: missing/wrong parameter"
echo "Try \"info -h\" for help"