Views: 
              8,777β
          
          
                Votes:  4β
          
          
          
          
            
              
                
                Link: 
                  π See Original Answer on Ask Ubuntu β§ π
              
            
          
        
        
          
            URL: 
              https://askubuntu.com/q/1025026
          
          
            
            Title: 
              Is it possible to show ip address on top bar near the time?
            
          
          
            ID: 
              /2018/04/14/Is-it-possible-to-show-ip-address-on-top-bar-near-the-time_
            
          
          
            Created: 
               April 14, 2018
          
          
          
          
            
            Upload: 
              October 19, 2025
          
          
               Layout:  post
          
          
            
            TOC: 
              false
          
          
               Navigation:  false
          
          
               Copy to clipboard:  false
          
          
        
       
Screenshot
Discover your current DCHP IP address
This answer should work for most Ubuntu distributions. The first step is discovering your current IP address. According to this Linux & Unix answer it isnβt stored on disk in the same location across distributions. For a portable solution you need to use:
default_interface=$(route -n | awk '$1 == "0.0.0.0" {print $8; exit}')
ip_address=$(ifconfig "$default_interface" | awk 'sub(/.* inet addr:/, "") {print $1}')
echo $ip_address
192.168.1.66
Install Sysmonitor Indicator
You now need an Application Indicator that to letβs you pick and choose the information to display in the Systray / Application Notification Area. I use Sysmonitor Indicator. To summarize the installation instructions in the link:
sudo add-apt-repository ppa:fossfreedom/indicator-sysmonitor
sudo apt-get update
sudo apt-get install indicator-sysmonitor
You need to configure the name of the bash script that is called and the update interval in the Advanced tab of the Preferences panel:
Highlight the Custom option and click the Edit button:
Hereβs a complaint I have to the developer the input field for the command is abnormally small. You canβt see the whole command you are typing all at once and need arrow keys to scroll through it. Anyway assign the bash script filename. I used:
~/bin/indicator-sysmonitor-display
I already have a main bash script so I created an abbreviated version for this answer.
Create the script
Using the code from the first section create the file ~/bin/indicator-sysmonitor-display containing:
#!/bin/bash
default_interface=$(route -n | awk '$1 == "0.0.0.0" {print $8; exit}')
systray=$(ifconfig "$default_interface" | awk 'sub(/.* inet addr:/, "") {print $1}')
echo "$systray" # sysmon-indidicator will put echo string into systray for us.
exit 0


