离线后台跑程序
nohup python -u example.py >outfile.txt&
将程序的输出保存在某个文件
python train.py example>outfile.txt
查看当前正在运行的程序
ps -u
查看用户 liuying 正在运行的程序
ps -u liuying
终止某个程序的运行
ps -u liuying (查看该程序的 PID)
kill 28260(PID)
wget 的使用(在服务器上下载网页上的文件)
网页:
http://www.cnblogs.com/peida/archive/2013/03/18/2965369.html
用法:
wget -b --http-user='zhangdo@uestc.edu.cn' --http- password='1O|)8f+%Z8' -directory-prefix='/home/liuying/download' -- tries=100 http://megaface.cs.washington.edu/dataset/download/content/ide
ntities_0.tar.gz
不需要用户密码的:
wget -b http://shannon.cs.illinois.edu/DenotationGraph/data/graph.tar.gz
其中,wget:下载文件的工具;-b:后台下载; --http-user:用户名
--http-password:用户密码; -directory-prefix:保存目录
--tries:下载尝试次数
剪切文件
mv /home/liuying/after_ori_data.txt /home/liuying/dataset
查看内存
df -l /home/liuying
df -l -Bg /home/liuying
解压
tar zxvf file.tar
tar -xvf file.tar(这个常用)
gunzip file.gz
tar zxvf file.tar.gz
unzip file.zip
删除
rm -rf 目录 //删除文件夹
rm -f 目录 //删除文件
查看文件夹下面的文件个数
ls -l |grep "^-"|wc -l
vim到文件开始:
gg
到文件末尾:G
撤销
u 撤销, ctrl+r 反撤销(命令模式下)
将文件夹下面的所有文件名存在 txt 文件中
ls /home/liuying/image_dataset/flickr30k/flickr30k-images/ >
/home/liuying/workspace/image_caption/feature_extr/flickr30k.txt
这个是把路径都存下来了
find `pwd`/examples/images -type f - exec echo {} \; > examples/_temp/temp.txt
vim 查找
命令模式下,按 / ,输入要查找的内容,回车。n:下一个,N:上一个
screen使用
screen -S img_cap //新建一个img_cap的screen
ctrl + a + d //退出当前screen
screen -r img_cap //回到img_cap的作业
screen -d img_cap //远程detachimg_cap作业
screen -wipe // 检查目前所有的screen作业,并删除无法使
用的 screen 作业
如果screen -r img_cap,发现提示 attached,则
先 screen -d img_cap,再screen -r img_cap
screen -list 查看当前的 screen 作业
查看当前的screen进程,并关闭
查看: ps -ef|greap screen
关闭: kill -s 9 1234(PID)
nvidia-smi 当前内存使用情况
让python文件中的类型同意,防止类型不匹配的错误
THEANO_FLAGS='floatX=float32' python evaluate_coco.py
kill 进程
kill -s 9 1832
从 github 上面获取文件
git clone 地址.git
从一台服务器复制文件到另一台服务器(-P 端口号)
scp -P 88 Flickr8k_Dataset.zip liuying@222.197.181.28:/home/liuying/
(-r 对文件夹进行复制 -v 显示进度)
安装在本地
pip install --user nltk
复制文件夹
cp -r path path
nohup的使用
THEANO_FLAGS='floatX=float32, mode=FAST_RUN, device=gpu1' nohup python -u build_model.py > build_model.log &
ctrl+z 暂停终端 fg恢复
ps用法
ps -aux | grep liuying 查看跟 liuying 有关的进程的所有信息
输出重定向
python evaluate_coco.py >out.txt 覆盖原有内容
python evaluate_coco.py >>out.txt 在原来内容里面添加
THEANO_FLAGS 用法
THEANO_FLAGS='mode=FAST_RUN,floatX=float32,device=gpu1' python evaluate_coco.py
h5文件类型读取
import h5py
f = h5py.File('BJ_Meteorology.h5')
for ke in f.keys():
…print(ke, f[ke].shape)
输出:
(u’Temperature’, (59006,))
(u’Weather’, (59006, 17))
(u’WindSpeed’, (59006,))
(u’date’, (59006,))
for i in f['date']:
print i
结果:
2014121015
2014121016
…
直接在命令行下面执行 python 语言,分号隔开
python -c "from deepst.datasets import stat;
stat('BJ16_M32x32_T30_InOut.h5')"
配置
vim ~/.bashrc
source ~/.bashrc
新建文件夹
mkdir data
如果默认安装到 python3,让它安装到 python2 的方法:
python2 -m pip install ...
复制粘贴文件到当前目录并重命名
cp check.py evaluation.py
遇到 setup.py 文件
python setup.py build
python setup.py install
查看当前路径
pwd
查看系统盘内存
sudo du -h –max-depth=1
3541

被折叠的 条评论
为什么被折叠?



