1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

"ps -aux | grep <something>" get whole line

Discussion in 'General' started by da1, Nov 29, 2011.

  1. da1

    da1 Member

    Messages:
    756
    Likes Received:
    0
    Hi guys,

    Maybe a newbie question but my "problem" is that while on a FreeBSD terminal (xfce4), when I grep for a process (via ps -aux | grep <proc>) I only get the max. number of characters my terminal can display horizontally. Is there a way to get he whole line ?

    Example:
    Code:
    [da1@catedral.ro 1:23pm] ~/>ps -aux | grep mysql
    mysql     1955  0.0  0.0  8344   800  ??  Is   18Nov11   0:00.02 /bin/sh /usr/local/bin/mysqld_safe --defaults-extra-fil
     
  2. SirDice

    SirDice Moderator Staff Member Moderator

    Messages:
    17,375
    Likes Received:
    3
    ps(1)

    ps -auwwx

    Consider using pgrep(1) instead of ps -aux | grep someprocess.
     
  3. da1

    da1 Member

    Messages:
    756
    Likes Received:
    0
    Damn... and I was just reading about the "w" option. Ow well ... one learns as long as one lives :).

    Thx SirDice.
     
  4. phoenix

    phoenix Moderator Staff Member Moderator

    Messages:
    3,407
    Likes Received:
    1
    # pgrep -lf <something in the command-line>
    # pgrep -lf mysql

    See the man page for more info: pgrep(1)

    There's also pkill(1). Between those, "ps | grep" constructs are no longer needed. :)
     
  5. da1

    da1 Member

    Messages:
    756
    Likes Received:
    0
    phoenix, thx :)