LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   Display current IP address (https://www.linuxquestions.org/questions/linux-software-2/display-current-ip-address-572019/)

ust 07-24-2007 08:10 PM

Display current IP address
 
I would like to have a shell script that can display the user IP address , I think it is similiar to "who -m | awk -F: '{ print $6}'" , this script is used to display what IP is when the user run the program . thx in advance.

stress_junkie 07-25-2007 01:05 PM

How about this?
Code:

/sbin/ifconfig | grep "inet addr" | awk '{print $2}'

GregLee 07-25-2007 01:08 PM

Or "hostname -i".


All times are GMT -5. The time now is 10:29 AM.