From terminal:
ip addr show eth0 | grep inet | awk '{ print $2; }' | sed 's/\/.*$//'
Tag: console
Use a Different Color for the Root Shell Prompt
Linux only: This is an excellent tip that changes the prompt to red when using the root account from the terminal—as a reminder to be more careful. Using the tip is relatively simple—just edit the /root/.bashrc file and add in the following, preferably commenting out the existing lines that set the color, though you can simply add this line to the end of the file.
Read More