Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Get process name by PID

This should be simple, but I'm just not seeing it.

If I have a process ID, how can I use that to grab info about the process such as the process name.

like image 852
andyortlieb Avatar asked Nov 15 '10 23:11

andyortlieb


People also ask

How do I get the process name from PID?

In this quick article, we've explored how to get the name and the command line of a given PID in the Linux command line. The ps -p <PID> command is pretty straightforward to get the process information of a PID. Alternatively, we can also access the special /proc/PID directory to retrieve process information.

How do I find the process name?

Task Manager can be opened in a number of ways, but the simplest is to select Ctrl+Alt+Delete, and then select Task Manager. In Windows, first click More details to expand the information displayed. From the Processes tab, select Details to see the process ID listed in the PID column. Click on any column name to sort.

How can I see PID process details?

If you want to see the path of the process by PID. You can use the pwdx command. The pwdx command reports the full path of the PID process.

What is process name in Linux?

The process identifier (process ID or PID) is a number used by Linux or Unix operating system kernels. It is used to identify an active process uniquely.


1 Answers

Under Linux, you can read proc filesystem. File /proc/<pid>/cmdline contains the commandline.

like image 119
Juho Östman Avatar answered Oct 10 '22 07:10

Juho Östman