linux 常用命令

linux 常用命令

i)查看显卡 tf.compat.v1.train.Saver
$ nvidia-smi
$ watch -n 0.1 nvidia-smi
$ lshw -c video

查询算力:https://developer.nvidia.com/cuda-gpus

ii) 查看环境变量及配置
$ env 
or
$ echo $PATH

export PATH = ~/anaconda3/bin:$PATH
$source .bashrc
iii)查看历史命令
history
iv)查看用户状态
top
v)删除文件夹
rm -r data/ 
or
rm -r data
vi)查看cuda、 cudnn的 version

硬件,底层接口,应用程序接口

cat /usr/local/cuda/version.txt
or
nvcc -V
cat /usr/local/cuda/include/cudnn.h | grep CUDNN_MAJOR -A 2
vii)nohup
nohup python ...22
or
nohup mycommd &

nohup java -jar demo.jar >./log.txt  2>&1 &

link:https://www.computerhope.com/unix/unohup.htm

https://www.jianshu.com/p/b86f74ec0cc6

viii)查看用户的进程
ps -ux
kill -9 id
viiii)conda version
conda --version
iiv)scp
scp -r user@0.0.0.0:/home/user/AoI_DQN /home/user/

link:https://www.computerhope.com/unix/scp.htm

iv)ubuntu版本
uname -a

lsb_release -a

cat /proc/version
#Linux version 4.15.0-72-generic (buildd@lcy01-amd64-023) (gcc version 5.4.0 ######## (Ubuntu 5.4.0-6ubuntu1~16.04.12)) #81~16.04.1-Ubuntu SMP Tue Nov 26 16:34:21 UTC 2019

i)版本对应

https://blog.csdn.net/qiancaobaicheng/article/details/95226499

https://www.tensorflow.org/install/source

ii)源
pip install -i http://pypi.douban.com/simple box2d-py --trusted-host pypi.douban.com
iii)查看文件
tail -n 10 filename
iv)csv
import csv

with open('employee_file2.csv', mode='w', newline="") as csv_file:
    fieldnames = ['emp_name', 'dept', 'birth_month']
    writer = csv.DictWriter(csv_file, fieldnames=fieldnames)

    writer.writeheader()
    writer.writerow({'emp_name': 'John Smith', 'dept': 'Accounting', 'birth_month': 'November'})
    writer.writerow({'emp_name': 'Erica Meyers', 'dept': 'IT', 'birth_month': 'March'})

example2:

import csv

Second_AE_Cost=[]
Second_AE_Cost.append({'emp_name': 1,  'birth_month': 10})
Second_AE_Cost.append({'emp_name': 2,  'birth_month': 20})
Second_AE_Cost.append({'emp_name': 3,  'birth_month': 30})

with open('employee_file3.csv', mode='w', newline="") as csv_file:
    fieldnames = ['emp_name', 'birth_month']
    writer = csv.DictWriter(csv_file, fieldnames=fieldnames)

    writer.writeheader()
    writer.writerow({'emp_name': 'John Smith',  'birth_month': 'November'})
    writer.writerow({'emp_name': 'Erica Meyers', 'birth_month': 'March'})
    writer.writerows(Second_AE_Cost)

with open('employee_file3.csv') as csvfile:
        reader = csv.DictReader(csvfile)
        for row in reader:
            print(row['emp_name'], row['birth_month'])

notes:

训练autoencoder需要replaybuffer需要变吗

GPU利用率

https://zhuanlan.zhihu.com/p/53345706

https://www.jianshu.com/p/3fe480c5bb12

cpu

https://www.cnblogs.com/black-mamba/p/7102615.html

ssh

https://www.jianshu.com/p/4e8e5f516d84

ssh -L 16006:127.0.0.1:6006 account@server.address

ssh -L 16006:127.0.0.1:6006 172.29.1.79@user-xc


http://127.0.0.1:16006/
vII)查看CPU型号及内存
cat /proc/cpuinfo | grep 'model name' |uniq

# model name      : Intel(R) Xeon(R) CPU E5-2640 v4 @ 2.40GHz

cat /proc/meminfo | grep MemTotal
 
#MemTotal:       131893644 kB #131G

cat /proc/cpuinfo | grep "cpu cores" | uniq

#cpu cores       : 10

 

link:https://blog.csdn.net/zhangliao613/article/details/79021606

iv)进程活跃度
1.CPU占用最多的前10个进程: 
ps auxw|head -1;ps auxw|sort -rn -k3|head -10 
2.内存消耗最多的前10个进程 
ps auxw|head -1;ps auxw|sort -rn -k4|head -10 
3.虚拟内存使用最多的前10个进程 
ps auxw|head -1;ps auxw|sort -rn -k5|head -10
posted @ 2020-03-20 22:04  sailonzn  阅读(153)  评论(0编辑  收藏  举报