The htop command, an acronym for Hisham’s most sensible, is a formidable device that gives a dynamic real-time view of a operating machine. In contrast to the normal most sensible command, htop gives a extra interactive and user-friendly interface, showing an entire evaluate of all processes, CPU utilization, reminiscence, and different crucial machine statistics.

It’s specifically at hand for individuals who wish to track machine efficiency, set up processes, or troubleshoot problems. Very similar to the most sensible command, htop can be utilized along different instructions like playstation and vmstat to achieve a complete figuring out of machine habits.

How you can Set up the htop Command

htop is continuously now not incorporated through default in lots of Linux distributions, so you could wish to set up it. Right here’s how you’ll be able to set up and uninstall htop on some not unusual Linux distributions:

For Debian-based programs (like Ubuntu):

To put in htop, open a terminal and run:

sudo apt-get replace
sudo apt-get set up htop

To uninstall htop, you’ll be able to use:

sudo apt-get take away htop

For Purple Hat-based programs (like Fedora):

To put in htop, use:

sudo dnf set up htop

To uninstall, use:

sudo dnf take away htop

For SUSE-based programs:

To put in htop, use:

sudo zypper set up htop

To uninstall, use:

sudo zypper take away htop

For Arch Linux:

To put in htop, use:

sudo pacman -S htop

To uninstall, use:

sudo pacman -R htop

How you can Use htop

1. Viewing Gadget Processes and Assets

Syntax: htop

Clarification: Shows an interactive evaluate of machine processes and useful resource utilization.

Instance: htop

Output:

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

This output displays the CPU utilization on two cores, reminiscence utilization, switch utilization, collection of duties, load averages, and machine uptime. The bars supply a visible illustration of the useful resource intake.

2. Filtering Processes through Person

Syntax: htop -u USERNAME

Clarification: Shows handiest the processes owned through a particular consumer.

Instance: 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 displays the processes owned through the consumer john, together with main points like PID, precedence, digital reminiscence, resident reminiscence, shared reminiscence, CPU, and reminiscence proportion.

3. Sorting Processes through Reminiscence Utilization

Syntax: htop -s PERCENT_MEM

Clarification: Shows processes looked after through reminiscence utilization.

Instance: 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 displays the processes looked after through reminiscence utilization, with the method eating probably the most reminiscence on the most sensible. It contains main points like PID, consumer, precedence, digital and resident reminiscence, CPU, and reminiscence proportion.

4. Appearing Most effective Processes with a Particular String

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

Clarification: Shows handiest the processes with the desired Procedure IDs (PIDs).

Instance: 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 displays handiest the processes with the desired PIDs, 1234 and 5678, along side main points like consumer, precedence, reminiscence utilization, CPU, and reminiscence proportion.

5. Showing Processes in Tree View

Syntax: htop -t

Clarification: Shows processes in a tree view, appearing parent-child relationships.

Instance: htop -t

Output:

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

This output displays the processes in a tree view, illustrating how processes are similar to one another. The dad or mum procedure is indexed first, with little one processes indented underneath it.

6. Appearing Absolute Trail of Command

Syntax: htop -c

Clarification: Shows absolutely the trail of the command being run for each and every procedure.

Instance: 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 /decide/customized/heavyapp

This output displays the overall absolute trail of the command being run for each and every procedure, offering extra detailed details about the positioning of the executable information.

Extra Linux instructions:
Listing Operations rmdir · cd · pwd
Report Operations cat · cp · dd · much less · ls · mkdir · mv · tail · tar · zip
Report Gadget Operations chown · mkfs
Networking ping · curl · wget · iptables
Seek and Textual content Processing to find · grep · sed · whatis
Gadget Data and Control env · historical past · most sensible · who
Person and Consultation Control display · su · sudo

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

WordPress Website Development Source: https://www.hongkiat.com/blog/linux-command-htop/

[ continue ]