Linux jobs命令——如何查看正在运行进程的完整路径

标签 linux shell tcsh suse

我正在使用 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/

相关文章:

linux - g77 编译错误(找不到 crt1.o、crti.o、-lgcc_s)

linux - ImageMagick SVG 到 PNG 不着色

regex - 无法将否定先行断言应用于 bash 上的 nagios 插件输出

Linux crontab 查找并通过电子邮件发送结果接收 EOF

java - 如何在 ubuntu 中将 JAVA_HOME 变量添加到 PATH 变量

bash - 在 gnome 终端的新选项卡中运行脚本

shell - 我的 unix shell "[1]+ Stopped"是什么意思?

bash 相当于用于提取路径组件的 tcsh 修饰符

linux - 将 "module"别名(调用 modulecmd)从 tcsh 适配到 bash

python - 将 tcsh 别名为 python 脚本然后将结果返回给 tcsh?