barrlinux
barrlinux

Reputation: 1

linux ps command to count number of running processes

does anyone know how I can pipe the results of ps -ef | grep ^$USER to wc -1

I already used ps -ef | grep ^$USER but know i want to pipe the command

Upvotes: 0

Views: 211

Answers (1)

Jatin Mehrotra
Jatin Mehrotra

Reputation: 11523

As per my understanding of your question you want all the running process from a particular user and pipe it to wc ( note its wc -l not -1)

so i used this

ps aux | grep ^$USER|wc -l

-a : Information for all processes associated with terminals.

-u : Information for processes in userlist.

-x : username (user running this command)

or this can also work

ps -u $USER|wc -l

for any commands if you want to know the details try man command in terminal for example man ps

Upvotes: 1

Related Questions