Ubuntu16.04使用小记录
多做些记录
pip命令
- 安装指定版本组件;
pip3 install --upgrade torchvision==0.2.0
VIM命令
在linux下用vi或vim打开文件时,提示:
E325: ATTENTION
Found a swap file by the name ".Test.java.swp"
owned by: root dated: Wed Dec 7 13:52:56 2011
file name: /var/tmp/Test.java
modified: YES
user name: root host name: localhost
process ID: 26153 (still running)
While opening file "Test.java"
dated: Wed Dec 7 14:00:46 2011
NEWER than swap file!
(1) Another program may be editing the same file.
If this is the case, be careful not to end up with two
different instances of the same file when making changes.
Quit, or continue with caution.
(2) An edit session for this file crashed.
If this is the case, use ":recover" or "vim -r Test.java"
to recover the changes (see ":help recovery").
If you did this already, delete the swap file ".Test.java.swp"
to avoid this message.
"Test.java" 11L, 237C
Press ENTER or type command to continue
原因是在此次vi或vim操作前有过一次使用vi或vim 操作Test.java文件时出现了异常中断,所以在当前目录下产生了一个.Test.java.swp文件,这个文件使用ls命令查看不能发现,使用ls -a命令查看可以知道Test.java.swp是一个隐藏文件。
注:以.开头的文件就是隐藏文件
想要不再有上面的警告提示,把该文件删除即可:
#rm .Test.java.swp
命令行打开文件夹
nautilus /home/zb/.torch
SSH命令
- 登录
ssh 远程主机用户@远程主机ip
ssh root@192.xxx.xxx.xxx
更改默认python版本
调整Python3的优先级,使得3.6优先级较高
sudo update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.5 1
sudo update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.6(更改为本地python3.6路径) 2
更改默认值,python默认为Python2,现在修改为Python3
sudo update-alternatives --install /usr/bin/python python /usr/bin/python2 100
sudo update-alternatives --install /usr/bin/python python /usr/bin/python3 150
解压安装软件
bash Anaconda3-4.3.1-Linux-x86_64.sh
conda配置
如果你之前没有配置环境变量,conda不能用,看这里,配置环境变量
将anaconda的bin目录加入PATH,根据版本不同,也可能是~/anaconda3/bin
echo ‘export PATH="~/anaconda2/bin:$PATH"’ >> ~/.bashrc
更新bashrc以立即生效
source ~/.bashrc
卸载软件
apt-get remove software
python virtualenv安装第三方包
进入env/bin文件夹下,打开终端,输入
source activate
pip install …
exit
查看gpu占用率
nvidia-smi
kill -9 进程号
密码正确的情况下,循环登录,黑屏显示clean…
图形界面出问题,需进入命令行模式,即ctrl+altl+F1/…/F5,退出即ctrl+altl+F7
输入用户名,密码,如果输入密码时直接出现回车的情况,尝试重启换generic
具体,开机后按F11,F10,忘了哪个,进入advanced模式,换个generic,即内核