- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: how to get the service name from the port numb...
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-24-2004 07:23 PM
11-24-2004 07:23 PM
how to get the service name from the port numbers
I can able to get the port numbers which are having established connections but i could not able to get the services name which are using the port numbers thru any command . i don't want to use the services file because in general some of the port numbers are not listed in services example oracle listener uses listener.ora file instead of services to refer port number .
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-24-2004 07:33 PM
11-24-2004 07:33 PM
Re: how to get the service name from the port numbers
$ cat /etc/services
Regards, MB.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-24-2004 07:34 PM
11-24-2004 07:34 PM
Re: how to get the service name from the port numbers
use the lsof command to get the service and port.
eg: for port 80 which is a tcp service.
lsof -i tcp:80
and
lsof -i:80
you can get the lsof package from following link .install it
http://forums1.itrc.hp.com/service/forums/questionanswer.do?threadId=653690
regds,
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-24-2004 08:12 PM
11-24-2004 08:12 PM
Re: how to get the service name from the port numbers
netstat -a|grep -e ^tcp -e ^udp
The command will replace all the know port
numbers by their names (/etc/services).
In c there is a function to 'parse' the
services file : getservbyport()
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-24-2004 08:14 PM
11-24-2004 08:14 PM
Re: how to get the service name from the port numbers
There is no hard and fast rule that every port will have a servicename associated with it. As you said correctly the services lookup file is /etc/services and if the port is not specified there, then there won't be any service name associated with it.
-Sri
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-25-2004 04:39 PM
11-25-2004 04:39 PM
Re: how to get the service name from the port numbers
lsof is the way to go ...
Regards
Gerhard