Sponsored Content
Top Forums UNIX for Dummies Questions & Answers Limit process number in TOP command outupt Post 302738885 by vikram3.r on Monday 3rd of December 2012 04:57:15 AM
Old 12-03-2012
Limit process number in TOP command outupt

Linux top command prints more than 40 processes.
Code:
top -b -n 1 > Top_Output.txt

Is there a straight-forward option/way to limit only till the top 5 processes.

( Instead of using head, tail or other unix commands together)

Last edited by vbe; 12-03-2012 at 10:35 AM.. Reason: Do you mind using code tags!
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Xargs command outupt to file

Hello, I'm on a mac trying to have the follow cmd list the files after touch, but very unsuccessful. Please can you help. sort $BOTHFILE | uniq -u | xargs -I {} -t touch {} >> $LOGFILE ; BOTHFile contents in form of /directory/file.txt thanx (3 Replies)
Discussion started by: byblos
3 Replies

2. UNIX for Dummies Questions & Answers

Number of long limit

Hi Hi! I'm currently using AIX 5.2 and would like to know where can i find to see that there's a restriction on the number of login times a user can have. Example, I want give a 2 login per user but some one to give 3 login and some one have to give unlit login time (without logging off the... (2 Replies)
Discussion started by: herath
2 Replies

3. AIX

Process limit on OS level

Hi, Would like to know where do i find these process limit on OS level as my MQ is prompting this error... An attempt to create an MQ process was rejected by the operating system due to a process limit (2 Replies)
Discussion started by: giriplug
2 Replies

4. 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

5. AIX

Top command in AIX 4.2 (no topas, no nmon, no top)?

Is there a 'top' command equivalent in AIX 4.2 ? I already checked and I do not see the following ones anywhere: top nmon topas (1 Reply)
Discussion started by: Browser_ice
1 Replies

6. Ubuntu

smtpd process limit

I'm having a problem increasing the Postfix 2.5 smtpd process limit to 200. Here's what I have tried so far: 1) /etc/postfix/main.cf: default_process_limit = 2002) /etc/postfix/master.cf: smtp inet n - - - 200 smtpd3) /etc/postfix/master.cf: smtp ... (0 Replies)
Discussion started by: jonash
0 Replies

7. Shell Programming and Scripting

Using top command to email if process is exceeding 25% and sending an email alert if so

This is my first time writing a script and Im having some trouble, Im trying to use the top command to monitor processes and the amount of CPU usage they require, my aim is to get an email if a process takes over a certain percentage of CPU usage I tried grep Obviosly that hasnt worked, Any... (8 Replies)
Discussion started by: jay02
8 Replies

8. Red Hat

How to find memory taken by a process using top command?

I wanted to know how to find the memory taken by a process using top command. The output of the top command is as follows as an example: Mem: 13333364k total, 13238904k used, 94460k free, 623640k buffers Swap: 25165816k total, 112k used, 25165704k free, 4572904k cached PID USER ... (6 Replies)
Discussion started by: RHCE
6 Replies

9. UNIX for Dummies Questions & Answers

What does the 2nd number after the process id represent ? [ss command]

For instance, when I run ss -lptn | grep sshd , the output is as follows: LISTEN 0 128 *:22 *:* users:(("sshd",1252,3)) 1252 refers to the process id, but what does the 3 refer to ? (2 Replies)
Discussion started by: Hijanoqu
2 Replies

10. Shell Programming and Scripting

Limit on number of pipes after long-running command?

I'm trying to create a minimal, crude keylogger for X using only a shell script. I was quickly stumped: Why do these two commands entered in a terminal emulator produce output when I type... $ xinput test 6 | grep press $ xinput test 6 | awk '{print $3}' ...but this command produces no... (13 Replies)
Discussion started by: DevuanFan
13 Replies
top(1)							      General Commands Manual							    top(1)

NAME
top - display and update information about the top processes on the system SYNOPSIS
time] count] number] filename] pset_id] DESCRIPTION
displays the top processes on the system and periodically updates the information. Raw CPU percentage is used to rank the processes. Options recognizes the following command-line options: Set the delay between screen updates to time seconds. The default delay between updates is 5 seconds. Show only count displays, then exit. A display is considered to be one update of the screen. This option is used to select the number of displays to be shown before the program exits. This option runs the program at the same priority as if it is executed via a command so that it will execute faster (see nice(1)). This can be very useful in discovering any system problem when the system is very sluggish. This option is accessible only to users who have appropriate privileges. User ID (uid) numbers are displayed instead of usernames. This improves execution speed by eliminating the additional time required to map uid numbers to user names. Hides the individual CPU state information for systems having multiple processors. Only the average CPU status will be displayed. Show only number processes per screen. Note that, if number is greater than the maximum number of processes that can be displayed per screen, this option is ignored. But when used with option, there is no limit on the maximum number of processes that can be displayed. Output is appended to filename. When is used, defaults to 1 for and 16 for Show load averages and process state break down for system and processor set pset_id. Show only the processes running on the processor set pset_id. This option is supported only if the kernel supports processor sets functionality. Adds column PSET before column CPU for individual CPU information. Adds columns PSET before column CPU for each process informa- tion. This option is supported only if the kernel supports processor sets functionality. Show individual CPU information. By default, does not display any individual CPU information. The user can toggle between individual process information and individual CPU information by using the screen-control key. When used with the option, the option overrides the option. Screen-Control Commands When displaying multiple-screen data, recognizes the following keyboard screen-control commands: Display next screen if the current screen is not the last screen. Display previous screen if the current screen is not the first screen. Display the first (top) screen. Display individual CPU information in place of individual process information and vice versa. Program Termination To exit the program and resume normal user activities, type at any time. Display Description Three general classes of information are displayed by The first few lines at the top of the display show general information about the state of the system, including: o System name and current time. o Load averages in the last one, five, and fifteen minutes of all the active processors in the system. o Number of existing processes and the number of processes in each state (sleeping, waiting, running, starting, zombie, and stopped). o Percentage of time spent in each of the processor states (user, nice, system, idle, interrupt and swapper) per active processor on the system. o Average value for each of the active processor states (only on multi-processor systems). Reports virtual and real memory used by user processes (with the amount of memory considered "active" in parentheses) and the amount of free memory. Information about individual processes on the system. When process data cannot fit on a single screen, divides the data into two or more screens. To view multiple-screen data, use the and commands described previously. Note that the system- and memory-data displays are present in each screen of multiple- screen process data. Process data is displayed in a format similar to that used by Processor number on which the process is executing (only on multi-processor systems). Terminal interface used by the process. Process ID number. ID of the processor set to which the processor belongs. This is shown only when option is used. Name of the owner of the process. When the option is specified, the user ID (uid) is displayed instead of Current priority of the process. Nice value ranging from -20 to +20. Total virtual size of the process in kilobytes. This includes virtual sizes of text, data, stack, mmap regions, shared memory regions and IO mapped regions. This may also include virtual memory regions shared with other processes. Resident size of the process in kilobytes. It includes the sizes of all private regions in the process. The resident size information is, at best, an approximate value. Current state of the process. The various states are or Number of system and CPU seconds the process has consumed. Weighted CPU (central processing unit) percentage. Raw CPU percentage. This field is used to sort the top processes. Name of the command the process is currently running. EXAMPLES
can be executed with or without command-line options. To display five screens of data at two-second intervals then automatically exit, use: To display information about pset 2, use: To display individual CPU information in place of individual process information, use: and press the key. AUTHOR
was developed by HP and William LeFebvre of Rice University. top(1)
All times are GMT -4. The time now is 12:00 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy