centos 问题解决记录

时间:2023-03-10 01:11:11
centos 问题解决记录
  • 在centos上用pip安装包,显示成功安装,但是用pip list去看发现实际上并没有安装?

安装用的是pip install xxx 是不行的,需要用sudo pip install xxx就可以了。

  • 如何杀死一个进程?

1、如用 ps -ef  | grep python(简写为pgrep python),查询和python有关的所有进程;

       2、查询某用户的进程:ps -ef | grep python | grep fangying;

3、利用1查询到pid之后,kill -s 9 *pid

  • 如何查看哪些程序在占用你的GPU资源?

  fuser -v /dev/nvidia*

查看gpu使用情况: nvidia-smi

  • 防火墙相关

centos7 firewall命令:

firewall-cmd --list-ports    查看已开放的端口
firewall-cmd --zone=public --add-port=/tcp --permanent 开启端口
命令含义:
–zone #作用域
–add-port=/tcp #添加端口,格式为:端口/通讯协议
–permanent #永久生效,没有此参数重启后失效 firewall-cmd --reload #重启firewall
systemctl stop firewalld.service #停止firewall
systemctl disable firewalld.service #禁止firewall开机启动
firewall-cmd --state #查看默认防火墙状态