function::pexecname - Linux


Function::pexecname extracts the executable portion of a process’s name from a process ID. It’s useful for identifying the original command that started a process, even after that process has been renamed.



| Parameter | Description |
| pid | The ID of the process (PID) to identify. |


This function does not have any options or flags.


Simple example:

my $process_id = 12345;
my $command_name = function::pexecname($process_id);

Usage in a script:


use strict;
use warnings;
use Function::Pexecname;

my $pid = shift;
my $command_name = function::pexecname($pid);

Common Issues

  • If the process is no longer running or the pid is invalid, an error will be returned.


Combining with other commands:

  • Use pexecname with ps -p to get more information about a process, including its parent process and command line arguments.

Related Commands

  • ps – List processes
  • pstree – Display a tree of processes
  • top – Monitor system and process activity