LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 07-27-2016, 04:40 PM   #1
imaso001
LQ Newbie
 
Registered: Jul 2016
Posts: 6

Rep: Reputation: Disabled
count number of processes


What command would you enter to count the number of
processes running under your account?

I have tried these commands so far:

ps -Af | grep emacs | grep -v grep | wc -l

it tells me to "Use 'grep' to select lines containing your name"


ps -Af |grep -c emacs

it tells me to " Use 'grep' to select lines containing your name."

ps -Af | grep emacs | wc -l
it tells me to " Use 'grep' to select lines containing your name."

No luck with any of these please help!
 
Old 07-27-2016, 05:03 PM   #2
suicidaleggroll
LQ Guru
 
Registered: Nov 2010
Location: Colorado
Distribution: OpenSUSE, CentOS
Posts: 5,573

Rep: Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142
Quote:
Originally Posted by imaso001 View Post
What command would you enter to count the number of
processes running under your account?

I have tried these commands so far:

ps -Af | grep emacs | grep -v grep | wc -l
Why would you grep for emacs? That doesn't match the problem description at all.

Quote:
Originally Posted by imaso001 View Post
it tells me to "Use 'grep' to select lines containing your name"
What is "it", and why haven't you followed "it"'s instructions to grep for your user name instead of "emacs"?
 
Old 07-27-2016, 05:07 PM   #3
imaso001
LQ Newbie
 
Registered: Jul 2016
Posts: 6

Original Poster
Rep: Reputation: Disabled
My terminal l am putting the commands in, my teacher has it set up to where it tells me if the answer is correct or wrong.
 
Old 07-27-2016, 05:54 PM   #4
jpollard
Senior Member
 
Registered: Dec 2012
Location: Washington DC area
Distribution: Fedora, CentOS, Slackware
Posts: 4,912

Rep: Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513
read the ps man page...
read the tail man page (though you might miss the part you need)
read the wc man page
 
Old 07-28-2016, 02:13 PM   #5
RockDoctor
Senior Member
 
Registered: Nov 2003
Location: Minnesota, US
Distribution: Fedora, Ubuntu, Manjaro
Posts: 1,791

Rep: Reputation: 427Reputation: 427Reputation: 427Reputation: 427Reputation: 427
Look carefully at the output of your ps command, and read the man page for grep. The information you need is in the man page
 
Old 07-30-2016, 09:22 PM   #6
Fred Caro
Senior Member
 
Registered: May 2007
Posts: 1,007

Rep: Reputation: 167Reputation: 167
Quote:
read the tail man page
How would you instigate this on the cmd line?

Fred
 
Old 07-30-2016, 09:47 PM   #7
jpollard
Senior Member
 
Registered: Dec 2012
Location: Washington DC area
Distribution: Fedora, CentOS, Slackware
Posts: 4,912

Rep: Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513
Were you sleep in class? The man command should have been given on the first day.
 
Old 07-31-2016, 11:38 AM   #8
RockDoctor
Senior Member
 
Registered: Nov 2003
Location: Minnesota, US
Distribution: Fedora, Ubuntu, Manjaro
Posts: 1,791

Rep: Reputation: 427Reputation: 427Reputation: 427Reputation: 427Reputation: 427
Quote:
Originally Posted by Fred Caro View Post
How would you instigate this on the cmd line?

Fred
I'd start by googling how to use google search from the command line. Once I received that result, I'd open a terminal window and, using what I learned previously to do that from the command line, google how to read the man page for tail.

I hope I didn't misunderstand your question
 
Old 07-31-2016, 08:41 PM   #9
Fred Caro
Senior Member
 
Registered: May 2007
Posts: 1,007

Rep: Reputation: 167Reputation: 167
Quote:
How would you instigate this on the cmd line?
My point is that this kind help is not very helpful.

The crux of the issue is displaying a count of processes for his account, don't know where he got "emacs" from.

Note as already said "man ps" gives some illumination:

Quote:
ps -aux myaccount
returns an error

This is not clear behavior as detailed in the man page

Also there is a difference between BSD ps and GNU.


Fred.

Last edited by Fred Caro; 07-31-2016 at 08:43 PM. Reason: give credit
 
Old 08-01-2016, 03:55 AM   #10
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 21,841

Rep: Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308
Fred Caro and imaso001 are the same user?
Quote:
This is not clear behavior as detailed in the man page
would be nice to know what is unclear.

Also I'm not really sure about what do you really need.
 
Old 08-01-2016, 05:42 AM   #11
gknetw
LQ Newbie
 
Registered: Mar 2012
Posts: 6

Rep: Reputation: Disabled
ps -u $USER | wc -l
 
Old 08-01-2016, 07:36 AM   #12
jpollard
Senior Member
 
Registered: Dec 2012
Location: Washington DC area
Distribution: Fedora, CentOS, Slackware
Posts: 4,912

Rep: Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513
It WAS a homework assignment...

Which was why we were trying to get the OP to read the man pages.
 
Old 08-01-2016, 08:09 PM   #13
Fred Caro
Senior Member
 
Registered: May 2007
Posts: 1,007

Rep: Reputation: 167Reputation: 167
No fred caro is not the same "user" as imaso001 and the homework thing why I (fred) did not just give the answer.

But since an answer has been given, note also that:

Quote:
ps -aux fred
gives a warning or "error" but

Quote:
ps -au fred
does not.

this is partly explained in the ps man page but people find man pages difficult to interpret and telling people just too read the man page rather than a pointer as well as a (or many) man page[s] is not as helpful.

Fred.
 
Old 08-02-2016, 05:52 AM   #14
jpollard
Senior Member
 
Registered: Dec 2012
Location: Washington DC area
Distribution: Fedora, CentOS, Slackware
Posts: 4,912

Rep: Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513
Quote:
Originally Posted by Fred Caro View Post
this is partly explained in the ps man page but people find man pages difficult to interpret and telling people just too read the man page rather than a pointer as well as a (or many) man page[s] is not as helpful.

Fred.
The way you learn is to read the man page, then try the options out to see if it does what you think.

And telling people to read the documentation IS the most helpful.
 
1 members found this post helpful.
Old 08-03-2016, 10:29 AM   #15
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 21,841

Rep: Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308
Quote:
Originally Posted by jpollard View Post
The way you learn is to read the man page, then try the options out to see if it does what you think.

And telling people to read the documentation IS the most helpful.
Just a comment to this:
I read always the man page first, if something is unclear or some unexpected thing happened. This is really the first source to understand what's happening. So I think it is not a bad idea at all.
 
1 members found this post helpful.
  


Reply

Tags
command processing



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 Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] Count Number of Days sweeny_here Programming 12 02-24-2016 08:19 AM
Linux commands to print the number of users & number of processes!!? m7com Linux - Newbie 3 04-30-2014 12:59 PM
[SOLVED] how to count number sessions of users? wwinay Linux - General 11 02-28-2013 02:40 AM
[SOLVED] how can I count how many of my processes are running HarryBoy Linux - Newbie 2 11-03-2010 09:42 AM
count number of used ports mnchur Linux - General 2 02-10-2009 02:11 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 07:27 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration