function::pid2execname - Linux


The function::pid2execname command returns the absolute path to the executable for a given process ID (PID). It is useful for obtaining detailed information about running processes, such as their actual executable name, location, and command line arguments.


function::pid2execname PID


  • PID: The process ID of the process whose executable path you want to determine.




Simple Usage:

Get the executable path for process ID 1234:

function::pid2execname 1234

Complex Usage:

Combine with other commands to extract specific information:

function::pid2execname 1234 | xargs basename

Common Issues

  • Ensure that the PID provided is valid and corresponds to a running process.
  • Not all processes have an associated executable file, such as kernel threads. In these cases, the command may return an empty string.


  • Use with ps to display process information, including executable paths:
ps -eo pid,comm,function::pid2execname
  • Combine with grep to search for specific processes based on their executable names:
ps -ef | grep function::pid2execname | grep /usr/bin/python

Related Commands

  • ps: Display process information.
  • top: Display real-time process information.
  • pstree: Display a tree of processes.