Retrieving process name from PID

On all POSIX-compliant systems:

ps -p PID -o comm=

-o specifies the output format, comm= means the command name.

If you need to display the full command:

ps -fp PID