Hacker News new | ask | show | jobs
by majewsky 1998 days ago
Since you have the well-known "ps aux | grep $THING | grep -v grep" pattern in there, I'll plug one of my favorite shell functions:

  psgrep () {
    ps aux | sed -n '1p;/\<sed\>/d;/'"$1"'/p'
  }
This does basically the same, but includes the header line from `ps aux` in the output. For instance:

  $ psgrep alacritty
  USER         PID %CPU %MEM    VSZ   RSS TTY      STAT START   TIME COMMAND
  majewsky    3500  0.4  0.5 1427280 93644 ?       Sl   12:55   0:01 alacritty
1 comments

Interesting! Might also be useful for CSV mogrification then.