- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: Display current IP address
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Discussions
Discussions
Forums
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО07-23-2007 11:05 PM
тАО07-23-2007 11:05 PM
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО07-23-2007 11:15 PM
тАО07-23-2007 11:15 PM
Re: Display current IP address
this may lead to a multiple line output, if more than one interface is configured:
netstat -in | awk 'NR>1 && !/lo/ {print $4}'
To get the first entry only:
netstat -in | awk 'NR>1 && !/lo/ {print $4; exit}'
mfG Peter
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО07-23-2007 11:38 PM
тАО07-23-2007 11:38 PM
Re: Display current IP address
You could add the following to /etc/profile or the user's .profile:
export REMOTE_HOST=$(who -mu | awk '{print $8}')
export REMOTE_IP=$(/usr/sbin/arp ${REMOTE_HOST} | awk '{gsub(/[()]/,"",$2)}END{print $2}')
Then just echo ${REMOTE_IP}.
PCS
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО07-24-2007 12:00 AM
тАО07-24-2007 12:00 AM
Re: Display current IP address
someting like?
------
#!/usr/bin/ksh
unset IPADDRESS
IPADDRESS=$(/usr/bin/who am i -T|awk '{print $9}')
export $IPADDRESS:0.0
------
Regards,
Robert-Jan
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО07-24-2007 01:40 AM
тАО07-24-2007 01:40 AM
Re: Display current IP address
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО07-24-2007 06:29 AM
тАО07-24-2007 06:29 AM
Re: Display current IP address
who -muR | awk '{print $NF}'
or
MYIP=$(who -muR | awk '{print $NF}')
Bill Hassell, sysadmin
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО07-24-2007 05:36 PM
тАО07-24-2007 05:36 PM
Re: Display current IP address
you can use this command:
who -mu|awk '{print $8}'
Thanks & Regards
A. Aashique
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО07-24-2007 05:37 PM
тАО07-24-2007 05:37 PM
Re: Display current IP address
Use this command:
who -u|awk '{print $8}'
Thanks & Regards
A. Aashique
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО07-24-2007 09:37 PM