05-07-2002
9,926,
461
Join Date: Aug 2001
Last Activity: 26 February 2016, 12:31 PM EST
Location: Ashburn, Virginia
Posts: 9,926
Thanks Given: 63
Thanked 461 Times in 270 Posts
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.