断网之后xshell就掉了,但是jupyter还在运行,重新打开就是下一个端口,不想增加隧道,所以选择直接杀死端口
查看当前终端在运行的端口
jupyter notebook list
显示有三个端口在开着:
Currently running servers:
http://localhost:7548/ :: /root
http://localhost:7549/ :: /root
http://localhost:7550/ :: /root
查看端口的PID
(一)方法一:
ps -aux | grep jupyter
(base) root@c21****5:~# ps -aux | grep jupyter
root 10312 0.0 0.0 83060 57180 pts/0 T 08:54 0:00 /root/anaconda3/bin/python /root/anaconda3/bin/jupyter-notebook
root 10316 0.0 0.0 83056 57276 pts/0 T 08:54 0:00 /root/anaconda3/bin/python /root/anaconda3/bin/jupyter-notebook
root 10342 0.0 0.0 14428 1100 pts/0 S+ 09:13 0:00 grep --color=auto jupyter
第二列就是对应的PID
(二)方法二:
lsof -i :端口号
(三)方法三:
netstat -aon | findstr “端口号”
杀死程序
kill -9 PID
最后查看是否还有端口在占用
(base) root@c21032303135:~# jupyter notebook list
Currently running servers:
完成!!!