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

General questions about the FreeBSD operating system. Ask here if your question does not fit elsewhere.

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

Postby da1 » 29 Nov 2011, 13:10

Hi guys,

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

Example:
Code: Select all
[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
da1
Member
 
Posts: 738
Joined: 02 Sep 2009, 09:35
Location: Berlin,DE

Postby SirDice » 29 Nov 2011, 13:15

[man=1]ps[/man]

[cmd=]ps -auwwx[/cmd]

Consider using [man=1]pgrep[/man] instead of [file]ps -aux | grep someprocess[/file].
Senior UNIX Engineer at Unix Support Nederland
Experience is something you don't get until just after you need it.
User avatar
SirDice
Old Fart
 
Posts: 16185
Joined: 17 Nov 2008, 16:50
Location: Rotterdam, Netherlands

Postby da1 » 29 Nov 2011, 13:23

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

Thx SirDice.
da1
Member
 
Posts: 738
Joined: 02 Sep 2009, 09:35
Location: Berlin,DE

Postby phoenix » 30 Nov 2011, 22:16

[cmd=#]pgrep -lf <something in the command-line>[/cmd]
[cmd=#]pgrep -lf mysql[/cmd]

See the man page for more info: [man=1]pgrep[/man]

There's also [man=1]pkill[/man]. Between those, "ps | grep" constructs are no longer needed. :)
Freddie

Help for FreeBSD: Handbook, FAQ, man pages, mailing lists.
User avatar
phoenix
MFC'd
 
Posts: 3349
Joined: 17 Nov 2008, 05:43
Location: Kamloops, BC, Canada

Postby da1 » 01 Dec 2011, 09:54

phoenix, thx :)
da1
Member
 
Posts: 738
Joined: 02 Sep 2009, 09:35
Location: Berlin,DE


Return to General

Who is online

Users browsing this forum: No registered users and 0 guests