我正在使用 Linux SUSE 11 并运行大量作业。 每个作业的路径都很长,例如:
cmd>/user/data/some/very/very/very/long/path/to/my/command/run_me param0 param1 param2
当我运行大量这些命令时,我想知道哪些已完成,哪些正在运行。让我们说一天左右。 使用“工作”命令我只看到以下内容:
[1] + Running ...
[2] + Running ...
[3] + Running ...
[4] + Running ...
所以我无法知 Prop 体运行的是哪个命令。
使用 top
命令也没有帮助,因为它显示的是进程,而不是我正在运行的确切脚本/程序。
我的shell是/usr/bin/tcsh
最佳答案
在 tcsh
中,jobs -l
给你一个“长”列表,其中包括 PID。然后,您可以使用此数字通过 ps
检查作业或在 /proc
伪文件系统或其他任何地方摸索。
% jobs -l
[1] + 19038 Running tail --follow=name /path/to/long/and/complex /long/and/complex/files /and/so/on ...
从此列表中,您可以获取 19038
并查看它的实际作用。
% ps -o args= --width 1200 19945
tail --follow=name /path/to/long/and/complex /long/and/complex/files /and/so/on /really/long /etc/motd
还有
% tr '\0' '\n' </proc/19038/cmdline
tail
--follow=name
/path/to/long/and/complex
/long/and/complex/files
/and/so/on
/really/long
/etc/motd
或者,使用 top
有点困惑:
% setenv COLUMNS 512
% top -b -n1 -c -p 19038
(输出太难看,不能在这里显示,也没有添加任何有用的东西。)
关于Linux jobs命令——如何查看正在运行进程的完整路径,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28299230/