最近常用的Linux常用的命令

1.查看Linux下NVIDIA的GPU

(1)显示当前GPU使用情况

$ nvidia-smi

(2)周期性输入GPU的使用情况

使用watch命令,周期性地输出GPU的使用情况

$ whatis watch
watch (1) - execute a program periodically, showing output fullscreen

$watch

Usage:
watch [options] command

Options:
-b, --beep beep if command has a non-zero exit
-c, --color interpret ANSI color sequences
-d, --differences[=<permanent>]
highlight changes between updates
-e, --errexit exit if command has a non-zero exit
-g, --chgexit exit when output from command changes
-n, --interval <secs> seconds to wait between updates
-p, --precise attempt run command in precise intervals
-t, --no-title turn off header
-x, --exec pass command to exec instead of "sh -c"

-h, --help display this help and exit
-v, --version output version information and exit

每隔10s刷新一次GPU的使用情况

$ watch -n 10 nvidia-smi

 

2.source命令

在当前bash下执行filename中的命令

$ ource filename

 

3.nohup命令

关掉终端后也能后台运行,nohup表示不挂起(no hang up)

$ nohup [command] >nohup.out 2>&1 &

上面的命令,2>&1表示所有的输出将被重定向到nohup.out文件中 

$ jobs 查看任务
$ fg jobnumber 将后台任务拿到前台
$ bg jobnumber 将任务放到后台处理
$ kill pid

&命令表示把作业放到后台执行

4.查看进程

$ ps -ef | grep python  显示所有进程中指令为python的进程

ps(process status):列出系统中正在运行的进程

-e:显示所有程序(-A效果相同),同时会显示 PID,TTY(登入者的终端机位置),TIME(使用CPU的时间),CMD(指令)字段栏

-f:显示UID,PPID(父程序的id),C(CPU占用率)和STIME(系统启动时间)字段栏

grep:查找命令

|:管道命令,ps与grep同时执行

 

5.cat命令

cat [optional] [filename]

cat命令的用途是连接文件或标准输入并打印。这个命令常用来显示文件内容,或者将几个文件连接起来显示,或者从标准输入读取内容并显示,它常与重定向符号配合使用。

6.bash命令

7.rm命令

rm -rf  文件夹名

 

posted @ 2017-11-01 13:31  forlenia  阅读(329)  评论(0)    收藏  举报