Display IP address on Panel in Xfce
Create a small shell script show_ip.sh :
#!/bin/bash
# Get all addresses from hostname -I
IP_ADDRESSES=$(hostname -I)
# Split into individual IP addresses
IFS=' ' read -r -a IP_ADDRS <<< "$IP_ADDRESSES"
# Find the first IPv4 address
for IP in "${IP_ADDRS[@]}"; do
if [[ "$IP" =~ ^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$ ]]; then
echo "$IP"
break
fi
done
#!/bin/bash
ip -4 addr show scope global | grep -oP '(?<=inet\s)\d+(\.\d+){3}'
chmod +x show_ip.sh
Add a generic monitor:
That's it.
No Comments