ps command | Unix Linux Forums | UNIX for Dummies Questions & Answers

  Go Back    


UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !!

ps command

UNIX for Dummies Questions & Answers


Closed Thread    
 
Thread Tools Search this Thread Display Modes
    #1  
Old 05-18-2012
muffle muffle is offline
Registered User
 
Join Date: May 2012
Last Activity: 18 July 2012, 10:50 AM EDT
Posts: 11
Thanks: 0
Thanked 0 Times in 0 Posts
ps command

What is the difference between ps -ax and ps -x? I got the meaning here but don't understand it clearly.

-a List information about all processes most frequently requested: all those except process group leaders and processes not associated with a terminal.

-x includes processes not attached to terminals

what are proccess group leaders and processes not associated with a terminal? processes not attached to terminals?

Can please someone explain this to me.
Sponsored Links
    #2  
Old 05-18-2012
jlliagre jlliagre is offline Forum Advisor  
ɹǝsn sıɹɐlos
 
Join Date: Dec 2007
Last Activity: 17 April 2014, 8:27 AM EDT
Location: Paris
Posts: 4,364
Thanks: 15
Thanked 443 Times in 406 Posts
These options are describing the BSD ps syntax ( ps -x is invalid) so should not be prefixed by a dash.

process group leaders are processes that created a process group, commonly used with shell job control.

processes not associated with / attached to terminals are usually daemons and similar processes that do not use a terminal (tty) to read their input / write their output.
Sponsored Links
    #3  
Old 05-21-2012
muffle muffle is offline
Registered User
 
Join Date: May 2012
Last Activity: 18 July 2012, 10:50 AM EDT
Posts: 11
Thanks: 0
Thanked 0 Times in 0 Posts
Thank you so much for your reply.

I'm not sure about ps x. I read it from the book and it can run well when I type in the terminal.
    #4  
Old 05-21-2012
jlliagre jlliagre is offline Forum Advisor  
ɹǝsn sıɹɐlos
 
Join Date: Dec 2007
Last Activity: 17 April 2014, 8:27 AM EDT
Location: Paris
Posts: 4,364
Thanks: 15
Thanked 443 Times in 406 Posts
Quote:
Originally Posted by muffle View Post
I'm not sure about ps x. I read it from the book and it can run well when I type in the terminal.
That depends on the OS you use. It runs with a warning on Gnu/Linux but fails on Solaris.

Linux:

Code:
$ ps -x
Warning: bad ps syntax, perhaps a bogus '-'? See http://procps.sf.net/faq.html
  PID TTY      STAT   TIME COMMAND
 1611 ?        Ssl    0:00 gnome-session
 1642 ?        Ss     0:00 /usr/bin/ssh-agent /usr/bin/dbus-launch --exit-with-s

Solaris:

Code:
$ ps -x
ps: illegal option -- x
usage: ps [ -aAdeflcjLPyZ ] [ -o format ] [ -t termlist ]
        [ -u userlist ] [ -U userlist ] [ -G grouplist ]
        [ -p proclist ] [ -g pgrplist ] [ -s sidlist ] [ -z zonelist ]
  'format' is one or more of:
        user ruser group rgroup uid ruid gid rgid pid ppid pgid sid taskid ctid
        pri opri pcpu pmem vsz rss osz nice class time etime stime zone zoneid
        f s c lwp nlwp psr tty addr wchan fname comm args projid project pset

Sponsored Links
    #5  
Old 05-21-2012
radoulov's Avatar
radoulov radoulov is offline Forum Staff  
Moderator
 
Join Date: Jan 2007
Last Activity: 16 April 2014, 5:52 PM EDT
Location: Варна, България / Milano, Italia
Posts: 5,638
Thanks: 177
Thanked 607 Times in 565 Posts
As a side note, the Berkeley version of some Unix programs could be found in /usr/ucb on Solaris (ucb = University of California, Berkeley):



Code:
bash-3.2$ uname -sr; /usr/ucb/ps -x
SunOS 5.10
   PID TT       S  TIME COMMAND
 18261 ?        S  0:00 /usr/lib/ssh/sshd
 18270 pts/4    S  0:00 -ksh
 18296 pts/4    S  0:00 bash
 18446 pts/4    O  0:00 /usr/ucb/ps -x


Code:
SunOS/BSD Compatibility Package Commands                   ps(1B)

NAME
     ps - display the status of current processes

SYNOPSIS
     /usr/ucb/ps [-aceglnrSuUvwx] [-t term] [num]

DESCRIPTION
     The ps command displays information  about  processes.  Nor-
     mally,  only  those  processes  that  are  running with your
     effective user ID and are attached to a controlling terminal
     (see    termio(7I))  are  shown.  Additional  categories  of
     processes can be added to the display using various options.
     In particular, the -a option allows you to include processes
     that are not owned by you (that do not have your  user  ID),
     and  the  -x  option allows you to include processes without
     controlling terminals. When you specify both -a and -x,  you
     get processes owned by anyone, with or without a controlling
     terminal. The -r option  restricts  the  list  of  processes
     printed to running and runnable processes.


Last edited by radoulov; 05-21-2012 at 11:18 AM..
Sponsored Links
    #6  
Old 05-22-2012
muffle muffle is offline
Registered User
 
Join Date: May 2012
Last Activity: 18 July 2012, 10:50 AM EDT
Posts: 11
Thanks: 0
Thanked 0 Times in 0 Posts
Thanks to both jlliagre & radoulov. I understand now.
Sponsored Links
Closed Thread

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
passing command output from one command to the next command in cshell kaaliakahn UNIX for Dummies Questions & Answers 2 02-10-2012 04:59 PM
unix command : how to insert text at the cursor location via command line? xib.be UNIX for Advanced & Expert Users 0 12-22-2010 05:45 PM
Need help! command working ok when executed in command line, but fails when run inside a script! 4dirk1 Shell Programming and Scripting 4 12-02-2010 05:47 AM
awk command in script gives error while same awk command at prompt runs fine: Why? catalys Shell Programming and Scripting 4 09-20-2010 10:07 PM
awk/sed Command : Parse parameter file / send the lines to the ksh export command rajan_san Shell Programming and Scripting 4 11-06-2008 12:29 PM



All times are GMT -4. The time now is 08:58 AM.