Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

I am trying to use 'ps' unix command to see the full command the task used. Currently I use "ps -ef" to see the list of process but some process use the command with very long path and the command only been displayed partly not the whole thing. Is there a option to display the whole thing.

2006-10-23 Retitled by GrandFather, as per Monastery guidelines

  • Comment on (OT) How to use ps unix command to see the task full command

Replies are listed 'Best First'.
Re: (OT) How to use ps unix command to see the task full command
by jcoxen (Deacon) on Oct 23, 2006 at 19:30 UTC
    A lot of this depends on your OS and your terminal software. The syntax you would use can vary depending on which *nix you're running so 'man ps' and RTFM. The terminal emulator you use should have line wrapping turned on (if it's an option). Other options may help as well - RTFM again and YMMV.

    The reason I'm not actually answering your question is that 'ps -ef' on my Debian system accessed via putty from my WinXP system emulating an xterm with Autowrap turned on displays long paths/command lines (167 characters) just fine. I do recommend piping the 'ps -ef' through an appropriate grep (eg 'ps -ef | grep <username>').

    Hope this helps, Jack

    P.S. You might want to mark your off-topic (non Perl related) questions as such by putting 'OT' in the title.

    Jack

Re: (OT) How to use ps unix command to see the task full command
by Old_Gray_Bear (Bishop) on Oct 23, 2006 at 19:34 UTC
    Yes, there is an option to display more information. You will find it documented on the man() page for ps.

    ----
    I Go Back to Sleep, Now.

    OGB

Re: (OT) How to use ps unix command to see the task full command
by shenme (Priest) on Oct 23, 2006 at 21:06 UTC
    ... but if your OS is Sun Solaris you will only get a maximum of 80 characters of the command line, at least with 'ps'. See why it was important to say which OS you were on?
      You might be able to use the SunOS style /usr/ucb/ps -axw to get more information. I think the -l flag gives a longer listing and the -e flag gives the environment for each process as well.

      Cheers,

      JohnGG

Re: (OT) How to use ps unix command to see the task full command
by Cabrion (Friar) on Oct 24, 2006 at 01:39 UTC
    You want one (or more) w's in your args. like 'ps efwww' w = wide.
Re: (OT) How to use ps unix command to see the task full command
by blazar (Canon) on Oct 24, 2006 at 13:13 UTC
    I am trying to use 'ps' unix command to see the full command the task used.

    It seems that nobody has mentioned Proc::ProcessTable yet, which greatly eases this kind of tasks. Alternatively under Linux, but I don't know under how many other unices, you can check <c>"/proc/$pid/cmdline".

      Try first setting the column with of your terminal to something very wide, e.g. 'export COLUMNS=125', press Enter, then 'ps A' This worked on my Mac's Terminal app to see the full path with the terminal window expanded edge to edge. Using only the 'A' parameter eliminates other column data, making best use of your wide terminal.