954,525 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

grep all but first line

"ps aux" outputs the following as the first line:
USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND

how can I preserve this line if I do a "ps aux | grep " so that I can still see the header for each column?

In essence, I want to grep all but the first line of the initial "ps aux" output.

TheWhite
Junior Poster
174 posts since May 2008
Reputation Points: 72
Solved Threads: 6
 

ok, I answered my own question. haha

ps aux | egrep '|USER'

I had to use egrep and single quote the string with the OR (|)

TheWhite
Junior Poster
174 posts since May 2008
Reputation Points: 72
Solved Threads: 6
 

ps supports and option "h" (not -h) that suppresses the header from getting printed.
See "OUTPUT FORMAT CONTROL" section in "man ps".

thekashyap
Practically a Posting Shark
811 posts since Feb 2007
Reputation Points: 254
Solved Threads: 75
 

This question has already been solved

Post: Markdown Syntax: Formatting Help
You