Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!


Click here to return to the 'Terminal commands for other port identification' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Terminal commands for other port identification
Authored by: Palijn on Jun 29, '02 06:05:10AM

For those of you who don't want to use a shareware for this, it is fairly easy to find out what port a TCP connection uses with the Terminal.
Just open the Terminal and type "netstat | grep tcp" to get all the open TCP connections.
For a particular connection to a server server.com , just type "netstat | grep server.com" and you should get all open connections to/from server.com .
The FTP control connection is indicated by a server.com.ftp text on the 5th column (for the curious, .ftp is really port 21 translated to the "ftp" text by a lookup to the /etc/services table. Unixism...)
The various (if existing) FTP DATA connections - i.e. the one you want to control the bandwidth - are displayed with server.com.XX where XX is really the port used by the data transfer.

Interesting note:
Usually the data port occurs to be 20 if you don't use passive FTP and you have only one FTP transfer running at a time....time-saving default ;-)



[ Reply to This | # ]
Terminal commands for other port identification
Authored by: Embro on Jun 30, '02 11:13:48PM

Thanks for that info. I really like IPNetMonitor but I knew there had to be a terminal commmand that the info was coming from. Gotta love Unix :-) The author(s) of Carrafix mention on their web site that they are/were going to make the source available. I emailed them today about his because I'd love to make this more automated. It seems that this should be a normal network function since oversaturating the channel just kills the rest of your network flow.

I'll post back here if/when any progress is made.



[ Reply to This | # ]
More terminal commands for other port identification
Authored by: iv on Jul 02, '02 02:04:28AM

If you want more information than what netstat gives you, try lsof.

E.g. sudo lsof -i shows all open network sockets, their status, commands that opened them and their PID etc. This way you can easily see, what all those open ports do.

iv

[ Reply to This | # ]