LinuxQuestions.org
Visit Jeremy's Blog.
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 08-11-2010, 06:13 AM   #1
pinga123
Member
 
Registered: Sep 2009
Posts: 684
Blog Entries: 2

Rep: Reputation: 37
Warning in Top 10 cpu consuming processes


I m using following command to find top 10 cpu consuming processes.
However whenever i execute the command i get
following warning.
Quote:
Warning: bad syntax, perhaps a bogus '-'? See /usr/share/doc/procps-3.2.7/FAQ
What can be done to avoid it?
Code:
# ps -auxf | sort -nr -k 3 | head -10
Warning: bad syntax, perhaps a bogus '-'? See /usr/share/doc/procps-3.2.7/FAQ
root     13494  0.1  0.5   9844  2824 ?        Ss   21:48   0:01  \_ sshd: root@pts/1
xfs       4694  0.0  0.3   3928  1700 ?        Ss   Aug09   0:00 xfs -droppriv -daemon
USER       PID %CPU %MEM    VSZ   RSS TTY      STAT START   TIME COMMAND
smmsp     4630  0.0  0.2   8048  1492 ?        Ss   Aug09   0:00 sendmail: Queue runner@01:00:00 for /var/spool/clientmqueue
rpc       4268  0.0  0.1   1808   604 ?        Ss   Aug09   0:00 portmap
root         7  0.0  0.0      0     0 ?        S<   Aug09   0:00 [kthread]
root         6  0.0  0.0      0     0 ?        S<   Aug09   0:00 [khelper]
root        52  0.0  0.0      0     0 ?        S<   Aug09   0:00  \_ [kseriod]
root      5115  0.0  0.2   2552  1108 ?        SN   Aug09   0:04 /usr/libexec/gam_server
root      5112  0.0  1.8  24428  9772 ?        SN   Aug09   0:00 /usr/bin/python -tt /usr/sbin/yum-updatesd
 
Old 08-11-2010, 06:18 AM   #2
linuxlover.chaitanya
Senior Member
 
Registered: Apr 2008
Location: Nagpur, India
Distribution: Cent OS 5/6, Ubuntu Server 10.04
Posts: 4,629

Rep: Reputation: Disabled
Just try

Code:
ps auxf | sort -nr -k 3 | head -10
 
Old 08-11-2010, 06:18 AM   #3
sem007
Member
 
Registered: Nov 2006
Distribution: RHEL, CentOS, Debian Lenny, Ubuntu
Posts: 638

Rep: Reputation: 113Reputation: 113
just remove - from auxf option.

Code:
ps auxf | sort -nr -k 3 | head -10
 
Old 08-11-2010, 06:22 AM   #4
r3sistance
Senior Member
 
Registered: Mar 2004
Location: UK
Distribution: CentOS 6/7
Posts: 1,375

Rep: Reputation: 217Reputation: 217Reputation: 217
Well I would query what is the advantage of this over using top? My guess at what is wrong, as far as I know there is no such option as -x. I believe you have confused "ps aux" with "ps -aux", however "ps aux -f" will not work either... maybe auxf?
 
Old 08-11-2010, 06:26 AM   #5
pinga123
Member
 
Registered: Sep 2009
Posts: 684
Blog Entries: 2

Original Poster
Rep: Reputation: 37
Unhappy

Quote:
Originally Posted by r3sistance View Post
Well I would query what is the advantage of this over using top? My guess at what is wrong, as far as I know there is no such option as -x. I believe you have confused "ps aux" with "ps -aux", however "ps aux -f" will not work either... maybe auxf?
Confused.
 
Old 08-11-2010, 06:30 AM   #6
r3sistance
Senior Member
 
Registered: Mar 2004
Location: UK
Distribution: CentOS 6/7
Posts: 1,375

Rep: Reputation: 217Reputation: 217Reputation: 217
Essentially I toke a guess at the correct interpretation, the other two who got in above confirm my suspicion you were after "ps auxf", not "ps -auxf", there is a difference. If you are asking about top, it's a facility that comes with most distributions (as far as I know) what will generally tell you the most intensive tasks being run, along with CPU and RAM usage (as well as a few other things)... the fact your title contains the word top threw me at first too, because of this facility.

Last edited by r3sistance; 08-11-2010 at 06:32 AM.
 
Old 08-11-2010, 06:31 AM   #7
pinga123
Member
 
Registered: Sep 2009
Posts: 684
Blog Entries: 2

Original Poster
Rep: Reputation: 37
Thanks you all for your reply .But i found it little strange as For giving an option to a command i normally use a hyphen "-" Why this is not the case with ps?
Is this a kind of bug?
 
Old 08-11-2010, 06:32 AM   #8
linuxlover.chaitanya
Senior Member
 
Registered: Apr 2008
Location: Nagpur, India
Distribution: Cent OS 5/6, Ubuntu Server 10.04
Posts: 4,629

Rep: Reputation: Disabled
No not a bug.
 
Old 08-11-2010, 06:35 AM   #9
r3sistance
Senior Member
 
Registered: Mar 2004
Location: UK
Distribution: CentOS 6/7
Posts: 1,375

Rep: Reputation: 217Reputation: 217Reputation: 217
I believe it's intensional, I would assume it's likely due to the vast amount of options given with the command but I can not confirm this as I have never checked this with certainty. I do not believe ps is unique in this matter either but it's certainly very rare.
 
Old 08-11-2010, 06:36 AM   #10
pinga123
Member
 
Registered: Sep 2009
Posts: 684
Blog Entries: 2

Original Poster
Rep: Reputation: 37
Quote:
Originally Posted by linuxlover.chaitanya View Post
No not a bug.
Thanks for your reply but i m curious to know why was it considered under warning. It is a new trend not to use "-" with the commands or it is specific to ps command only.
 
Old 08-11-2010, 06:38 AM   #11
linuxlover.chaitanya
Senior Member
 
Registered: Apr 2008
Location: Nagpur, India
Distribution: Cent OS 5/6, Ubuntu Server 10.04
Posts: 4,629

Rep: Reputation: Disabled
It is a warning because you violated the syntax for the particular command. It is peculiar in that sense.
 
Old 08-11-2010, 06:41 AM   #12
pinga123
Member
 
Registered: Sep 2009
Posts: 684
Blog Entries: 2

Original Poster
Rep: Reputation: 37
Quote:
Originally Posted by linuxlover.chaitanya View Post
It is a warning because you violated the syntax for the particular command. It is peculiar in that sense.
from other forum i got to know that Option 'a' is part of bsd syntax and doesnt really need a '-' before the option.
However I think i m far behind to actually understand what does this statement means. I m trying my level best to grab the linux technology.Thanks for your reply.

I must admit someone from india is a active member of such a wonderful site.Hats off to you.

Last edited by pinga123; 08-11-2010 at 06:42 AM.
 
Old 08-11-2010, 06:45 AM   #13
pinga123
Member
 
Registered: Sep 2009
Posts: 684
Blog Entries: 2

Original Poster
Rep: Reputation: 37
I think following comment helped me understand the concept much better .Just sharing for others .

Quote:
BSD is one of the oldest derivative of Unix operating system. BSD uses options with no dash. Recent forms of ps commands supports all three forms, no dash, single dash and double dashes...


Here is the statement from ps man page...




NAME
ps - report a snapshot of the current processes.

SYNOPSIS
ps [options]

DESCRIPTION
ps displays information about a selection of the active processes. If you want a repetitive
update of the selection and the displayed information, use top(1) instead.

This version of ps accepts several kinds of options:
1 UNIX options, which may be grouped and must be preceded by a dash.
2 BSD options, which may be grouped and must not be used with a dash.
3 GNU long options, which are preceded by two dashes.
 
Old 08-11-2010, 07:19 AM   #14
linuxlover.chaitanya
Senior Member
 
Registered: Apr 2008
Location: Nagpur, India
Distribution: Cent OS 5/6, Ubuntu Server 10.04
Posts: 4,629

Rep: Reputation: Disabled
Thanks for sharing.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
kacpi_notify consuming 50% of cpu ratitu Linux - Laptop and Netbook 1 06-21-2010 01:48 AM
Finding the top CPU-using processes? "top" command does not help... catalytical Linux - Server 1 04-06-2009 04:50 PM
Apache is consuming all CPU resources romeo_tango Solaris / OpenSolaris 6 01-04-2008 05:43 AM
printer consuming 100% cpu jonfa Solaris / OpenSolaris 8 05-18-2007 04:34 PM
CPU load high, top processes very low? Thinking Linux - Software 12 03-19-2007 12:59 AM

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

All times are GMT -5. The time now is 11:00 PM.

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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration