F . Brasburg F . Brasburg - 7 months ago 43
Bash Question

Set process name in shell

I have something like this

./myProcess.sh &


So I run it in background. When I put ps the proccess name is "bash".

16282 pts/5 00:00:00 bash


Is there any way of starting a process with a name? When I put the command ps, I wanna see the proccess name (and the PID, and other information), not "bash".

Thank you so much

Answer

The script name is in bash's command-line, it's just ps doesn't display it by default. You can use ps -f to print the full argument list.

$ ps -f
jkugelm+  28798   9819  0 16:17 pts/0    00:00:00 /bin/bash ./myProcess.sh