How can I found out which ports a program is using on his execution?
I am using a Ubuntu 14.04 Server and the program "SMcli". But the program shows on every execution "Network errors were detected while connecting to storage system". But before we changed the location everything was working fine.
Now I need to know which ports this program is using. Then I can look which ports the target is listening.
Try to use
netstat -tunap
ornetstat -tunlp
before the program starts and after the program starts.If your program is
nc
(for example), you can do:or
Here i have considered only IPv4 and assumed that you have only one instance of the service running. If you need to consider any one of the above, then you should look for the service by the name and then decide which one is desired:
Replace
nc
with the service name you want to look for.Example: