常用的命令

  1. pgrep 进程名  通过进程名称查看PID
  2. ps -ef|grep 名称 通过管道符查看PID
  3. top 动态显示进程
  4. ps -u 用户名 指定用户查看进程
  5. kill -9 PID 杀死PID进程
  6. killall -9 名称 杀死名称进程

 

  1. lsof -i:22  查看22端口占用进程
  2. netstat -lup|grep 22  查看22端口占用进程
  3. netstat -tunlp | grep 8127

 

  1. netstat -ano |findstr "端口号"                         占用端口号的进程ID
  2. tasklist |findstr "进程id号"                         ID号的进程名字
  3. taskkill /f /t /im "进程id或者进程名称"            终止进程

 

  1. nvidia-smi 查看显卡参数

 

  1. git branch -a 查看分支信息
  2. git checkout 分支  切换到某个分支
  3. git status 
  4. git add
  5. git commit -m
  6. git push 

 

  1. nohup python test.py &
  2. nohup python -u test.py > nohup.out 2>&1 &

 

  1. python -m pdb test.py
  2. import pdb
  3. pdb.set_trace()
  4. b断点 c继续 n下一行 s下一条 l显示代码

 

  1. conda info -e 查看环境
  2. conda list 查看当前环境安装的包
  3. conda install
  4. conda remove -n tf2 --all
  5. conda config --add channels https://
  6. conda config --remove-key channels

 

  1. rm `ls |grep -v test1 |grep test2` 删除不含有test1,含有test2的文件
  2. lsof -i:8127 |awk 'nR==2{print$2}' |xargs kill -9 显示8127端口占用,把第二行第二列的PID 送给kill -9
  3. ls |wc -l  统计行数,也就是个数

 

  1. pip list --format=freeze > requirements.txt
  2. pip download -r requirements.txt -d "/home/" -i https://pypi.tuna.tsinghua.edu.cn/simple/

 

  1. source activate
  2. source deactivate
  3. pip install numpy -i https://
  4. pip freeze > requirements.txt
  5. pip instatll -r requirements.txt -i https://pypi.tuna.tsinghua.edu.cn/simple/
  6. pip install torch==1.8.0+cu101 torchvision==0.9.0+cu101 torchaudio==0.8.0 -f https://download.pytorch.org/whl/torch_stable.html
  7. 阿里云 http://mirrors.aliyun.com/pypi/simple/
  8. 中国科技大学 https://pypi.mirrors.ustc.edu.cn/simple/
  9. 豆瓣(douban) http://pypi.douban.com/simple/
  10. 清华大学 https://pypi.tuna.tsinghua.edu.cn/simple/
  11. 中国科学技术大学 http://pypi.mirrors.ustc.edu.cn/simple/

 

  1. from PIL import ImageFile
  2. ImageFile.LOAD_TRUNCATED_IMAGES= True

 

  1. np.set_printoptions(suppress=True)
  2. np.set_printoptions(threshold=np.inf)

    

  1. cmd代码tab补全
  2. 直接pip install readline                     
  3. pip3 install pyreadline  正常安装使用
posted @ 2021-11-24 09:42  天涯有蔷薇  阅读(83)  评论(0)    收藏  举报