<s>
In	O
computing	O
,	O
netstat	B-Application
(	O
network	O
statistics	O
)	O
is	O
a	O
command-line	B-Application
network	B-Application
utility	I-Application
that	O
displays	O
network	O
connections	O
for	O
Transmission	B-Protocol
Control	I-Protocol
Protocol	I-Protocol
(	O
both	O
incoming	O
and	O
outgoing	O
)	O
,	O
routing	B-Protocol
tables	I-Protocol
,	O
and	O
a	O
number	O
of	O
network	O
interface	O
(	O
network	B-Protocol
interface	I-Protocol
controller	I-Protocol
or	O
software-defined	B-General_Concept
network	I-General_Concept
interface	I-General_Concept
)	O
and	O
network	O
protocol	O
statistics	O
.	O
</s>
<s>
It	O
is	O
available	O
on	O
Unix	B-Application
,	O
Plan	B-Operating_System
9	I-Operating_System
,	O
Inferno	B-Operating_System
,	O
and	O
Unix-like	B-Operating_System
operating	I-Operating_System
systems	I-Operating_System
including	O
macOS	B-Application
,	O
Linux	B-Application
,	O
Solaris	B-Application
and	O
BSD	B-Operating_System
.	O
</s>
<s>
It	O
is	O
also	O
available	O
on	O
IBM	B-Application
OS/2	I-Application
and	O
on	O
Microsoft	O
Windows	O
NT-based	O
operating	B-General_Concept
systems	I-General_Concept
including	O
Windows	B-Application
XP	I-Application
,	O
Windows	B-Application
Vista	I-Application
,	O
Windows	B-Device
7	I-Device
,	O
Windows	B-Application
8	I-Application
and	O
Windows	B-Operating_System
10	I-Operating_System
.	O
</s>
<s>
On	O
Linux	B-Application
this	O
program	O
is	O
mostly	O
obsolete	O
,	O
although	O
still	O
included	O
in	O
many	O
distributions	O
.	O
</s>
<s>
On	O
Linux	B-Application
,	O
netstat	B-Application
(	O
part	O
of	O
"	O
net-tools	O
"	O
)	O
is	O
superseded	O
by	O
ss	B-Protocol
(	O
part	O
of	O
iproute2	B-Protocol
)	O
.	O
</s>
<s>
The	O
replacement	O
for	O
netstat	B-Application
-r	O
is	O
ip	B-Protocol
route	O
,	O
the	O
replacement	O
for	O
netstat	B-Application
-i	O
is	O
ip	B-Protocol
-s	O
link	O
,	O
and	O
the	O
replacement	O
for	O
netstat	B-Application
-g	O
is	O
ip	B-Protocol
maddr	O
,	O
all	O
of	O
which	O
are	O
recommended	O
instead	O
.	O
</s>
<s>
Netstat	B-Application
provides	O
statistics	O
for	O
the	O
following	O
:	O
</s>
<s>
Proto	O
–	O
The	O
name	O
of	O
the	O
protocol	O
(	O
TCP	B-Protocol
or	O
UDP	B-Protocol
)	O
.	O
</s>
<s>
Local	O
Address	O
–	O
The	O
IP	B-Protocol
address	I-Protocol
of	O
the	O
local	O
computer	O
and	O
the	O
port	B-Protocol
number	I-Protocol
being	O
used	O
.	O
</s>
<s>
The	O
name	O
of	O
the	O
local	O
computer	O
that	O
corresponds	O
to	O
the	O
IP	B-Protocol
address	I-Protocol
and	O
the	O
name	O
of	O
the	O
port	B-Protocol
is	O
shown	O
unless	O
the	O
parameter	O
is	O
specified	O
.	O
</s>
<s>
If	O
the	O
port	B-Protocol
is	O
not	O
yet	O
established	O
,	O
the	O
port	B-Protocol
number	I-Protocol
is	O
shown	O
as	O
an	O
asterisk	O
.	O
</s>
<s>
Foreign	O
Address	O
–	O
The	O
IP	B-Protocol
address	I-Protocol
and	O
port	B-Protocol
number	I-Protocol
of	O
the	O
remote	O
computer	O
to	O
which	O
the	O
socket	O
is	O
connected	O
.	O
</s>
<s>
The	O
names	O
that	O
corresponds	O
to	O
the	O
IP	B-Protocol
address	I-Protocol
and	O
the	O
port	B-Protocol
are	O
shown	O
unless	O
the	O
parameter	O
is	O
specified	O
.	O
</s>
<s>
If	O
the	O
port	B-Protocol
is	O
not	O
yet	O
established	O
,	O
the	O
port	B-Protocol
number	I-Protocol
is	O
shown	O
as	O
an	O
asterisk	O
( *	O
)	O
.	O
</s>
<s>
State	O
–	O
Indicates	O
the	O
state	O
of	O
a	O
TCP	B-Protocol
connection	O
.	O
</s>
<s>
For	O
more	O
information	O
about	O
the	O
states	O
of	O
a	O
TCP	B-Protocol
connection	O
,	O
see	O
.	O
</s>
<s>
Parameters	O
used	O
with	O
this	O
command	B-Application
must	O
be	O
prefixed	O
with	O
a	O
hyphen	O
(	O
)	O
rather	O
than	O
a	O
slash	O
(	O
)	O
.	O
</s>
<s>
Name	O
Description	O
Windows	B-Application
ReactOS	B-Application
macOS	B-Application
BSD	B-Operating_System
NetBSD	B-Device
FreeBSD	B-Operating_System
Linux	B-Application
Solaris	O
OS/2	O
Displays	O
all	O
active	O
connections	O
and	O
the	O
TCP	B-Protocol
and	I-Protocol
UDP	I-Protocol
ports	I-Protocol
on	O
which	O
the	O
computer	O
is	O
listening	O
.	O
</s>
<s>
Displays	O
the	O
binary	O
(	O
executable	O
)	O
program	O
's	O
name	O
involved	O
in	O
creating	O
each	O
connection	O
or	O
listening	O
port	B-Protocol
.	O
</s>
<s>
(	O
Windows	B-Application
XP	I-Application
,	O
Windows	B-Application
Server	I-Application
2003	I-Application
and	O
newer	O
Windows	B-Application
operating	I-Application
systems	I-Application
;	O
not	O
Microsoft	B-Application
Windows	I-Application
2000	I-Application
or	O
older	O
)	O
.	O
</s>
<s>
Causes	O
to	O
report	O
the	O
total	O
number	O
of	O
bytes	B-Application
of	O
traffic	O
.	O
</s>
<s>
Displays	O
ethernet	O
statistics	O
,	O
such	O
as	O
the	O
number	O
of	O
bytes	B-Application
and	O
packets	O
sent	O
and	O
received	O
.	O
</s>
<s>
Displays	O
fully	B-Protocol
qualified	I-Protocol
domain	I-Protocol
names	I-Protocol
<FQDN>	O
for	O
foreign	O
addresses	O
(	O
only	O
available	O
on	O
Windows	B-Application
Vista	I-Application
and	O
newer	O
operating	B-General_Concept
systems	I-General_Concept
)	O
.	O
</s>
<s>
Address	O
Family	O
Limits	O
display	O
to	O
a	O
particular	O
socket	O
address	O
family	O
,	O
unix	B-Application
,	O
inet	O
,	O
inet6	O
Displays	O
multicast	O
group	O
membership	O
information	O
for	O
both	O
IPv4	O
and	O
IPv6	B-Protocol
(	O
may	O
only	O
be	O
available	O
on	O
newer	O
operating	B-General_Concept
systems	I-General_Concept
)	O
Displays	O
network	O
interfaces	O
and	O
their	O
statistics	O
Displays	O
the	O
memory	O
statistics	O
for	O
the	O
networking	O
code	O
(	O
STREAMS	O
statistics	O
on	O
Solaris	B-Application
)	O
.	O
</s>
<s>
Displays	O
active	O
TCP	B-Protocol
connections	O
,	O
however	O
,	O
addresses	O
and	O
port	B-Protocol
numbers	I-Protocol
are	O
expressed	O
numerically	O
and	O
no	O
attempt	O
is	O
made	O
to	O
determine	O
names	O
.	O
</s>
<s>
Displays	O
active	O
TCP	B-Protocol
connections	O
and	O
includes	O
the	O
process	O
id	O
(	O
PID	O
)	O
for	O
each	O
connection	O
.	O
</s>
<s>
You	O
can	O
find	O
the	O
application	O
based	O
on	O
the	O
PID	O
in	O
the	O
Processes	O
tab	O
in	O
Windows	B-Application
Task	O
Manager	O
.	O
</s>
<s>
This	O
parameter	O
is	O
available	O
on	O
Microsoft	B-Application
Windows	I-Application
XP	I-Application
,	O
Windows	B-Application
Server	I-Application
2003	I-Application
,	O
and	O
Windows	B-Application
2000	I-Application
if	O
a	O
hotfix	O
is	O
applied	O
.	O
</s>
<s>
In	O
this	O
case	O
,	O
protocol	O
can	O
be	O
tcp	B-Protocol
,	O
udp	B-Protocol
,	O
tcpv6	O
,	O
or	O
udpv6	O
.	O
</s>
<s>
If	O
this	O
parameter	O
is	O
used	O
with	O
to	O
display	O
statistics	O
by	O
protocol	O
,	O
protocol	O
can	O
be	O
tcp	B-Protocol
,	O
udp	B-Protocol
,	O
icmp	B-Protocol
,	O
ip	B-Protocol
,	O
tcpv6	O
,	O
udpv6	O
,	O
icmpv6	B-Protocol
,	O
or	O
ipv6	B-Protocol
.	O
</s>
<s>
Show	O
which	O
processes	O
are	O
using	O
which	O
sockets	O
(	O
similar	O
to	O
-b	O
under	O
Windows	B-Application
)	O
(	O
you	O
must	O
be	O
root	O
to	O
do	O
this	O
)	O
protocol	O
Shows	O
connections	O
for	O
the	O
protocol	O
specified	O
by	O
protocol	O
.	O
</s>
<s>
In	O
this	O
case	O
,	O
protocol	O
can	O
be	O
ip	B-Protocol
,	O
ipv6	B-Protocol
,	O
icmp	B-Protocol
,	O
icmpv6	B-Protocol
,	O
igmp	O
,	O
udp	B-Protocol
,	O
tcp	B-Protocol
,	O
or	O
rawip	O
.	O
</s>
<s>
Displays	O
the	O
contents	O
of	O
the	O
IP	B-Protocol
routing	B-Protocol
table	I-Protocol
.	O
</s>
<s>
(	O
This	O
is	O
equivalent	O
to	O
the	O
route	O
print	O
command	B-Application
under	O
Windows	B-Application
.	O
)	O
</s>
<s>
By	O
default	O
,	O
statistics	O
are	O
shown	O
for	O
the	O
TCP	B-Protocol
,	O
UDP	B-Protocol
,	O
ICMP	B-Protocol
,	O
and	O
IP	B-Protocol
protocols	I-Protocol
.	O
</s>
<s>
If	O
the	O
IPv6	B-Protocol
protocol	O
for	O
Windows	B-Application
XP	I-Application
is	O
installed	O
,	O
statistics	O
are	O
shown	O
for	O
the	O
TCP	B-Protocol
over	O
IPv6	B-Protocol
,	O
UDP	B-Protocol
over	O
IPv6	B-Protocol
,	O
ICMPv6	B-Protocol
,	O
and	O
IPv6	B-Protocol
protocols	O
.	O
</s>
<s>
Display	O
only	O
TCP	B-Protocol
connections	O
.	O
</s>
<s>
Display	O
only	O
UDP	B-Protocol
connections	O
.	O
</s>
<s>
Display	O
wide	O
output	O
-	O
does	O
n't	O
truncate	O
hostnames	O
or	O
IPv6	B-Protocol
addresses	O
Displays	O
NetworkDirect	O
connections	O
,	O
listeners	O
,	O
and	O
shared	O
endpoints	O
.	O
</s>
<s>
Displays	O
the	O
TCP	B-Protocol
connection	O
template	O
for	O
all	O
connections.Cannot	O
be	O
combined	O
with	O
the	O
other	O
options	O
.	O
</s>
<s>
When	O
used	O
in	O
conjunction	O
with	O
it	O
will	O
display	O
the	O
sequence	O
of	O
components	O
involved	O
in	O
creating	O
the	O
connection	O
or	O
listening	O
port	B-Protocol
for	O
all	O
executables	O
.	O
</s>
<s>
Press	O
CTRL+C	O
to	O
stop	O
the	O
redisplay	O
.	O
</s>
<s>
If	O
this	O
parameter	O
is	O
omitted	O
,	O
netstat	B-Application
prints	O
the	O
selected	O
information	O
only	O
once	O
.	O
</s>
<s>
Displays	O
help	O
at	O
the	O
command	B-Application
prompt	O
.	O
</s>
<s>
Displays	O
help	O
at	O
the	O
command	B-Application
prompt	O
.	O
</s>
<s>
Displays	O
help	O
at	O
the	O
command	B-Application
prompt	O
.	O
</s>
<s>
On	O
macOS	B-Application
,	O
BSD	B-Operating_System
systems	O
,	O
Linux	B-Application
distributions	O
,	O
and	O
Microsoft	B-Application
Windows	I-Application
:	O
</s>
<s>
To	O
display	O
the	O
statistics	O
for	O
only	O
the	O
TCP	B-Protocol
or	O
UDP	B-Protocol
protocols	I-Protocol
,	O
type	O
one	O
of	O
the	O
following	O
commands	O
:	O
</s>
<s>
On	O
Unix-like	B-Operating_System
systems	I-Operating_System
:	O
</s>
<s>
To	O
continuously	O
display	O
open	O
TCP	B-Protocol
and	O
UDP	B-Protocol
connections	O
numerically	O
and	O
also	O
which	O
program	O
is	O
using	O
them	O
on	O
Linux	B-Application
:	O
</s>
<s>
On	O
Microsoft	B-Application
Windows	I-Application
:	O
</s>
<s>
To	O
display	O
active	O
TCP	B-Protocol
connections	O
and	O
the	O
process	O
IDs	O
every	O
5	O
seconds	O
,	O
type	O
the	O
following	O
command	B-Application
(	O
works	O
on	O
NT	O
based	O
systems	O
only	O
,	O
or	O
Windows	B-Application
2000	I-Application
with	O
hotfix	O
)	O
:	O
</s>
<s>
To	O
display	O
active	O
TCP	B-Protocol
connections	O
and	O
the	O
process	O
IDs	O
using	O
numerical	O
form	O
,	O
type	O
the	O
following	O
command	B-Application
(	O
works	O
on	O
NT	O
based	O
systems	O
only	O
,	O
or	O
Windows	B-Application
2000	I-Application
with	O
hotfix	O
)	O
:	O
</s>
<s>
Command	B-Application
Explanation	O
netstat	B-Application
-a	O
Shows	O
all	O
sockets	O
,	O
both	O
listening	O
and	O
non-listening	O
,	O
all	O
protocols	O
like	O
TCP	B-Protocol
,	O
UDP	B-Protocol
etc	O
.	O
</s>
<s>
netstat	B-Application
-at	O
Shows	O
only	O
TCP	B-Protocol
connections	O
(	O
-au	O
shows	O
only	O
UDP	B-Protocol
connections	O
)	O
netstat	B-Application
-ant	O
Shows	O
all	O
TCP	B-Protocol
connections	O
with	O
no	O
DNS	O
resolution	O
(	O
show	O
IP	B-Protocol
addresses	I-Protocol
instead	O
)	O
.	O
</s>
<s>
netstat	B-Application
-al	O
Shows	O
only	O
listening	O
sockets	O
.	O
</s>
<s>
netstat	B-Application
-aep	O
Also	O
show	O
PID	O
and	O
to	O
which	O
program	O
each	O
socket	O
belongs	O
,	O
e	O
adds	O
extra	O
info	O
like	O
the	O
user	O
.	O
</s>
<s>
netstat	B-Application
-s	O
>	O
file2.txt	O
Shows	O
network	O
statistics	O
.	O
</s>
<s>
netstat	B-Application
-r	O
Shows	O
kernel	O
routing	O
information	O
.	O
</s>
<s>
This	O
is	O
the	O
same	O
output	O
as	O
route	O
-e	O
.	O
netstat	B-Application
-i	O
Displays	O
a	O
table	O
of	O
all	O
network	O
interfaces	O
.	O
</s>
<s>
netstat	B-Application
-ct	O
Displays	O
TCP	B-Protocol
connections	O
continuously.netstat	O
-gDisplay	O
multicast	O
group	O
membership	O
information	O
for	O
IPv4	O
and	O
IPv6.netstat	O
-lntuDisplay	O
all	O
services	O
listening	O
for	O
TCP	B-Protocol
and	O
UDP	B-Protocol
,	O
all	O
free	O
open	O
ports	O
on	O
the	O
local	O
machine.netstat	O
-atnp	O
|	O
grep	O
ESTADisplays	O
all	O
currently	O
"	O
established	O
"	O
TCP	B-Protocol
connections	O
.	O
</s>
<s>
Netstat	B-Application
uses	O
an	O
asterisk	O
*	O
as	O
a	O
wildcard	O
which	O
means	O
"	O
any	O
"	O
.	O
</s>
<s>
Under	O
"	O
Local	O
Address	O
"	O
*	O
,	O
in	O
*	O
:smtp	O
,	O
means	O
the	O
process	O
is	O
listening	O
on	O
all	O
of	O
the	O
network	O
interfaces	O
the	O
machine	O
has	O
for	O
the	O
port	B-Protocol
mapped	O
as	O
smtp	O
(	O
see	O
/etc/services	O
for	O
service	O
resolution	O
)	O
.	O
</s>
<s>
The	O
first	O
*	O
,	O
in	O
*	O
:*	O
,	O
means	O
connections	O
can	O
come	O
from	O
any	O
IP	B-Protocol
address	I-Protocol
,	O
and	O
the	O
second	O
*	O
,	O
in	O
*	O
:*	O
,	O
means	O
the	O
connection	O
can	O
originate	O
from	O
any	O
port	B-Protocol
on	O
the	O
remote	O
machine	O
.	O
</s>
<s>
Some	O
versions	O
of	O
netstat	B-Application
lack	O
explicit	O
field	O
delimiters	O
in	O
their	O
printf-generated	O
output	O
,	O
leading	O
to	O
numeric	O
fields	O
running	O
together	O
and	O
thus	O
corrupting	O
the	O
output	O
data	O
.	O
</s>
<s>
Under	O
Linux	B-Application
,	O
raw	O
data	O
can	O
often	O
be	O
obtained	O
from	O
the	O
/proc/net/dev	O
to	O
work	O
around	O
the	O
printf	B-Language
output	O
corruption	O
arising	O
in	O
netstat	B-Application
's	O
network	O
interface	O
statistics	O
summary	O
,	O
netstat	B-Application
-i	O
,	O
until	O
such	O
time	O
as	O
the	O
problem	O
is	O
corrected	O
.	O
</s>
<s>
On	O
the	O
Windows	B-Application
platform	O
,	O
netstat	B-Application
information	O
can	O
be	O
retrieved	O
by	O
calling	O
the	O
GetTcpTable	O
and	O
GetUdpTable	O
functions	O
in	O
the	O
IP	B-Protocol
Helper	O
API	B-Application
,	O
or	O
IPHLPAPI.DLL	O
.	O
</s>
<s>
Information	O
returned	O
includes	O
local	O
and	O
remote	O
IP	B-Protocol
addresses	I-Protocol
,	O
local	O
and	O
remote	O
ports	O
,	O
and	O
(	O
for	O
GetTcpTable	O
)	O
TCP	B-Protocol
status	O
codes	O
.	O
</s>
<s>
In	O
addition	O
to	O
the	O
command-line	B-Application
netstat.exe	B-Application
tool	O
that	O
ships	O
with	O
Windows	B-Application
,	O
GUI-based	O
netstat	B-Application
programs	O
are	O
available	O
.	O
</s>
<s>
On	O
the	O
Windows	B-Application
platform	O
,	O
this	O
command	B-Application
is	O
available	O
only	O
if	O
the	O
Internet	B-Protocol
Protocol	I-Protocol
(	O
TCP/IP	O
)	O
protocol	O
is	O
installed	O
as	O
a	O
component	O
in	O
the	O
properties	O
of	O
a	O
network	B-Protocol
adapter	I-Protocol
in	O
Network	O
Connections	O
.	O
</s>
<s>
On	O
the	O
Windows	B-Application
platform	O
running	O
Remote	O
Desktop	O
Services	O
(	O
formerly	O
Terminal	O
Services	O
)	O
it	O
will	O
only	O
show	O
connections	O
for	O
the	O
current	O
user	O
,	O
not	O
for	O
the	O
whole	O
computer	O
.	O
</s>
<s>
On	O
macOS	B-Application
,	O
the	O
/System/Library/CoreServices/Applications	O
folder	O
(	O
or	O
/Applications/Utilities	O
in	O
OS	B-Operating_System
X	I-Operating_System
Mountain	I-Operating_System
Lion	I-Operating_System
and	O
earlier	O
)	O
contains	O
a	O
network	O
GUI	B-Application
utility	O
called	O
Network	B-Application
Utility	I-Application
,	O
the	O
Netstat	B-Application
tab	O
of	O
which	O
runs	O
the	O
netstat	B-Application
command	B-Application
and	O
displays	O
its	O
output	O
in	O
the	O
tab	O
.	O
</s>
