How you can Use the ‘htop’ Command in Linux

by | Sep 20, 2023 | Etcetera | 0 comments

The htop command, an acronym for Hisham’s best, is an impressive instrument that provides a dynamic real-time view of a working system. By contrast to the standard best command, htop provides a additional interactive and user-friendly interface, appearing a whole assessment of all processes, CPU usage, memory, and other a very powerful system statistics.

It’s particularly to hand for those who want to observe system potency, arrange processes, or troubleshoot issues. Similar to the most sensible command, htop can be used alongside other directions like ps and vmstat to succeed in a whole understanding of system behavior.

How you’ll be able to Arrange the htop Command

htop is steadily no longer integrated via default in numerous Linux distributions, so you need to want to arrange it. Proper right here’s the way you’ll be capable of arrange and uninstall htop on some no longer odd Linux distributions:

For Debian-based systems (like Ubuntu):

To place in htop, open a terminal and run:

sudo apt-get exchange
sudo apt-get arrange htop

To uninstall htop, you’ll be capable of use:

sudo apt-get remove htop

For Crimson Hat-based systems (like Fedora):

See also  How you can Make a WordPress Database Backup Manually (Step by way of Step)

To place in htop, use:

sudo dnf arrange htop

To uninstall, use:

sudo dnf remove htop

For SUSE-based systems:

To place in htop, use:

sudo zypper arrange htop

To uninstall, use:

sudo zypper remove htop

For Arch Linux:

To place in htop, use:

sudo pacman -S htop

To uninstall, use:

sudo pacman -R htop

How you’ll be able to Use htop

1. Viewing Machine Processes and Property

Syntax: htop

Rationalization: Displays an interactive assessment of system processes and helpful useful resource usage.

Example: htop

Output:

1  [|||||||                    16.7%]     Tasks: 34, 60 thr; 2 working
2  [||||||||                   20.0%]     Load reasonable: 0.07 0.02 0.00 
Mem[|||||||||||||||       512M/1000M]     Uptime: 02:23:45
Swp[|||                      50M/100M]

This output presentations the CPU usage on two cores, memory usage, transfer usage, number of tasks, load averages, and system uptime. The bars provide a visual representation of the helpful useful resource consumption.

2. Filtering Processes via Particular person

Syntax: htop -u USERNAME

Rationalization: Displays only the processes owned via a specific shopper.

Example: htop -u john

Output:

PID USER      PRI  NI  VIRT   RES   SHR S CPU% MEM%   TIME+  Command
1234 john       20   0 1024M  100M 9000 S  5.0 10.0  0:00.91 /usr/bin/app

This output presentations the processes owned throughout the shopper john, along with details like PID, priority, virtual memory, resident memory, shared memory, CPU, and memory share.

3. Sorting Processes via Memory Usage

Syntax: htop -s PERCENT_MEM

Rationalization: Displays processes sorted via memory usage.

Example: htop -s PERCENT_MEM

Output:

PID USER      PRI  NI  VIRT   RES   SHR S CPU% MEM%   TIME+  Command
5678 alice      20   0 2048M  200M 9000 S 10.0 20.0  0:01.23 /usr/bin/heavyapp
1234 john       20   0 1024M  100M 9000 S  5.0 10.0  0:00.91 /usr/bin/app

This output presentations the processes sorted via memory usage, with the process consuming one of the crucial memory at the best. It comprises details like PID, shopper, priority, virtual and resident memory, CPU, and memory share.

4. Showing Best Processes with a Explicit String

Syntax: htop -p PID[,PID...]

Rationalization: Displays only the processes with the specified Process IDs (PIDs).

See also  Introducing the Reimagined WP Charitable: Fundraising Has Were given More straightforward Than Ever

Example: htop -p 1234,5678

Output:

PID USER      PRI  NI  VIRT   RES   SHR S CPU% MEM%   TIME+  Command
1234 john       20   0 1024M  100M 9000 S  5.0 10.0  0:00.91 /usr/bin/app
5678 alice      20   0 2048M  200M 9000 S 10.0 20.0  0:01.23 /usr/bin/heavyapp

This output presentations only the processes with the specified PIDs, 1234 and 5678, in conjunction with details like shopper, priority, memory usage, CPU, and memory share.

5. Appearing Processes in Tree View

Syntax: htop -t

Rationalization: Displays processes in a tree view, showing parent-child relationships.

Example: htop -t

Output:

PID USER      Command
1   root      /sbin/init
 `-1234 john   _ /usr/bin/app
    `-5678 alice  _ /usr/bin/heavyapp

This output presentations the processes in a tree view, illustrating how processes are very similar to one some other. The guardian process is listed first, with infant processes indented beneath it.

6. Showing Absolute Path of Command

Syntax: htop -c

Rationalization: Displays completely the path of the command being run for every process.

Example: htop -c

Output:

PID USER      PRI  NI  VIRT   RES   SHR S CPU% MEM%   TIME+  Command
1234 john       20   0 1024M  100M 9000 S  5.0 10.0  0:00.91 /usr/bin/app
5678 alice      20   0 2048M  200M 9000 S 10.0 20.0  0:01.23 /come to a decision/custom designed/heavyapp

This output presentations the total absolute path of the command being run for every process, providing additional detailed information about the site of the executable knowledge.

Further Linux directions:
List Operations rmdir · cd · pwd
File Operations cat · cp · dd · much less · ls · mkdir · mv · tail · tar · zip
File Machine Operations chown · mkfs
Networking ping · curl · wget · iptables
Search and Text Processing to find · grep · sed · whatis
Machine Information and Regulate env · historical past · most sensible · who
Particular person and Session Regulate display · su · sudo

The submit How you can Use the ‘htop’ Command in Linux appeared first on Hongkiat.

See also  9 Very best Heatmap Gear and Plugins for Your WordPress Web page

WordPress Website Development

Supply: https://www.hongkiat.com/blog/linux-command-htop/

[ continue ]

WordPress Maintenance Plans | WordPress Hosting

read more

0 Comments

Submit a Comment

DON'T LET YOUR WEBSITE GET DESTROYED BY HACKERS!

Get your FREE copy of our Cyber Security for WordPress® whitepaper.

You'll also get exclusive access to discounts that are only found at the bottom of our WP CyberSec whitepaper.

You have Successfully Subscribed!