Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

EDITED:

  1. These are the the only most commonly used (and important) ps command options I've come across so far: $ ps ux, $ ps au, $ ps aux, $ ps U aahan, $ ps uU aahan So, is that all, or am I missing 1 or 2?

  2. Can someone tell me the difference between $ ps au and $ ps aux?

share|improve this question

closed as not constructive by Gilles, Caleb, Michael Mrozek Aug 6 '11 at 6:57

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.If this question can be reworded to fit the rules in the help center, please edit the question.

    
These are some common ones I've been able to find (though I don't know if I'll ever be using them - - a newbie here): $ ps ux, $ ps -aux, $ ps U aahan, $ ps uU aahan –  its_me Aug 5 '11 at 21:53
1  
For the sake of clarity in terminology, it seems you are talking about the most commonly used options or sets of options to the one ps command (multiple versions of ps exist but that's probably not what you are after). –  jw013 Aug 5 '11 at 21:54
    
right, that's probably the term to use. Edited my question. –  its_me Aug 5 '11 at 21:56
2  
Questions asking for a long list of answers, like this one, do not work well on Stack Exchange, where we expect each answer to make an attempt at being the best answer. Please read the faq; you're essentially asking “what are your favorite ps options”. You can see an example of such a question here, left over from our early days when we didn't quite realize what a mess the answers would become. –  Gilles Aug 5 '11 at 22:40
2  
The complete list of possible flags are documented in the man pages. If you want to know the difference between ps au and ps aux look up what the x flag does in the man page. If there is something you don't understand after that, then ask here. What options you use is less about "favorites" or "frequently used" and more about what YOU need to see. –  Caleb Aug 5 '11 at 22:57
show 1 more comment

2 Answers 2

up vote 2 down vote accepted

My most common is ps xuwww which shows the complete width of the command. Another common one I use is ps xo pid,ppid,cmd which just shows the process id, the parent's process id and the command string.

You ask the difference between ps au and ps aux. The x options shows processes that are not attached to a terminal; generally daemons or disowned, background processes. This is very useful when you want to check the status of a daemon (like tomcat or httpd) or the status of an application started from the window manager (which will not have a terminal associated with it).

share|improve this answer
    
If I may ask, how did you gain knowledge of all this? By using it over the years? –  its_me Aug 6 '11 at 0:42
    
Yes, I started on SysV and BSD, then moved to Ultrix, SunOS, NextStep, HP-UX, AIX, Solaris, FreeBSD, Linux. –  Arcege Aug 6 '11 at 0:49
    
From FreeBSD and Unix manpages it seems that the third w is redundant, is it right? –  Alois Mahdal Jun 19 '13 at 13:29
    
As I said, I've been using it for decades; I'm used to typing ps xuwww. Some versions could made the third w redundant. –  Arcege Jun 19 '13 at 23:57
add comment

To understand combination of options, you need to understand the options themselves. To get a glimpse, try ps --help. To see explanation of every option, see ps manual (man ps, but that's a reading for a very long evening).

There are several styles of passing options to command in Linux. It depends on the program, which style it understands. One of most common style is using single-letter options and passing them using - (dash), when it usually does not matter on order of options (e.g. ls -a -l is the same as ls -l -a -- "list, a-ll items using l-ong format") and they can be concatenated to use with one dash (so ps -al or ps -la is still the same as above).

Besides one-letter options, there are also one-letter parameters, which need their value, which, in case of ps -u aahan means "processes of u-ser aahan. (This is the exception to option grouping: such option has to be the last one in the group to prevent misinterpretation.)

Then there are long options like --help, which sometimes have obvious meaning, sometimes not, but it's another story.

ps, however, is unfortunately using some conglomerate of more styles: with the dash (command -o, which I believe iis called "linux style") or without the dash (command o, which I believe comes from BSD). This makes usual ps commands look a little confusing, but once you read ps --help, you should be able to recognize them.

To make it even more confusing, there are also several versions of ps. (The OSX ps has different options as Linux ps, for example.)

Well, I use ps -A (list all processes) most of the time, it's just because I didn't need any other yet. (Or, more probably I didn't know I needed them... :D).

My advice: Get to understand the basic ones, use them, and if ps does not answer your question: explore, study, experiment...

share|improve this answer
1  
The '-X' style in ps came from SysV, I believe, which became the POSIX style; the gnu version just combined the different styles into one command. –  Arcege Aug 6 '11 at 0:41
add comment

Not the answer you're looking for? Browse other questions tagged or ask your own question.