从它在Linux PID进程名称 [英] Process name from its pid in linux

查看:134
本文介绍了从它在Linux PID进程名称的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何从他的PID进程名称?
比如我执行猫FILE1.TXT,但我想因为它的系统中的PID弄清楚,猫的命令及其参数。是否有一个结构,以确定它或类似的东西?任何想法?

How to get a process name from his pid ? For example I execute cat file1.txt, but I want to figure out that cat command and its arguments since its pid in the system. Is there a struct to determine it or something similar? Any idea?

推荐答案

有没有做到这一点任何UNIX的一般方式。结果每个操作系统都有不同的方式来处理它,有些是很辛苦。你虽然提到Linux操作系统。对于Linux,该信息是在/ proc文件系统。结果要得到的进程id 9999在命令行中,读取文件的/ proc / 9999 / CMDLINE

There is not any general way to do this unix.
Each OS has different ways to handle it and some are very hard. You mention Linux though. With Linux, the info is in the /proc filesystem.
To get the command line for process id 9999, read the file /proc/9999/cmdline.

这篇关于从它在Linux PID进程名称的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆