How can I grep the PS output with the headers in place?
These two process make up an app running on my server....
root 17123 16727 0 16:25 pts/6 00:00:00 grep GMC
root 32017 1 83 May03 ? 6-22:01:17 /scripts/GMC/PNetT-5.1-SP1/PNetTNetServer.bin -tempdir /usr/local/GMC/PNetT-5.1-SP1/tmpData -D
does 6-22:01:17 mean that it's been running for 6 days? I'm tring to determine the length of how long the process has been running...
Is the 2nd column the process id? So if I do kill 32017 it'll kill the 2nd process?
ps -eselects all processes, andps -fis full-format listing which shows the column headers. Then we pipe the column headers and output to egrep, which is extended grep and allows the pipe|to have a special meaning, which is OR (this OR that). So you end up matching the PID in the column headers plus the output lines that matter. – Elijah Lynn Feb 16 '17 at 20:43
– Vlax Apr 03 '17 at 08:49ps -ef | grep -E 'GMC|PID'