- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- GETTING IPADDRESS
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
Forums
Discussions
Discussions
Discussions
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
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
11-16-2001 01:53 AM
11-16-2001 01:53 AM
When I do "who am I -R "the output gives me my terminal no. and the hostname (if defined in /etc/hosts) or ipaddress if not defined in /etc/hosts file.
Are there any other ways by which I can get the ipaddress for the connection ?
Regards
Hemant
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-16-2001 01:58 AM
11-16-2001 01:58 AM
Re: GETTING IPADDRESS
You can grep for your login name / tty from this list, if you want.
HTH

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-16-2001 02:02 AM
11-16-2001 02:02 AM
Re: GETTING IPADDRESS
you can try :
who -u | grep $(who am i| awk '{ print $2 }')
Fr??d??ric
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-16-2001 02:02 AM
11-16-2001 02:02 AM
Re: GETTING IPADDRESS
who am i -u | awk '{print $8}'
Party on Dude!
James
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-16-2001 02:03 AM
11-16-2001 02:03 AM
Re: GETTING IPADDRESS
Do a who -R and and filter out the hostname. with nslookup you should be able to get te ip-adress.
Gideon
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-16-2001 02:18 AM
11-16-2001 02:18 AM
Re: GETTING IPADDRESS
Thanks for you very fast replies but I want to get ipaddress without using "who" or /etc/hosts for a session.
The situation is like this,
In /etc/hosts file 2 different ip address have same hostname but who am i will always show me this common "hostname" so I need to avoid using "who" and /etc/hosts file.
So based on say terminal name which will be different for both.
That is what I meant.
Hemant
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-16-2001 02:34 AM
11-16-2001 02:34 AM
Re: GETTING IPADDRESS
try netstat -an
Gideon
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-16-2001 04:44 AM
11-16-2001 04:44 AM
SolutionThis program emulates a 'who -u' by reading the utmpx file and displaying a list of users currently logged in, but prints the IP address as stored in the utmpx entry instead of resolving the hostname.
Compile as follows (you'll need gcc or the ANSI C compiler)
$ cc -Ae mywho.c -o mywho
Have fun...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-16-2001 05:39 AM
11-16-2001 05:39 AM
Re: GETTING IPADDRESS
i.e:
last -20 -R pts/ty
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-16-2001 05:53 AM
11-16-2001 05:53 AM
Re: GETTING IPADDRESS
ip=`env | grep TERM`
nslookup $ip
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-16-2001 06:20 AM
11-16-2001 06:20 AM
Re: GETTING IPADDRESS
getip hostname
returns the IP address of the host.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-16-2001 06:21 AM
11-16-2001 06:21 AM
Re: GETTING IPADDRESS
Steven Gillard has provided the a very nice C program and these has solved my problem.
Thanks very much Steven !
And also thanks to all who spend there time giving me a solution.
And also THANKS to HP forum.
Regards
Hemant