In Bash shell - the ps -ef
shows only the /bin/bash but the script name is not displayed ? Is there any way to get the script names for the process command ?
--- Post updated at 08:39 AM ---
in KSH (Korn Shell), my command output shows the script names but when run in the Bash Shell (/bin/bash) ... it is all showing up as /bin/bash
Have a look in the manual page for ps for a variety of options. You can ask (with the -o option) for various items of output.
Please can you post your OS name and version. There are differences between them, so it's important to know which you have.
In ps -f
or ps -o args
it is
always ksh scriptname
or bash scriptname
.
In ps -o fname
it is
-
bash
when started as bash scriptname
-
scriptname
when started as ./scriptname
Unfortunately some OS have a very small field for the fname
. So it may appear truncated e.g. scriptname
can become scriptna
.
Some OS have ps -o comm
as a wider field and use it like the fname
, some other OS stuff the pathname into it.
Note: that the default scope is: only processes with a terminal associated,
-e
means all processes,
-u user
means all processes owned by user
.
I have seen a lot of bash < /some/script
lately. It seems to be a new Linux habit. In such a case the script is input and may not be displayed in a ps
-output.
I hope this helps.
bakunin
2 Likes