1,查看cpu正在运行的进程和pid
$ top

2, 查看指定进程的来源(pid为1234)
$ ll /proc/1234

查看指定进程运行的脚本名称
$ iotop


# 内容
cwd符号链接的是进程运行目录;(开启进程的文件路径)
exe符号连接就是执行程序的绝对路径;(可执行文件)
cmdline就是程序运行时输入的命令行命令;
environ记录了进程运行时的环境变量;
fd目录下是进程打开或使用的文件的符号连接。

3,杀死指定进程(pid为1234)
$ kill 1234

4,查看指定进程(如1234)的启动文件和完整命令(https://serverfault.com/questions/232762/linux-how-to-know-where-a-process-was-started-and-how-it-was-started)
$ sudo su
# ps -feww | grep 1234

# 批量杀死python2进程,pgrep用于获取进程号
$ pgrep python2|xargs -i kill -9 {}

5,查看指定用户的命令执行历史
$ sudo su
# cat /home/user_name/.bash_history

其他命令:history

 

https://blog.csdn.net/spring21st/article/details/50561550

https://www.cnblogs.com/1024-wusuopubupt/archive/2012/02/16/2354132.html

Logo

更多推荐