常用指令(conda,docker,linux等)合集

Posted Kman_l

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了常用指令(conda,docker,linux等)合集相关的知识,希望对你有一定的参考价值。


前言

实验过程中,时常会用到一些指令,包括conda,docker,以及一些linux的指令,发个帖子来记录一下,并日后持续更新。


一、Conda

国内镜像源汇总:
阿里云: https://mirrors.aliyun.com/pypi/simple/
中国科技大学: https://pypi.mirrors.ustc.edu.cn/simple/
豆瓣: http://pypi.douban.com/simple/
清华大学: https://pypi.tuna.tsinghua.edu.cn/simple/
中国科学技术大学: http://pypi.mirrors.ustc.edu.cn/simple/

1.pip 安装与卸载

pip install 包名 -i http://pypi.douban.com/simple --trusted-host pypi.douban.com
pip uninstall 包名

另外,如果pip安装不了的话,可以去这里或者这里找一找看有没有需要的包,然后将它的wheel给下载到本地,这里cmd进入到下载路径,在下载路径下直接pip install 文件名(手动下载的wheel)即可。

2.查看conda中已有的虚拟环境

conda env list

3.创建python虚拟环境,其中your_env_name就是你自己的虚拟环境的名字,X.X就是虚拟环境的python版本

conda create -n your_env_name python=X.X

4.激活虚拟环境

Windows:activate  your_env_name
Linux:source activate your_env_name

二、Docker

docker exec -it xxx /bin/bash //进入名为xxx的容器
exit //退出容器
docker pull xxx //默认从docker hub中拉取镜像,tag默认使用:latest
docker commit -a="your name" -m="对image的说明" container-name image-name //container-name容器名 , 
//image-name镜像名 将一个容器变成一个镜像
docker images //查看本地已有的images
docker ps //使用命令获取容器的ID 
docker start <the-container-id> //命令启动容器
docker stop <the-container-id> //命令停止容器
docker rm -f <the-container-id> //停止和删除容器
docker rename old-container(旧容器名) new-container(新容器名)
docker logs <the-container-id> //查看docker容器日志

三、Linux操作

1.解压

tar -xvf file.tar //解压 tar包
tar -xzvf file.tar.gz //解压tar.gz
unrar x test.rar //解压 rar包
gzip -d FileName.gz  //解压.gz 压缩包
bzip2 -d FileName.bz2  //解压.bz2 压缩包

2.压缩

gzip FileName  //压缩gz格式
tar zcvf FileName.tar.gz DirName  //压缩tar格式
zip FileName.zip DirName //压缩zip格式

3.Nvidia相关

nvidia-smi //查看显卡使用率
watch -n 1 nvidia-smi //每隔1秒刷新一次,查看显卡使用率

总结

会持续更新

以上是关于常用指令(conda,docker,linux等)合集的主要内容,如果未能解决你的问题,请参考以下文章

conda终端常用指令

CenterOS8安装docker,以及docker相关指令

Linux常用指令

Linux常用指令

Linux常用指令

docker常用命令,安装常用实例,一步式安装mysql