How to get the IP address assigned to eth0 by a single command
Answer:
Only a single command is needed to return only the IP address assigned to eth0:
# echo $(ifconfig eth0 | awk -F: '/inet addr:/ {print $2}' | awk '{ print $1 }')
58.23.182.42
Linux Ask! is a Q & A web site specific for Linux related questions. Questions are collected, answered and audited by experienced Linux users.
How to get the IP address assigned to eth0 by a single command
Answer:
Only a single command is needed to return only the IP address assigned to eth0:
# echo $(ifconfig eth0 | awk -F: '/inet addr:/ {print $2}' | awk '{ print $1 }')
58.23.182.42