Visit Our UNIX and Linux User Community


Warning in Top 10 cpu consuming processes


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Warning in Top 10 cpu consuming processes
# 1  
Old 08-11-2010
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

# 2  
Old 08-11-2010
Please use just 'ps auxf' without the -
This User Gave Thanks to rajamadhavan For This Post:
# 3  
Old 08-11-2010
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?
# 4  
Old 08-11-2010
Nope...You can the read the man page of ps to understand. Option 'a' is part of bsd syntax and doesnt really need a '-' before the option...
# 5  
Old 08-11-2010
Quote:
Originally Posted by rajamadhavan
Nope...You can the read the man page of ps to understand. Option 'a' is part of bsd syntax and doesnt really need a '-' before the option...
Confused, I think i m far behind to actually understand what does your statement means. However i m trying my level best to grab the linux technology.Thanks for your reply.
# 6  
Old 08-11-2010
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...

Code:
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.

This User Gave Thanks to rajamadhavan For This Post:
# 7  
Old 08-11-2010
Quote:
Originally Posted by rajamadhavan
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...

Code:
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.

Thank you very much I have learned something new .

Previous Thread | Next Thread
Test Your Knowledge in Computers #345
Difficulty: Medium
Scott McNealy received $238 million USD when the Oracle acquisition closed.
True or False?

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

Top 5 cpu and Mem consuming process and files and suggestion for health check

I am middle of writing health check scripts, can you pls share commands on how I can get cpu and Mem of top consuming process info at the moment? Also can u suggest ideas on what all I can look for as a part do health check on red hat Linux server? I searched on site before posting, but... (2 Replies)
Discussion started by: Varja
2 Replies

2. UNIX for Dummies Questions & Answers

Finding the most memory consuming processes in Linux

Platform: Oracle Linux 6.4 To find the most memory consuming processes, I tried the following 2 methods 1. Method1 # ps aux | head -1 ; ps aux | sort -nk +4 | tail -7 USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND root 95 0.0 0.0 0 0 ? ... (2 Replies)
Discussion started by: kraljic
2 Replies

3. Shell Programming and Scripting

Unix shell script to query linux top consuming processes

Hi All, O/S: Linux 86x64 Red Hat I have a sql script that queries top consuming processes of Linux using TOP commnd. Now I need to automate this task and pass the top processes i.e., PID to the sql script through unix shell script. Could anyone please let me know how to achieve this. ... (2 Replies)
Discussion started by: a1_win
2 Replies

4. Shell Programming and Scripting

Discrepancy in finding the top memory consuming processes

When I run 'top' command,I see the following Memory: 32G real, 12G free, 96G swap free Though it shows as 12G free,I am not able to account for processes that consume the rest 20G. In my understanding some process should be consuming atleast 15-16 G but I am not able to find them. Is... (1 Reply)
Discussion started by: prasperl
1 Replies

5. Shell Programming and Scripting

Print 10 most CPU-intensive processes (wo/ top)

ps -eo pid,comm,%cpu lists all processes (in increasing PID number). How to get only the top-10 most CPU intensive ones? I know about top: this is BASH exercise. I tried redirecting above code to cut ps -eo pid,comm,%cpu | cut -f2but ps' output isn't TAB delimited. How can I otherwise use... (5 Replies)
Discussion started by: courteous
5 Replies

6. UNIX for Dummies Questions & Answers

How To Scroll Processes In top?

I'm using top to view processes. But, I do not know how to scroll down the list to view what is not showed in the terminal window. Anyone know how to do this? (1 Reply)
Discussion started by: keenansnews
1 Replies

7. AIX

Need a list of top 10 CPU using processes (also top 10 memory hogs, separately)

Okay, I am trying to come up with a multi-platform script to report top ten CPU and memory hog processes, which will be run by our enterprise monitoring application as an auto-action item when the CPU and Memory utilization gets reported as higher than a certain threshold I use top on other... (5 Replies)
Discussion started by: thenomad
5 Replies

8. AIX

Command to find TOP 5 Memory consuming process

HI All, Can anyone send me a command to find TOP 5 Memory consuming process. It would be lelpful if I get output something like below processname - pid - memory(in MB) - command I tried few commands from the internet but the result only give the real memory usage or pagging, I want total... (4 Replies)
Discussion started by: bce_groups
4 Replies

9. UNIX for Dummies Questions & Answers

how to get persistant cpu utilization values per process per cpu in linux (! top,ps)

hi, i want to know cpu utilizatiion per process per cpu..for single processor also if multicore in linux ..to use these values in shell script to kill processes exceeding cpu utilization.ps (pcpu) command does not give exact values..top does not give persistant values..psstat,vmstat..does njot... (3 Replies)
Discussion started by: pankajd
3 Replies

10. UNIX for Dummies Questions & Answers

How Can I Have Top Display The Top 20 Processes??

how can i do that in a script withough havin the script halt at the section where the top command is located. am writign a script that will send me the out put of unx commands if the load average of a machine goes beyond the recommended number. top -n 20 i want to save this output to a file... (1 Reply)
Discussion started by: TRUEST
1 Replies

Featured Tech Videos