Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to install htop in Linux and how to use its commands

2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/01 Report--

This article mainly explains the "installation of htop in Linux and the use of its commands tutorial", the article explains the content is simple and clear, easy to learn and understand, the following please follow the editor's ideas slowly in-depth, together to study and learn "the installation of htop in Linux and the use of its commands tutorial" it!

1. Brief introduction to htop

Htop is a system monitoring and process management software running on Linux, which is used to replace the traditional top under Unix. Unlike top, which only provides a list of the most resource-consuming processes, htop provides a list of all processes and uses color to identify the processor, swap, and memory status.

Users can generally choose to install and use htop when top is unable to provide detailed system information. For example, when looking for memory leaks in an application. Compared with top, htop provides a more convenient, cursor-controlled interface to kill processes.

Htop is written in C language and uses ncurses library. The name of htop comes from the name of its author.

2. Htop installation

The code is as follows:

Yum-y install ncurses-devel # htop depends on ncurses

Wget http://superb-dca3.dl.sourceforge.net/project/htop/htop/1.0.2/htop-1.0.2.tar.gz

Tar xzf htop-1.0.2.tar.gz

Cd htop-1.0.2

. / configure

Make & & make install

3. Htop usage

After the installation is complete, directly tap the htop command on the command line to enter the interface of htop

The items from top to bottom are described as follows:

The left part is from top to bottom, respectively, the usage of cpu, memory and swap partition, and the right part is: Tasks is the total number of processes, currently running processes, Load average is the system 1 minute, 5 minutes, 10 minutes average load, Uptime is the system running time.

PID: identification number of the progress

USER: the user running this process

PRI: priority of the process

NI: the priority value of the process. The default is 0, which can be adjusted.

VIRT: virtual memory value consumed by the process

RES: the value of physical memory consumed by the process

SHR: the value of shared memory consumed by the process

S: the running state of the process. R means running, S means dormant, waiting for wake up, Z indicates dead state.

% CPU: CPU usage occupied by the process

% MEM: percentage of physical memory and total memory consumed by the process

TIME+: the total CPU time taken by the process after it was started

COMMAND: the name of the startup command that the process started

Here are the functions of F1~F10 and the corresponding letter shortcuts.

Shortcut KeyFunction KeyDescription Chinese description h,? F1Invoke htop Help View htop usage instructions SF2Htop Setup Menuhtop Settings / F3Search for a Process search process\ F4Incremental process filtering incremental process filter tF5Tree View display tree structure F6Sort by a column choose sorting method [F7Nice-(change priority) to reduce the nice value, so as to increase the priority of the corresponding process] F8Nice + (change priority) can increase the nice value In this way, the priority of the corresponding process can be reduced. KF9Kill a Process can send a signal to the process to qF10Quit htop the end htop.

Command line options (COMMAND-LINE OPTIONS)

-C-- no-color uses a monochrome color scheme-d-delay=DELAY to set delayed update time, unit second-h-help displays htop command help information-u-- user=USERNAME shows only the process of a given user-p-- pid=PID,PID... Show only the given PIDs-s-- sort-key COLUMN sorts by this column-v-version displays version information

Interactive commands (INTERACTIVE COMMANDS)

Arrow keys or PgUP, PgDn select the desired process, left and right keys or Home, End mobile field, of course, you can also directly use the mouse to select the process Space mark / unmark a process. The command can act on multiple processes, such as "kill", which will be applied to all marked processes U unmark all processes s select a process, press s: use strace to track the process's system call l to display the files opened by the process: if lsof is installed, press this key to display the files opened by the process I reverse the sort order, if the sort is positive, then reverse to the reverse order And vice versa +-in tree mode, expand or collapse subtree a (on machines with multiple processors) to set CPU affinity: mark which CPUu a process is allowed to use to display specific user processes M by Memory use sort P by CPU use sort T by Time+ use F track processes: if the sort order causes the selected process to move around on the list, let the selected bar follow that process. This is useful for monitoring a process: in this way, you can keep a process visible on the screen all the time. Using the arrow keys will stop the function K Show / hide kernel thread H Show / hide user thread Ctrl-L refresh NumbersPID lookup: enter PID and the cursor will move to the appropriate process

4. Replace top

Replace top with htop, add aliases, edit the / root/.bashrc file, and add the following code

The code is as follows:

Alias top=htop

Thank you for your reading, the above is the content of "the installation of htop in Linux and the use of its commands". After the study of this article, I believe you have a deeper understanding of the installation of htop in Linux and the use of its commands, and the specific use needs to be verified in practice. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report