netstat command
LINUX-Frequently used commands
netstat command View network information |
Syntax |
netstat [Option] [Interfaces(NIC)] |
The netstat command is used to display network usage.. If executed without options, the available network addresses are displayed when the command is executed. option can be specified to display the routing table and detailed information. |
Frequently used options |
-a Show all information -i Display information about the network interface -r Displaying the routing table (route information) -v View more information -e View more detailed information -c Display information every second |
Example: View network information. |
$ netstat Active UNIX domain sockets (w/o servers) Proto RefCnt Flags Type State I-Node Path unix 3 [ ] DGRAM 8581 /run/systemd/notify unix 2 [ ] DGRAM 8583 /run/systemd/cgroups-agent unix 5 [ ] DGRAM 8597 /run/systemd/journal/socket unix 30 [ ] DGRAM 8599 /dev/log unix 2 [ ] DGRAM 27339 /var/run/chrony/chronyd.sock unix 2 [ ] DGRAM 17378 /run/systemd/shutdownd unix 3 [ ] STREAM CONNECTED 32394 unix 3 [ ] STREAM CONNECTED 32378 unix 3 [ ] DGRAM 18260 unix 3 [ ] STREAM CONNECTED 32393 unix 3 [ ] DGRAM 18261 unix 3 [ ] STREAM CONNECTED 7851800 /run/systemd/journal/stdout unix 3 [ ] STREAM CONNECTED 30564 unix 3 [ ] STREAM CONNECTED 32376 unix 2 [ ] DGRAM 28020 unix 3 [ ] STREAM CONNECTED 32375 unix 2 [ ] DGRAM 30135 unix 3 [ ] STREAM CONNECTED 32373 unix 2 [ ] DGRAM 28823 unix 3 [ ] STREAM CONNECTED 7849912 unix 2 [ ] DGRAM 40474. |
Example: Displaying the routing table |
$ netstat -r Kernel IP routing table Destination Gateway Genmask Flags MSS Window irtt Iface default buffalo.setup 0.0.0.0 UG 0 0 0 eth0 192.168.11.0 0.0.0.0 255.255.255.0 U 0 0 0 eth0 |