How to get our assigned and free port number in Ubuntu

Asked by R.Lakshmi Narasimhan

I am trying to do some communication work for establishing a connection between systems through internet using C.For this i need to know the port addresses of my system which are free and which are assigned to processes.Please tell me whether there are any methods to find both of these categories.Also tell me is there any way to make the assigned user-defined port as free.

Question information

Language:
English Edit question
Status:
Answered
For:
Ubuntu Edit question
Assignee:
No assignee Edit question
Last query:
Last reply:

This question was reopened

Revision history for this message
R.Lakshmi Narasimhan (rlaknar) said :
#1

Also please tell me is it possible to trace the port number of service providers of ip.

Revision history for this message
fab-furnari (fab-furnari) said :
#2

Try with netstat -lnp to see the used port on your machine and the apps using them.

Revision history for this message
R.Lakshmi Narasimhan (rlaknar) said :
#3

pl tell me any special commands available in Linux to find it

Revision history for this message
R.Lakshmi Narasimhan (rlaknar) said :
#4

can u tell me for make the user-defined used ports as free.

Revision history for this message
fab-furnari (fab-furnari) said :
#5

Sorry but I don't understand your proposal...try with a more exaustive explanation

Revision history for this message
R.Lakshmi Narasimhan (rlaknar) said :
#6

1) For my work i have used some user-defined ports in my program. I need to make it unassigned. How to do.Is it any way using commands?
2) How to get the port number of my service provider?
3)I cant understand the output of netstat -lnp command to find the port number.Is there any other way to find it?

Revision history for this message
fab-furnari (fab-furnari) said :
#7

1) The simplest way to reuse a port used by another program (if is this the question) is to kill the process using that port or set port not assigned by the IANA board (see http://www.iana.org/assignments/port-numbers)

2) If you want to know the port used by a service just see in netstat -lnp the field "PID/Program name".

3) try to nmap yourself :-D

Can you help with this problem?

Provide an answer of your own, or ask R.Lakshmi Narasimhan for more information if necessary.

To post a message you must log in.