Update ip4all function to get all ip on all interfaces
Signed-off-by: Alban Vidal <alban.vidal@zordhak.fr>
This commit is contained in:
parent
11f978c667
commit
d7f9c3b373
@ -17,10 +17,26 @@ function hddtop() {
|
||||
}
|
||||
|
||||
# List all ip's v4
|
||||
ip4all () {
|
||||
ip -4 -o addr \
|
||||
| grep -v 127.0.0 \
|
||||
| awk -v blue="$(tput bold;tput setaf 4)" -v reset="$(tput sgr0)" '{printf "%s\t%s\t%s %s %s\n",$2,":",blue,$4,reset}'
|
||||
#
|
||||
# OLD
|
||||
#ip4all () {
|
||||
# ip -4 -o addr \
|
||||
# | grep -v 127.0.0 \
|
||||
# | awk -v blue="$(tput bold;tput setaf 4)" -v reset="$(tput sgr0)" '{printf "%s\t%s\t%s %s %s\n",$2,":",blue,$4,reset}'
|
||||
#}
|
||||
#
|
||||
# NEW
|
||||
function ip4all()
|
||||
{
|
||||
echo -e "\033[32mInterfaces and IP\033[00m :"
|
||||
# Search all interfaces
|
||||
LISTE_INTERFACES=$(ip -4 a s|grep -P '^[0-9]+'|grep -v '^1:'|awk -F: '{print $2}'|sed 's/@.*//')
|
||||
# For all interfaces, get all ip's
|
||||
for INTERFACE in $LISTE_INTERFACES
|
||||
do
|
||||
echo -e "\t- \033[33m$INTERFACE\033[00m"
|
||||
ip -4 a s $INTERFACE |grep inet|awk '{print "\011\011" $2}'
|
||||
done
|
||||
}
|
||||
|
||||
# Show top usage memory
|
||||
|
@ -37,6 +37,7 @@ processes=`ps aux | wc -l`
|
||||
echo
|
||||
echo -e "OS\t:\t `lsb_release -d | sed -e 's/Description://g' | sed 's/^[ \t]*//'`"
|
||||
echo -e "Uptime\t:\t $(uptime -p)"
|
||||
echo
|
||||
ip4all
|
||||
echo
|
||||
hddtop
|
||||
|
Loading…
Reference in New Issue
Block a user