COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME dhclient3 817 root 5u IPv4 3745 0t0 UDP *:bootpc sshd 1014 root 3u IPv4 4770 0t0 TCP *:ssh (LISTEN) sshd 1014 root 4u IPv6 4772 0t0 TCP *:ssh (LISTEN) postgres 1117 postgres 3u IPv6 5608 0t0 TCP localhost:7175 (LISTEN) postgres 1117 postgres 4u IPv4 5609 0t0 TCP localhost:7175 (LISTEN) postgres 1117 postgres 6u IPv6 5622 0t0 UDP localhost:56982->localhost:56982 postgres 1487 postgres 6u IPv6 5622 0t0 UDP localhost:56982->localhost:56982 postgres 1488 postgres 6u IPv6 5622 0t0 UDP localhost:56982->localhost:56982 postgres 1489 postgres 6u IPv6 5622 0t0 UDP localhost:56982->localhost:56982 postgres 1490 postgres 6u IPv6 5622 0t0 UDP localhost:56982->localhost:56982 cupsd 1539 root 5u IPv6 5710 0t0 TCP localhost:ipp (LISTEN) cupsd 1539 root 6u IPv4 5711 0t0 TCP localhost:ipp (LISTEN) sshd 27689 root 3r IPv4 80824 0t0 TCP 172.16.221.137:ssh->vayu:59742 (ESTABLISHED) sshd 27689 root 8u IPv6 80950 0t0 TCP localhost:6010 (LISTEN) sshd 27689 root 9u IPv4 80951 0t0 TCP localhost:6010 (LISTEN)
Tested in Linux and OSX Show Sample Output
While `lsof` will work, why not use the tool designed explicitly for this job? (If not run as root, you will only see the names of PID you own) Show Sample Output
Check open TCP and UDP ports Show Sample Output
This option is much faster, as it checks only network nodes. Show Sample Output
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.
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.
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
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: