Last active
December 21, 2015 15:48
-
-
Save P7h/35f94b69327e147e9f97 to your computer and use it in GitHub Desktop.
For showing IP Address before the login prompt on Ubuntu env. Copy the following script to /etc/network/if-up.d/ and /etc/network/if-post-down.d/ folders. And don’t forget to mark them as executables.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This shell script displays hostname and IP Address of the Ubuntu machine before the login prompt. | |
# Add this file to '/etc/network/if-up.d/' and '/etc/network/if-post-down.d/' folders and mark them as executables. | |
# Display Ubuntu default information [the current version of Ubuntu]. | |
cat /etc/issue.net > /etc/issue | |
# Display the hostname. | |
hostname >> /etc/issue | |
# Display the IP Address of eth0. | |
ip address show eth0 | awk '/inet / {print $2}' | cut -d/ -f1 >> /etc/issue |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
if the file is called
show-ip-address.sh
then it will not work: it must not have an extension! This works:
show-ip-address