Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I need to grep process by information containing in CMD column, but this column strings is cut(limited) and needed info is lost. Please suggest how can I enlarge string size allowed for CMD column.

share|improve this question
up vote 1 down vote accepted

You can try grepping in the /proc directory:

$ grep -a foo /proc/[0-9]*/cmdline

The -a switch says to treat binary files as text files, since cmdline files are recognized as binary. /proc/[0-9]* says to only look at the directories mapped to PIDs. When you find a match, you can use that output to get the PID from the directory structure.

share|improve this answer

Add the -w option twice to remove the width limit.

share|improve this answer
Aaaand that makes my answer look stupid. I missed that option; good one. – user235731 Jul 12 '13 at 12:35
I got next trying this: ps: illegal option -- w – user590444 Jul 12 '13 at 12:36
@user590444: Exactly what OS and which ps version are you using? – grawity Jul 12 '13 at 13:51
Current system SunOS 5.1 – user590444 Jul 13 '13 at 13:50

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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