Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers processnaming
# 1  
Old 05-07-2002

I am confused of what a processes name is considered to be. Maybe answers the following questions may clear it up for me.

1) Is a processname the same thing as a UID?
2) What other ways can you name a process?

After doing a ps -ef cmd, amoung other output I extracted the following that seems to relate to me:

root 9956 3572 0.0 16:00:31 ttyp6 0:00.04 ps -ef
steve 10046 3546 0.0 15:59:53 ttypc 0:00.04 emacs file.txt
steve 8185 3546 0.0 15:59:50 ttypc 0:00.04 emacs file.txt
steve 9860 3546 0.0 15:59:56 ttypc 0:00.04 emacs file.txt
steve 9290 8325 0.0 15:12:51 ttyp8 0:00.06 -csh (csh)
steve 3546 3348 0.0 08:23:42 ttypc 0:00.70 -csh (csh)
steve 10047 9290 0.0 15:57:53 ttyp8 0:00.02 vi finq9

If I execute the following command:

steve> ps -ef | grep processname | awk '{printf $1 " " $2 " " $3 "\n"}'

I get this output:

steve 7001 3572

3) Is Steve the process name?
4) Why does root show up as the UID when I do the ps -ef command?
5) bonus question: is a process by any other name still a process? (just kidding)

regards and thanks...

# 2  
Old 05-07-2002
Use the man page. man ps. And read the simples rules.

# 3  
Old 05-07-2002
I had already looked at the man pages...

Is there anybody willing to answer these basic questions??
# 4  
Old 05-07-2002
Processes do not have names. That's the first thing that's confusing you. For some reason you think they do.

"steve" is your user name. It is certainly not a process name.

When you run a command like "ps -ef", the string "ps -ef" is a command line. Your shell will locate a file called "ps" ( probably in /usr/bin/ps) and it will run it. Some people will often say that "ps" is the process' name in a case like this.

Each process gets a unique number called a pid. This number might have a stronger claim to being a process' name.

The instances of csh that show are an interesting case. Notice the "-csh (csh)". When the login program invoked /usr/bin/csh it passes arguments to it. Normally, argument 0 is the name of the file that is running. But if you write in c, you can set that argument to anything. The login program puts a minus sign in front of the file name. csh inspects the first argument and if it starts with a minus sign, it acts like a login shell.

Some people will call argument 0 the process' name. Others go with the name of the file that is running. Your ps program noticed that they different, so it showed both.

So a process had a pid, which is unique to it. It has a file name that it came from which is not necessarily unique. And it has a argument 0, which is often the same as the filename. Take your pick which, if any, you want to call a process name.

In my mind, ps, csh, etc are the names of programs. You and I can both run the ps program at the same time. If we do we get different processes. And our processes have only a number, not a name.

If you are running csh as your shell, you could type the command "exec sh". csh would then overlay itself with sh and you would be running a new shell. But the process would be the same. Try it:
ps -f
exec sh
ps -f
You get a new shell, but you're still using the same process.
# 5  
Old 05-08-2002
Thank you, that did help.

I was able to understand some of the ambiguity regarding a process name and construct a command to extract the data I needed.

Just to clear up one of my other questions... in the example I gave previously: ps -ef | grep processname

Just what does "processname" mean to grep in this string? From the results that I got, it seems that this must be a unix predefined term that means the process that you are currenty in.

I can't find processname defined anywhere. Is it just an undocumented feature of unix?

thanks again,

# 6  
Old 05-08-2002
Hammer & Screwdriver processname

think of processname as the same as service name
in an NT plateform

for example if you are running a web server on your unix server you expect http daemon process to be running, the processname in this case is http

on an NT plateform you expect http service or www
service to be running.

to check if http daemon process is running on unix
server, you will use the command

ps -ef | grep http

grep simply means search a file for pattern

I hope this explains it all
Login or Register to Ask a Question

Previous Thread | Next Thread
Login or Register to Ask a Question