Путеводитель по Руководству Linux

  User  |  Syst  |  Libr  |  Device  |  Files  |  Other  |  Admin  |  Head  |



   top    ( 1 )

отображать процессы Linux (display Linux processes)

Обзор (Overview)

Documentation
       The remaining Table of Contents

OVERVIEW Operation Linux Memory Types 1. COMMAND-LINE Options 2. SUMMARY Display a. UPTIME and LOAD Averages b. TASK and CPU States c. MEMORY Usage 3. FIELDS / Columns Display a. DESCRIPTIONS of Fields b. MANAGING Fields 4. INTERACTIVE Commands a. GLOBAL Commands b. SUMMARY AREA Commands c. TASK AREA Commands 1. Appearance 2. Content 3. Size 4. Sorting d. COLOR Mapping 5. ALTERNATE-DISPLAY Provisions a. WINDOWS Overview b. COMMANDS for Windows c. SCROLLING a Window d. SEARCHING in a Window e. FILTERING in a Window 6. FILES a. PERSONAL Configuration File b. ADDING INSPECT Entries c. SYSTEM Configuration File d. SYSTEM Restrictions File 7. STUPID TRICKS Sampler a. Kernel Magic b. Bouncing Windows c. The Big Bird Window d. The Ol' Switcheroo 8. BUGS, 9. SEE Also

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

When started for the first time, you'll be presented with these traditional elements on the main top screen: 1) Summary Area; 2) Fields/Columns Header; 3) Task Area. Each of these will be explored in the sections that follow. There is also an Input/Message line between the Summary Area and Columns Header which needs no further explanation.

The main top screen is generally quite adaptive to changes in terminal dimensions under X-Windows. Other top screens may be less so, especially those with static text. It ultimately depends, however, on your particular window manager and terminal emulator. There may be occasions when their view of terminal size and current contents differs from top's view, which is always based on operating system calls.

Following any re-size operation, if a top screen is corrupted, appears incomplete or disordered, simply typing something innocuous like a punctuation character or cursor motion key will usually restore it. In extreme cases, the following sequence almost certainly will: key/cmd objective ^Z suspend top fg resume top <Left> force a screen redraw (if necessary)

But if the display is still corrupted, there is one more step you could try. Insert this command after top has been suspended but before resuming it. key/cmd objective reset restore your terminal settings

Note: the width of top's display will be limited to 512 positions. Displaying all fields requires approximately 250 characters. Remaining screen width is usually allocated to any variable width columns currently visible. The variable width columns, such as COMMAND, are noted in topic 3a. DESCRIPTIONS of Fields. Actual output width may also be influenced by the -w switch, which is discussed in topic 1. COMMAND-LINE Options.

Lastly, some of top's screens or functions require the use of cursor motion keys like the standard arrow keys plus the Home, End, PgUp and PgDn keys. If your terminal or emulator does not provide those keys, the following combinations are accepted as alternatives: key equivalent-keys Left alt + h Down alt + j Up alt + k Right alt + l Home alt + ctrl + h PgDn alt + ctrl + j PgUp alt + ctrl + k End alt + ctrl + l

The Up and Down arrow keys have special significance when prompted for line input terminated with the <Enter> key. Those keys, or their aliases, can be used to retrieve previous input lines which can then be edited and re-input. And there are four additional keys available with line oriented input. key special-significance Up recall older strings for re-editing Down recall newer strings or erase entire line Insert toggle between insert and overtype modes Delete character removed at cursor, moving others left Home jump to beginning of input line End jump to end of input line

Linux Memory Types For our purposes there are three types of memory, and one is optional. First is physical memory, a limited resource where code and data must reside when executed or referenced. Next is the optional swap file, where modified (dirty) memory can be saved and later retrieved if too many demands are made on physical memory. Lastly we have virtual memory, a nearly unlimited resource serving the following goals:

1. abstraction, free from physical memory addresses/limits 2. isolation, every process in a separate address space 3. sharing, a single mapping can serve multiple needs 4. flexibility, assign a virtual address to a file

Regardless of which of these forms memory may take, all are managed as pages (typically 4096 bytes) but expressed by default in top as KiB (kibibyte). The memory discussed under topic `2c. MEMORY Usage' deals with physical memory and the swap file for the system as a whole. The memory reviewed in topic `3. FIELDS / Columns Display' embraces all three memory types, but for individual processes.

For each such process, every memory page is restricted to a single quadrant from the table below. Both physical memory and virtual memory can include any of the four, while the swap file only includes #1 through #3. The memory in quadrant #4, when modified, acts as its own dedicated swap file.

Private | Shared 1 | 2 Anonymous . stack | . malloc() | . brk()/sbrk() | . POSIX shm* . mmap(PRIVATE, ANON) | . mmap(SHARED, ANON) -----------------------+---------------------- . mmap(PRIVATE, fd) | . mmap(SHARED, fd) File-backed . pgms/shared libs | 3 | 4

The following may help in interpreting process level memory values displayed as scalable columns and discussed under topic `3a. DESCRIPTIONS of Fields'.

%MEM - simply RES divided by total physical memory CODE - the `pgms' portion of quadrant 3 DATA - the entire quadrant 1 portion of VIRT plus all explicit mmap file-backed pages of quadrant 3 RES - anything occupying physical memory which, beginning with Linux-4.5, is the sum of the following three fields: RSan - quadrant 1 pages, which include any former quadrant 3 pages if modified RSfd - quadrant 3 and quadrant 4 pages RSsh - quadrant 2 pages RSlk - subset of RES which cannot be swapped out (any quadrant) SHR - subset of RES (excludes 1, includes all 2 & 4, some 3) SWAP - potentially any quadrant except 4 USED - simply the sum of RES and SWAP VIRT - everything in-use and/or reserved (all quadrants)

Note: Even though program images and shared libraries are considered private to a process, they will be accounted for as shared (SHR) by the kernel.