jiqing@Ubuntu:~$ sudo netstat -anpl |grep :3306tcp600:::3306:::* LISTEN1532/mysqld jiqing@Ubuntu:~$ sudo netstat -anpl |grep :80tcp000.0.0.0:800.0.0.0:* LISTEN2994/nginx:master jiqing@Ubuntu:~$ ps -ef | grep nginxroot29941833011:28? 00:00:00nginx:master process nginxwww29952994011:28? 00:00:00nginx:worker processwww29962994011:28? 00:00:00nginx:worker processwww29972994011:28? 00:00:00nginx:worker processwww29982994011:28? 00:00:00nginx:worker processjiqing30492515011:31pts/1100:00:00grep --color=auto nginxjiqing@Ubuntu:~$ ps -ef | grep mysqlroot10161011:25? 00:00:00/bin/sh/usr/local/mysql/bin/mysqld_safe --datadir=/usr/local/mysql/var --pid-file=/usr/local/mysql/var/Ubuntu.pidmysql15321016011:25? 00:00:00/usr/local/mysql/bin/mysqld --basedir=/usr/local/mysql --datadir=/usr/local/mysql/var --plugin-dir=/usr/local/mysql/lib/plugin --user=mysql --log-error=/usr/local/mysql/var/Ubuntu.err --open-files-limit=65535--pid-file=/usr/local/mysql/var/Ubuntu.pid --socket=/tmp/mysql.sock --port=3306jiqing30512515011:31pts/1100:00:00grep --color=auto mysql
列出所有的tcp端口
# netstat -ntlpActiveInternet connections (only servers)Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name tcp00127.0.0.1:63790.0.0.0:* LISTEN22473/redis-server tcp000.0.0.0:800.0.0.0:* LISTEN4293/nginx: master tcp000.0.0.0:82110.0.0.0:* LISTEN4293/nginx: master tcp000.0.0.0:220.0.0.0:* LISTEN1164/sshd tcp00127.0.0.1:83830.0.0.0:* LISTEN23301/xs-indexd: se tcp00127.0.0.1:83840.0.0.0:* LISTEN23305/xs-searchd: m tcp000.0.0.0:33060.0.0.0:* LISTEN8064/mysqld
列出所有的udp端口
# netstat -nulp激活Internet连接 (仅服务器)Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program nameudp5222400.0.0.0:680.0.0.0:*2563/dhclient udp000.0.0.0:6310.0.0.0:*1238/cups-browsedudp000.0.0.0:580250.0.0.0:*1064/avahi-daemon: udp00127.0.0.1:10800.0.0.0:*1739/python udp2873600.0.0.0:53530.0.0.0:*6921/nw udp928000.0.0.0:53530.0.0.0:*4243/chrome udp3187200.0.0.0:53530.0.0.0:*1064/avahi-daemon: udp600:::35139:::*1064/avahi-daemon: udp6146560:::5353:::*6921/nw udp6206720:::5353:::*4243/chrome udp6206720:::5353:::*1064/avahi-daemon:
查看外部的tcp
# netstat -ntlpa激活Internet连接 (服务器和已建立连接的)Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program nametcp00127.0.0.1:226240.0.0.0:* LISTEN7042/exe tcp00127.0.0.1:363950.0.0.0:* LISTEN7042/exe tcp00127.0.0.1:63790.0.0.0:* LISTEN1183/redis-server1tcp00127.0.0.1:256130.0.0.0:* LISTEN6999/exe tcp00127.0.0.1:633420.0.0.0:* LISTEN26309/java tcp00127.0.0.1:194710.0.0.0:* LISTEN6999/exe tcp000.0.0.0:800.0.0.0:* LISTEN1519/nginx.conf tcp000.0.0.0:82110.0.0.0:* LISTEN1519/nginx.conf tcp000.0.0.0:82120.0.0.0:* LISTEN1519/nginx.conf tcp00127.0.0.1:6310.0.0.0:* LISTEN11230/cupsd tcp00127.0.0.1:10800.0.0.0:* LISTEN1739/python tcp000.0.0.0:88880.0.0.0:* LISTEN1519/nginx.conf tcp00127.0.0.1:69420.0.0.0:* LISTEN26309/java tcp00127.0.0.1:40104127.0.0.1:6379TIME_WAIT - tcp00192.168.1.128:42862101.132.169.194:22ESTABLISHED15204/ssh tcp00192.168.1.128:5371247.75.180.205:2000ESTABLISHED4243/chrome tcp00127.0.0.1:34122127.0.0.1:26483ESTABLISHED6921/nw tcp00127.0.0.1:47234127.0.0.1:3306TIME_WAIT - tcp00127.0.0.1:40106127.0.0.1:6379TIME_WAIT - tcp00192.168.1.128:46428101.226.76.164:443ESTABLISHED4243/chrome tcp00192.168.1.128:4453259.111.160.197:80ESTABLISHED1317/netease-cloud-tcp00127.0.0.1:47238127.0.0.1:3306TIME_WAIT - tcp00127.0.0.1:36214127.0.0.1:80ESTABLISHED4243/chrome tcp00192.168.1.128:60894223.252.199.69:6003ESTABLISHED1317/netease-cloud-tcp00127.0.0.1:47144127.0.0.1:3306TIME_WAIT - tcp00127.0.0.1:55902127.0.0.1:6379ESTABLISHED24062/rdm tcp00127.0.0.1:47230127.0.0.1:3306TIME_WAIT - tcp00192.168.1.128:47122101.132.169.194:22ESTABLISHED16503/ssh tcp00192.168.1.128:5848054.86.169.116:443ESTABLISHED27254/Postman tcp00127.0.0.1:6379127.0.0.1:55902ESTABLISHED1183/redis-server1tcp00127.0.0.1:40122127.0.0.1:6379TIME_WAIT - tcp00192.168.1.128:5248238.143.1.170:2020ESTABLISHED4243/chrome tcp00127.0.0.1:47232127.0.0.1:3306TIME_WAIT - tcp00127.0.0.1:80127.0.0.1:36214ESTABLISHED29553/nginx: workertcp00127.0.0.1:47222127.0.0.1:3306TIME_WAIT - tcp00127.0.0.1:35508127.0.0.1:26483ESTABLISHED6921/nw tcp10192.168.1.128:35168106.15.95.197:80CLOSE_WAIT4243/chrome tcp600:::3306:::* LISTEN2353/mysqld tcp600:::26483:::* LISTEN7042/exe tcp600:::54484:::* LISTEN6999/exe tcp600:::21:::* LISTEN1560/vsftpd tcp600::1:631:::* LISTEN11230/cupsd tcp600127.0.0.1:26483127.0.0.1:34122ESTABLISHED7042/exe tcp600127.0.0.1:3306127.0.0.1:47228TIME_WAIT - tcp600127.0.0.1:3306127.0.0.1:47224TIME_WAIT - tcp600127.0.0.1:3306127.0.0.1:47226TIME_WAIT - tcp600127.0.0.1:26483127.0.0.1:35508ESTABLISHED7042/exe
网友评论