Solaris - check ports/sockets which process has opened

/usr/proc/bin/pfiles $PID | egrep "sockname|port"

2
By: sengork
2009-07-04 08:26:54

These Might Interest You

  • Lists all opened sockets (not only listeners), no DNS resolution (so it's fast), the process id and the user holding the socket. Previous samples were limiting to TCP too, this also lists UDP listeners. Show Sample Output


    1
    netstat -anpe
    anarcat · 2011-12-06 18:27:09 0
  • netstat will list all open ports on the system, unix sockets, tcp sockets and udp sockets. the t flag limits to tcp ports the l flag limits to listening ports and the n flag disables the translation of port to service ( ie :25 displayed instead of :smtp ). then grep for the port you are interested in preceeded by a colon. Show Sample Output


    0
    netstat -tln | grep :25
    Peteches · 2013-11-12 16:47:06 0
  • shows opened ports on machine in continuous mode (refreshing every 10 sec) Show Sample Output


    0
    netstat -tulpnc
    altern · 2011-04-20 07:30:31 1

  • 0
    netstat -tlvp
    onurgu · 2010-09-05 12:00:03 0

What do you think?

Any thoughts on this command? Does it work on your machine? Can you do the same thing with only 14 characters?

You must be signed in to comment.

What's this?

commandlinefu.com is the place to record those command-line gems that you return to again and again. That way others can gain from your CLI wisdom and you from theirs too. All commands can be commented on, discussed and voted up or down.

Share Your Commands



Stay in the loop…

Follow the Tweets.

Every new command is wrapped in a tweet and posted to Twitter. Following the stream is a great way of staying abreast of the latest commands. For the more discerning, there are Twitter accounts for commands that get a minimum of 3 and 10 votes - that way only the great commands get tweeted.

» http://twitter.com/commandlinefu
» http://twitter.com/commandlinefu3
» http://twitter.com/commandlinefu10

Subscribe to the feeds.

Use your favourite RSS aggregator to stay in touch with the latest commands. There are feeds mirroring the 3 Twitter streams as well as for virtually every other subset (users, tags, functions,…):

Subscribe to the feed for: