Linux command learning - netstat

  
        

Many linux services are related to the network. When the service is unreachable or the startup port is occupied, or it is blocked by the firewall, you need to query the network related issues. The netstat command only uses one or two parameters before. Here, study hard.

Several commonly used options:

  • -a (all) shows all options, LISTEN is not displayed by default
  • -t (tcp) shows only tcp related Options
  • -u (udp) only shows udp related options
  • -n Refuse to display aliases, can display all digits into numbers
  • -l only listed in Listen's service status
  • -c Execute the netstat command every other fixed time
  • -s Display network statistics
  • -p List program Pid, useful
  • -r Display routing table
  • -e Display other extended information

    Use case:

    1 View all tcp ports

    $ netstat -at

    2 View all tcp ports on the listener

    $ netstat -lt

    3 Find out the port for the ssh service

    $ netstat - Alpt
    						
  • Copyright © Windows knowledge All Rights Reserved