how to count specific process with cli? [answered]
Hello all,
i would like to count the number of process in terminal.
I don't know exactly how to do this.
After informing into internet, i may use the combination of ps with grep.
I tried:
ps -aux | grep process_name
And i get all the lines of process with the defined name.
Normally grep has the option -c to count the lines, but it doesn't work here. why?
With -n seems that i get the line number and the line. Do i have the info that i need?
There is no possibility to check command man-page? with man. nor alternative?
edit. commands which work:
ps aux | grep process_name | wc -l
ps aux | grep -c process_name
Should be no '-' before 'aux'
Could someone help me for this please?
Thank you very much in advance.
Cheers
Option
-c
does work, I've just tested it... So we can't tell you why:ps aux | grep -c process_name
I think it's not the good place to learn general Linux stuff.
Sthocs ( 2017-04-28 16:12:35 +0300 )edityes i know. the problem that i had was that i get a reponse with ps -aux alone and ps -aux | grep process name, but at the moment i tried to put the option -c to grep i got an error .
cemoi71 ( 2017-04-28 16:58:36 +0300 )editthen i thought that the cli in sfos would be a little bit different, that why i started here.
I remarked my error as the leszek give me his solution with ps aux (without '-' before)...