Display IP adresss at login screen (Ubuntu 14.04)


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers Display IP adresss at login screen (Ubuntu 14.04)
# 1  
Old 07-20-2015
Ubuntu Display IP adresss at login screen (Ubuntu 14.04)

Hi I tried to follow

ifconfig - How can I display eth0's IP address at the login screen on Precise Server? - Ask Ubuntu

and

Show IP address of VM as console pre-login message

for some reason the above links did not work as advertised. E.g no ip address was displayed.

This is VM running under virtualBox and uname -a returns with

Code:
admini@myubuntuBox:~$ uname -a
Linux myubuntuBox 3.16.0-30-generic #40~14.04.1-Ubuntu SMP Thu Jan 15 17:43:14 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux

Any ideas what I might be doing wrong? Or another way to implement displaying the current ip address at the login screen. Feel free to ask any questions if or if you need more detail!
# 2  
Old 07-20-2015
Exactly what command are you using to try to get the IP address on your system?

If the command you are using pipes the output of ifconfig through something else to strip out the IP address, also show us the output from the ifconfig command in the pipeline.
# 3  
Old 07-20-2015
Quote:
Exactly what command are you using to try to get the IP address on your system?

Code:
admini@myubuntuBox:~$ /sbin/ifconfig eth0 | grep 'inet addr:' | cut -d: -f2 | awk '{ print $1}'
192.168.1.149
admini@myubuntuBox:~$

or

Code:
admini@myubuntuBox:~$ /sbin/ifconfig | grep "inet addr" | grep -v "127.0.0.1" | awk '{ print $2 }' | awk -F: '{ print $2 }'
192.168.1.149
admini@myubuntuBox:~$

full ifconfig
Code:
admini@myubuntuBox:~$ ifconfig
eth0      Link encap:Ethernet  HWaddr 08:00:27:b3:a2:cd
          inet addr:192.168.1.149  Bcast:192.168.1.255  Mask:255.255.255.0
          inet6 addr: fe80::a00:27ff:feb3:a2cd/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:339 errors:0 dropped:0 overruns:0 frame:0
          TX packets:203 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:32874 (32.8 KB)  TX bytes:21087 (21.0 KB)

lo        Link encap:Local Loopback
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:65536  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)

admini@myubuntuBox:~$


Last edited by briandanielz; 07-20-2015 at 02:17 AM.. Reason: ifconfig
# 4  
Old 07-20-2015
OK. So you're getting the IP address you want. Is that correct?

So, are you saying that when you add that IP address to /etc/issue, you don't see it in your system's login prompt? Can you just add a test in your .profile (or the initialization file your shell runs when you login) to print the contents of /etc/issue if it exists?

Note that if you would show us the output from:
Code:
/sbin/ifconfig eth0

or:
Code:
/sbin/ifconfig eth0 | grep 'inet addr:'

we could change the multiple invocations of awk, cut, and grep in your pipelines into a single invocation of awk.
# 5  
Old 07-20-2015
What happens if you modify /etc/issue, e.g. by adding some arbitrary line? Does it display that modified text file?
# 6  
Old 07-20-2015
You can get the IP address you want from ifconfig using:
Code:
ifconfig eth0 | awk -F' +|:' '/inet addr:/ {print $4}'

without needing to invoke grep and cut.
# 7  
Old 07-20-2015
Quote:
Originally Posted by Don Cragun
OK. So you're getting the IP address you want. Is that correct?
Yes.

Quote:
Originally Posted by Don Cragun
So, are you saying that when you add that IP address to /etc/issue, you don't see it in your system's login prompt? Can you just add a test in your .profile (or the initialization file your shell runs when you login) to print the contents of /etc/issue if it exists?
Yes and I added the below to my .bash_profile

Code:
if [[ -f /etc/issue ]]; then
        cat /etc/issue;
fi

I get my usual MOTD and
Code:
Ubuntu 14.04.2 LTS \n \l


Last edited by briandanielz; 07-20-2015 at 08:31 PM.. Reason: typo
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

How to display the files on screen

I connect via vnc to a linux computer. after a logout, I cannot see the files on the screen (although i can see the screensaver). I can open a terminal and see the files etc. How can i see the files on the screen again? (5 Replies)
Discussion started by: FelipeAd
5 Replies

2. Shell Programming and Scripting

Display a menu on bottom right of screen

Hi, I have a menu of around 10 lines with options. I want to display it in bottom right corner of screen for better display. I can do it with clear screen. But I don't want to use it, because it will clear the existing text. After one choice from menu is executed, the menu should just place... (3 Replies)
Discussion started by: som.nitk
3 Replies

3. Ubuntu

Ubuntu server login screen

Hi, Im running ubuntu server 8.04 LTS, but I want to change the initial login screen message. How can I do this? Which files do I need to change for this? So just to be clear when I reboot the server the login text which is then displayed thats what I want to change not the text that is... (5 Replies)
Discussion started by: jld
5 Replies

4. Ubuntu

Virtual Box Screen Display

Hi, Anyone can help me on how to return back to normal size not the full size of my virtual box screen display and also display the menu bar from the top. Thanks in Advance. (4 Replies)
Discussion started by: dba_macau
4 Replies

5. UNIX for Dummies Questions & Answers

Ubuntu Hardy: How to span windows over more than 1 screen?

Hi, Ive 3 screens, 2 nvidia graphiccards and all works fine with the nvidia binary driver and xinerama. I can maximize all windows an one screen, but now i need to span it over all 3 screens. Any ideas? thanks in advance. (3 Replies)
Discussion started by: mcW
3 Replies

6. AIX

Increasing screen display size

Hi, How can i increase the size of my display on AIX 5.3.What i mean is e.g if i do and ps -ef i would get some like: /data/app/oracle/product/10.2 /usr/bin/ksh /usr/local/bin/s i want it to show the whole thing on the screen without cutting it,because there is still space on the screen... (0 Replies)
Discussion started by: sellafrica1
0 Replies

7. AIX

CDE running but not display on screen

Runing p550Q via HMC I'd like to start using graphic interface CDE: lslpp -l | grep X11.Dt* X11.Dt.ToolTalk -- AIX CDE ToolTalk Support X11.Dt.bitmaps -- AIX CDE Bitmaps X11.Dt.helpmin -- AIX CDE Minimum Help Files X11.Dt.helprun -- AIX CDE Runtime Help X11.Dt.lib -- AIX CDE... (0 Replies)
Discussion started by: silves
0 Replies

8. Shell Programming and Scripting

screen display help

Hello All, I have a file that is formatted like this 1234556 1234567 1234588 1123888 1999999 1010101 1919191 1919191.... for a total of 26000 + lines how do I get a script to read lets say 50 lines at a time and display the output to the screen in column format around 5 or 6... (2 Replies)
Discussion started by: zilla30066
2 Replies

9. Shell Programming and Scripting

file display on screen on pg at time

hi can some body please help me...i'm been sitting here trying to figure how to do this..but still don't understand. Like each type of *.src (if any) in the given directory will be displayed on the screen one page at a time.... can someone explain how to do this..plz (1 Reply)
Discussion started by: zip_zip
1 Replies

10. Shell Programming and Scripting

controlling screen display

How can I control the screen output when trying to read a large file onto the screen x number of lines at a time. I'm trying to use this is a bourne shell script. I want to display 10 lines of a file, pause the screen so that a user can read the file, and then display the next 10 lines of the file,... (6 Replies)
Discussion started by: jrdnoland1
6 Replies
Login or Register to Ask a Question