Linux network common commands

 Check out the Centos port command:

# netstat -tnlp #View listening ports
# netstat -antp #View all established TCP connections
Other commands for viewing server network information:
1. Check the hostname of the Linux system : Linux Learning, http://linux.it.net.cn
    # hostname
    localhost.localdomain
2. Check the IP address of the server:
    # ifconfig|grep 'inet addr:'|grep -v '127.0.0.1'|cut -d: -f2|awk '{ print $1}'
    192.168.17.238
    192.168.1.9
3. View the linux gateway:
    # route |grep default
    default 192.168.1.1 0.0.0.0 UG 0 0 0 em1
4. View linux open service:
    # chkconfig --list|grep enable #View enabled services
    sshd 0: off 1: off 2: on 3: on 4: on 5: on 6: off
    httpd 0: off 1: off 2: off 3: on 4: off 5: off 6: off
5. View the server DNS configuration:
    # cat /etc/resolv.conf
    nameserver 192.168.0.66
    nameserver 202.106.0.20
6. Other network information:
    # iptables -L #View firewall rules
    # route -n #View routing table
    # netstat -s #View network statistics

Query the operating system name: lsb_release -a

SB Version:	:base-4.0-amd64:base-4.0-noarch:core-4.0-amd64:core-4.0-noarch:graphics-4.0-amd64:graphics-4.0-noarch:printing-4.0-amd64:printing-4.0-noarch
Distributor ID:	CentOS
Description:	CentOS release 6.3 (Final)
Release:	6.3
Codename:	Final

 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326291986&siteId=291194637