[root@localhost ]# netstat -antlup |awk '{if (NR==2) print $0};{if ($4~".*6379") print $0}'
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 127.0.0.1:6379 0.0.0.0:* LISTEN 995/redis-server 12
tcp 0 0 127.0.0.1:6379 127.0.0.1:60796 ESTABLISHED 995/redis-server 12
tcp 0 0 127.0.0.1:6379 127.0.0.1:60800 ESTABLISHED 995/redis-server 12
tcp 0 0 127.0.0.1:6379 127.0.0.1:60798 ESTABLISHED 995/redis-server 12
tcp 0 0 127.0.0.1:6379 127.0.0.1:60794 ESTABLISHED 995/redis-server 12
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 127.0.0.1:6379 0.0.0.0:* LISTEN 995/redis-server 12
tcp 0 0 127.0.0.1:6379 127.0.0.1:60796 ESTABLISHED 995/redis-server 12
tcp 0 0 127.0.0.1:6379 127.0.0.1:60800 ESTABLISHED 995/redis-server 12
tcp 0 0 127.0.0.1:6379 127.0.0.1:60798 ESTABLISHED 995/redis-server 12
tcp 0 0 127.0.0.1:6379 127.0.0.1:60794 ESTABLISHED 995/redis-server 12
tcp 0 0 127.0.0.1:6379 127.0.0.1:60792 ESTABLISHED 995/redis-server 12
参考:https://blog.csdn.net/jackliu16/article/details/79008363