1. 不好意思,先切换到root
su root
如果不切换到root,看不到进程号
2. 查看端口被哪个占用
[root@localhost test]# netstat -apn | grep 8080
tcp 0 0 127.0.0.1:8080 0.0.0.0:* LISTEN 17997/unicorn maste
tcp 0 0 127.0.0.1:8080 127.0.0.1:58802 TIME_WAIT -
tcp 0 0 127.0.0.1:8080 127.0.0.1:58836 TIME_WAIT -
tcp 0 0 127.0.0.1:8080 127.0.0.1:58904 TIME_WAIT -
tcp 0 0 127.0.0.1:8080 127.0.0.1:58870 TIME_WAIT -
看到第一行的LISTEN 17997/unicorn maste
,17997就是占用的进程号
3.找出真身
[root@localhost test]# ps -ef | grep 17997
git 17997 1 21 22:01 ? 00:00:29 unicorn master -D -E production -c /var/opt/gitlab/gitlab-rails/etc/unicorn.rb /opt/gitlab/embedded/service/gitlab-rails/config.ru
git 18108 17997 0 22:02 ? 00:00:00 unicorn worker[0] -D -E production -c /var/opt/gitlab/gitlab-rails/etc/unicorn.rb /opt/gitlab/embedded/service/gitlab-rails/config.ru
git 18111 17997 0 22:02 ? 00:00:00 unicorn worker[1] -D -E production -c /var/opt/gitlab/gitlab-rails/etc/unicorn.rb /opt/gitlab/embedded/service/gitlab-rails/config.ru
git 18114 17997 0 22:02 ? 00:00:00 unicorn worker[2] -D -E production -c /var/opt/gitlab/gitlab-rails/etc/unicorn.rb /opt/gitlab/embedded/service/gitlab-rails/config.ru
root 18301 16812 0 22:03 pts/0 00:00:00 grep --color=auto 17997