Domain Name Forum  

Go Back   Domain Name Forum > Web Design & Development > Programming > Shell Scripting

Thread Tools Display Modes
Old 03-19-2011, 09:40 PM
webdev webdev is offline
Senior Member
Join Date: Jun 2009
Posts: 7,868
Default 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...
Website Development
Domain Name Forum
Reply With Quote
Old 07-29-2017, 11:55 AM
steffidsouza46 steffidsouza46 is offline
Join Date: Jun 2017
Posts: 58

The -n +2 means “start passing through on the second line of output”. This is a quick hacky way: ls -lart. grep -v ^total . Basically, remove any lines that start with "total", which in ls output should only be the first line.
Reply With Quote

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

All times are GMT -4. The time now is 12:17 PM.

| Webmaster Forum | | Domain Name Forum |

Powered by vBulletin®
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.