Questions tagged [netstat]

analysis tool for statistics about active connections, open sockets, routing tables; in general the networking subsystem.

253 questions
701
votes
8 answers

Finding the PID of the process using a specific port?

I am installing hadoop on my Ubuntu system. When I start it, it reports that port 9000 is busy. I used: netstat -nlp|grep 9000 to see if such a port exists and I got this: tcp 0 0 127.0.0.1:9000 0.0.0.0:* …
wuchang
  • 7,457
  • 5
  • 16
  • 16
114
votes
6 answers

How to do an if statement from the result of an executed command

I am trying to do an IF statement from the output of an executed commmand. Here is how I am trying to do it, but it doesn't work. Does anyone know the right way to do this? if [ "`netstat -lnp | grep ':8080'`" == *java* ]; then echo "Found a…
djangofan
  • 4,002
  • 5
  • 21
  • 19
95
votes
20 answers

What's the easiest way to find an unused local port?

What's the easiest way to find an unused local port? Currently I'm using something similar to this: port=$RANDOM quit=0 while [ "$quit" -ne 1 ]; do netstat -a | grep $port >> /dev/null if [ $? -gt 0 ]; then quit=1 else port=`expr…
mybuddymichael
  • 1,105
  • 1
  • 7
  • 7
70
votes
4 answers

How do I know what service is running on a particular port in linux?

I am trying to run weblogic server on my linux machine and I am getting the following error : ERROR: transport error 202: bind failed: Address already in use ERROR: JDWP Transport dt_socket failed to initialize, TRANSPORT_INIT(510) JDWP exit error…
Geek
  • 6,548
  • 15
  • 46
  • 70
43
votes
3 answers

alternative to "netstat -s"

netstat -s prints out a lot of very detailed protocol statistics like number of TCP reset messages received or number of ICMP "echo request" messages sent or number of packets dropped because of a missing route. When in Linux netstat is considered…
Martin
  • 7,284
  • 40
  • 125
  • 208
37
votes
4 answers

How to check that a daemon is listening on what interface?

Ex.: an sshd is configured to only listen on wlan0. So. Besides checking the sshd_config how can I check that a daemon is listening on what inerface? netstat can do it? how? (OS: openwrt or scientific linux or openbsd) UPDATE: I thought sshd could…
gasko peter
  • 5,434
  • 22
  • 83
  • 145
33
votes
3 answers

tcp6 in the output netstat

What does column 'tcp6' mean on output netstat? Please anyone explain the follow output of netstat: tcp6 0 0 dmz.local.net:www 5.140.235.6%14631:49964 ESTABLISHED 21393/apache2 What does tcp6 mean?
ReDSerpenT
  • 433
  • 1
  • 4
  • 5
31
votes
2 answers

Why is netstat deprecated?

I've heard many times now that it is, and I'm mostly using ss now. But I sometimes get frustrated with differences between the two, and I would love some insight. Also, I can't be the only one who thinks of Hitler when using ss. Not a great name.
onlyanegg
  • 975
  • 2
  • 8
  • 9
30
votes
2 answers

netstat — why are IPv4 daemons listening to ports listed only in -A inet6?

I have a computer with: Linux superhost 3.2.0-4-amd64 #1 SMP Debian 3.2.60-1+deb7u3 x86_64 GNU/Linux It runs Apache on port 80 on all interfaces, and it does not show up in netstat -planA inet, however it unexpectedly can be found in netstat -planA…
Mischa Arefiev
  • 868
  • 1
  • 7
  • 15
29
votes
4 answers

Logging outgoing connections as they happen

Is there a way to log to file all the outgoing connections that a process creates? I am aware of netstat but that seems to be more of a snapshot of a point in time rather than something that runs and logs information over a period. I only need the…
Rich
  • 4,439
  • 10
  • 33
  • 34
29
votes
6 answers

chromium browser (pepperflashplugin) opening listening ports on 0.0.0.0:5353

I am using chromium browser (chrome) with pepperflashplugin in Debian. I have noticed, chromium/pepperflashplugin opens a listening port on my public interface 0.0.0.0:5353 as seen with netstat: netstat -lptun Proto Recv-Q Send-Q Local Address …
Martin Vegter
  • 69
  • 66
  • 195
  • 326
28
votes
5 answers

meaning of Netstat local address column

When I do netstat -ntlp there is a column called Local Address: sometimes it would output IP address as 0.0.0.0:7180 and sometimes 127.0.0.1:9001 What's the implications of both notations? Does specific IP address act like a filter for incoming…
user1678312
  • 543
  • 2
  • 5
  • 7
18
votes
3 answers

port being in use not displayed in netstat output

In what scenarios port being used by a process don't show up in netstat -a output? I'm running jenkins on my machine. It's listening on port 8080. I'm trying to start another process that tries to bind on same port and it fails with error that port…
s.r
  • 341
  • 1
  • 2
  • 6
15
votes
6 answers

netstat: See process name like in `ps aux`

The postfix daemon has only the name "master" if I use netsat like this: root@myhost# netstat -tulpen| grep master tcp 0 0 127.0.0.1:25 0.0.0.0:* LISTEN 0 53191445 13640/master If I use ps I get a more verbose name: root@myhost# ps…
guettli
  • 1,309
  • 3
  • 22
  • 40
14
votes
3 answers

Netstat output line width limit

When executing netstat, I find that the command's output width is limited regardless of the console size, in contrast with other commands such as ps that seem to get adjusted. So for example: $ sudo netstat -natp | grep sshd tcp 0 0…
Wtower
  • 335
  • 1
  • 3
  • 13
1
2 3
16 17