[리눅스] top 사용법과 메뉴얼

Posted 2011.07.28 21:50

top에는 여러 option이 있지만 그중에서 우리는 다음과 같은 option을 사용한다. 

# top -b -i -H -n 20 >> test_proc

여기서 b는 batch를 뜻하고, i는 idle, H는 thread를 포함시키는 것을 뜻한다. 






NAME
       top - display Linux tasks

SYNOPSIS
       top -hv | -bcHisS -d delay -n iterations -p pid [, pid ...]
       The traditional switches ’-’ and whitespace are optional.

DESCRIPTION
The  top program provides a dynamic real-time view of a running system.  It can display system summary information as well as a list of tasks currently being managed by the Linux kernel.  The types of system summary information shown and the types, order and size of information displayed for tasks are all  user  configurable  and that configuration can be made persistent across restarts.

The program provides a limited interactive interface for process manipulation as well as a much more extensive interface for personal configuration  --  encompassing every aspect of its operation.  And while top is referred to throughout this document, you are free to name the program anything you wish.  That new  name,  possibly an alias, will then be reflected on top’s display and used when reading and writing a configuration file.

OVERVIEW
   Documentation
       The remaining Table of Contents
           1. COMMAND-LINE Options
           2. FIELDS / Columns
              a. DESCRIPTIONS of Fields
              b. SELECTING and ORDERING Columns
           3. INTERACTIVE Commands
              a. GLOBAL Commands
              b. SUMMARY Area Commands
              c. TASK Area Commands
              d. COLOR Mapping
           4. ALTERNATE-DISPLAY Mode
              a. WINDOWS Overview
              b. COMMANDS for Windows
           5. FILES
              a. SYSTEM Configuration File
              b. PERSONAL Configuration File
           6. STUPID TRICKS Sampler
              a. Kernel Magic
              b. Bouncing Windows
              c. The Big Bird Window
           7. BUGS, 8. HISTORY Former top, 9. AUTHOR, 10. SEE ALSO

Operation
When  operating  top, the two most important keys are help (’h’ or ’?’) and quit (’q’) key.  Alternatively, you could simply use the traditional interrupt key (’^C’) when you’re done.

When you start top for the first time, you’ll be presented with the traditional screen elements: 1) Summary Area; 2) Message/Prompt Line; 3) Columns Header; 4)  Task Area.  There will, however, be some differences when compared to the former top.

Highlighting
Summary_Area: There is no highlighting for load/uptime and only values are highlighted for other elements.

Task_Area: Tasks running (or ready to run) will be highlighted, and bold is only one way of emphasizing such processes.

Content/Labels
Summary_Area: The program name is shown, perhaps a symlink or alias.  The Cpu(s) state label hints at other possibilities.  The memory stats use a lower case ’k’.

Columns_Header: Will show a new field and some changed labels.  More new fields will be found as you customize your top.

Note: the width of top’s display will be limited to 512 positions.  Displaying all fields requires a minimum of 160 characters.  The remaining width  could  be  used for the ’Command’ column.

   Startup Defaults
The  following  startup  defaults assume no configuration file, thus no user customizations.  Even so, items shown with an asterisk (’*’) could be overridden through the command-line.

           Global_defaults
              ’A’ - Alt display      Off (full-screen)
            * ’d’ - Delay time       3.0 seconds
              ’I’ - Irix mode        On  (no, ’solaris’ smp)
            * ’p’ - PID monitoring   Off
            * ’s’ - Secure mode      Off (unsecured)
              ’B’ - Bold enable      Off
           Summary_Area_defaults
              ’l’ - Load Avg/Uptime  On  (thus program name)
              ’t’ - Task/Cpu states  On  (1+1 lines, see ’1’)
              ’m’ - Mem/Swap usage   On  (2 lines worth)
              ’1’ - Single Cpu       On  (thus 1 line if smp)
           Task_Area_defaults
              ’b’ - Bold hilite      On  (not ’reverse’)
            * ’c’ - Command line     Off (name, not cmdline)
            * ’H’ - Threads          Off (show all threads)
            * ’i’ - Idle tasks       On  (show all tasks)
              ’R’ - Reverse sort     On  (pids high-to-low)
            * ’S’ - Cumulative time  Off (no, dead children)
              ’x’ - Column hilite    Off (no, sort field)
              ’y’ - Row hilite       On  (yes, running tasks)
              ’z’ - color/mono       Off (no, colors)

1. COMMAND-LINE Options
       The command-line syntax for top consists of:

            -hv | -bcHisS -d delay -n iterations -p pid [,pid...]

       The typically mandatory switches (’-’) and even whitespace are completely optional.

-b : Batch mode operation
Starts top in ’Batch mode’, which could be useful for sending output from top to other programs or to a file.  In this mode, top will not accept input and  runs until the iterations limit you’ve set with the ’-n’ command-line option or until killed.

-c : Command line/Program name toggle
Starts top with the last remembered ’c’ state reversed.  Thus, if top was displaying command lines, now that field will show program names, and visa versa.  See the ’c’ interactive command for additional information.

-d : Delay time interval as:  -d ss.tt (seconds.tenths)
Specifies the delay between screen updates, and overrides the corresponding value in one’s personal configuration file or the startup default.  Later  this  can be changed with the ’d’ or ’s’ interactive commands. 
Fractional  seconds  are  honored, but a negative number is not allowed.  In all cases, however, such changes are prohibited if top is running in ’Secure mode’, except for root (unless the ’s’ command-line option was Fused).  For additional information on ’Secure mode’ see topic 5a. SYSTEM Configuration File.

-h : Help
Show library version and the usage prompt, then quit.

-H : Threads toggle
Starts top with the last remembered ’H’ state reversed.  When this toggle is On, all individual threads will be displayed.  Otherwise, top displays a  summation of all threads in a process.

-i : Idle Processes toggle
Starts top with the last remembered ’i’ state reversed.  When this toggle is Off, tasks that are idled or zombied will not be displayed.

-n : Number of iterations limit as:  -n number
Specifies the maximum number of iterations, or frames, top should produce before ending.

-u : Monitor by user as:  -u somebody
Monitor only processes with an effective UID or user name matching that given.

-U : Monitor by user as:  -U somebody
Monitor only processes with a UID or user name matching that given.  This matches real, effective, saved, and filesystem UIDs.

-p : Monitor PIDs as:  -pN1 -pN2 ...  or  -pN1, N2 [,...]
Monitor  only processes with specified process IDs.  This option can be given up to 20 times, or you can provide a comma delimited list with up to 20 pids.  Co- mingling both approaches is permitted. 

신고
« PREV : 1 : ··· : 499 : 500 : 501 : 502 : 503 : 504 : 505 : 506 : 507 : ··· : 581 : NEXT »