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):
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).
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.
Supply: https://www.hongkiat.com/blog/linux-command-htop/
Contents
- 0.0.1 How you’ll be able to Arrange the htop Command
- 0.0.2 How you’ll be able to Use htop
- 0.0.2.1 1. Viewing Machine Processes and Property
- 0.0.2.2 2. Filtering Processes via Particular person
- 0.0.2.3 3. Sorting Processes via Memory Usage
- 0.0.2.4 4. Showing Best Processes with a Explicit String
- 0.0.2.5 5. Appearing Processes in Tree View
- 0.0.2.6 6. Showing Absolute Path of Command
- 0.0.2.7 Further Linux directions:
- 0.1 Related posts:
- 1 Learn how to Show Trustpilot Evaluations on Your WordPress Website
- 2 Why Customers Take part in On-line Communities [Data & Expert Insight]
- 3 Methods to Repair WooCommerce Product Seek Now not Operating
0 Comments