A More Readable Output of ‘ip address’

   A More Readable Output ‘ip address’

Format the output of the ‘ip’ command in Linux to more readable.


  • Older ifconfig command:

ifconfig command results

  • Newer IP Command

ip addr command results

  • Formatted IP command:

formatted ip -br a address option

  • Pretty IP Script:

pretty-ip colored ip script



This command would be useful as a mini script, but for now lets see how it works.

I basically use AWK to extract the columns I want  from the out out of: ‘ip -4 a’ and use a simple condition to see which part is being matched so I know when to insert a new line.

The command is:

echo -e “$(ip -br a | awk -v nocolor=’\033[0m’ -v orange=’\033[0;33m’ -v red=’\033[0;31m’ -v green=’\033[0;32m’ -v blue=’\033[0;36m’ ‘{printf “\n”; if($2==”DOWN”){printf “%-20s\t%-14s\t%-16s”, red$1, $2 ,$3nocolor}else if($2==”UP”){printf “%-20s\t%-14s\t%-16s”, green$1, $2, $3nocolor}else{printf “%-16s\t%-14s\t%-16s”, orange$1, $2, $3nocolor}}’; printf “\n\n”;)”



Some references:

Comparison between ifconfig and ip: https://linoxide.com/linux-command/use-ip-command-linux/

Leave a Reply

Your email address will not be published. Required fields are marked *