LinuxQuestions.org
Support LQ: Use code LQ3 and save $3 on Domain Registration
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices

Reply
 
Search this Thread
Old 02-17-2013, 05:51 AM   #1
techie_san778
Member
 
Registered: Jul 2011
Posts: 69

Rep: Reputation: Disabled
Exclamation What is the meaning of o/p of "who -u" commad


Hi friends,

I have few question on the o/p of the "who -u" command:
$who -u
San tty1 2013-02-17 15:35 old 2526 (:0)
San pts/0 2013-02-17 15:36 00:01 2714 (:0)
San pts/1 2013-02-17 15:36 . 3017 (:0.0)

Here, 3017 is the process id that is current process. Are 2714 and 2526 too process id's ? If so, then why don't they show up in ps command ?

What does the 4th Column (15:35, 15:36, 15:36)signify?

What does pts/0 and pts/1 mean ?
 
Old 02-17-2013, 06:10 AM   #2
druuna
LQ Veteran
 
Registered: Sep 2003
Posts: 10,532
Blog Entries: 7

Rep: Reputation: 2374Reputation: 2374Reputation: 2374Reputation: 2374Reputation: 2374Reputation: 2374Reputation: 2374Reputation: 2374Reputation: 2374Reputation: 2374Reputation: 2374
Those are indeed process id's.

Which ps command did you use? They do show up on my side:
Code:
# who -u
druuna   tty7         2013-02-17 08:45  old         3522 (:0)
druuna   pts/0        2013-02-17 12:02   .         27995 (:0.0)
druuna   pts/1        2013-02-17 12:05   .         28197 (stasis.wildfire.nl)

# ps -ef | grep 28197
root     28197  2898  0 12:05 ?        00:00:00 sshd: druuna [priv]
druuna   28205 28197  0 12:05 ?        00:00:00 sshd: druuna@pts/1
The fourth column shows the time the connection was set up/established.

In a nutshell: pts stands for pseudo terminal and one is needed for each connection (count start at 0)
 
Old 02-17-2013, 09:09 AM   #3
techie_san778
Member
 
Registered: Jul 2011
Posts: 69

Original Poster
Rep: Reputation: Disabled
See, in ur case, the process that is shown in the o/p of the ps command is 28197
which is the current process id (last process) in the who -u command o/p. But the others,
i.e. 27995 & 3522 are not shown.
Same is my case. Only the last process of the who -u is shown in the ps command o/p.
But not the other two. Why ?? that's my question .. got ??
 
Old 02-17-2013, 10:49 AM   #4
druuna
LQ Veteran
 
Registered: Sep 2003
Posts: 10,532
Blog Entries: 7

Rep: Reputation: 2374Reputation: 2374Reputation: 2374Reputation: 2374Reputation: 2374Reputation: 2374Reputation: 2374Reputation: 2374Reputation: 2374Reputation: 2374Reputation: 2374
Quote:
Originally Posted by techie_san778 View Post
Only the last process of the who -u is shown in the ps command o/p.
But not the other two. Why ??
Because the example I give only looks for one specific PID.

ps -ef | egrep "28197|27995|3522" would have shown the processes for all three pids.

This would also work:
Code:
ps -fp 28197,27995,3522
 
Old 02-18-2013, 10:43 AM   #5
techie_san778
Member
 
Registered: Jul 2011
Posts: 69

Original Poster
Rep: Reputation: Disabled
I am using only ps command, with no options to grep any particular pid.
Then, all the pid's should show up.. right ?? Why, then only current pid is shown ? btw, what is the meaning of old in the 5th column ?

Last edited by techie_san778; 02-18-2013 at 10:49 AM.
 
Old 02-18-2013, 11:27 AM   #6
druuna
LQ Veteran
 
Registered: Sep 2003
Posts: 10,532
Blog Entries: 7

Rep: Reputation: 2374Reputation: 2374Reputation: 2374Reputation: 2374Reputation: 2374Reputation: 2374Reputation: 2374Reputation: 2374Reputation: 2374Reputation: 2374Reputation: 2374
Quote:
Originally Posted by techie_san778 View Post
I am using only ps command, with no options to grep any particular pid.
Then, all the pid's should show up.. right ??
Wrong!

A bare ps shows a limited amount of information. This from the ps man page:
Quote:
By default, ps selects all processes with the same effective user ID (euid=EUID) as the current user and associated with the same terminal as the invoker. It displays the process ID pid=PID), the terminal associated with the process (tname=TTY), the cumulated CPU time in [dd-]hh:mm:ss format (time=TIME), and the executable name (ucmd=CMD). Output is unsorted by default.
The owner of the starting process (shown bu who -u) is root, so it isn't shown:
Code:
$ who -u
druuna   tty1         Feb 18 09:11 08:05        1958

$ ps -ef | grep 1958
root           1958     1  0 09:05 tty1     00:00:00 /bin/login --       
druuna    1986  1958  0 09:11 tty1     00:00:00 -bash
druuna    7260  7252  0 17:17 pts/0    00:00:00 grep 1958

$ ps                  # show only owned by druuna an attached to terminal
  PID TTY          TIME CMD
 7252 pts/0    00:00:00 bash
 7262 pts/0    00:00:00 ps
Quote:
btw, what is the meaning of old in the 5th column ?
I truly don't know.
 
Old 02-18-2013, 11:50 AM   #7
shivaa
Senior Member
 
Registered: Jul 2012
Location: Grenoble, Fr.
Distribution: Sun Solaris, RHEL, Ubuntu, Debian 6.0
Posts: 1,797
Blog Entries: 4

Rep: Reputation: 285Reputation: 285Reputation: 285
In addition to druuna's answers above, once go through manual of ps cmd, see here or invoke:
Code:
~$ man ps
You should use either of below options as well:-
Code:
-A	       Select all processes. Identical to -e.

-a	       Select all processes except session leaders (see
	       getsid(2)) and processes not associated with a
	       terminal.
So you can try:
Code:
~$ ps -aef | grep pid
OR
~$ ps -Af | grep pid
OR
~$ pgrep pid
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
What is meaning of "has pages locked into memory (for real-time and custom IO) " ? dtustudy68 Programming 2 05-13-2011 02:08 PM
What is the meaning of using "__KERNEL__" and "MODULE" macro? nithima Linux - Newbie 1 10-18-2010 09:26 PM
please explain meaning of "Good Memory Size" in AIX nagendrar AIX 1 12-17-2009 10:13 AM
The meaning of "/dev/md0: No md super block found"? PhillipHuang Linux - Software 6 01-10-2007 08:37 PM


All times are GMT -5. The time now is 03:27 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration