Skip to content

Instantly share code, notes, and snippets.

@P7h
Last active December 21, 2015 15:48
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save P7h/35f94b69327e147e9f97 to your computer and use it in GitHub Desktop.
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 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
@schittli
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment