Skip to content
geeksforgeeks
  • Courses
    • DSA to Development
    • Get IBM Certification
    • Newly Launched!
      • Master Django Framework
      • Become AWS Certified
    • For Working Professionals
      • Interview 101: DSA & System Design
      • Data Science Training Program
      • JAVA Backend Development (Live)
      • DevOps Engineering (LIVE)
      • Data Structures & Algorithms in Python
    • For Students
      • Placement Preparation Course
      • Data Science (Live)
      • Data Structure & Algorithm-Self Paced (C++/JAVA)
      • Master Competitive Programming (Live)
      • Full Stack Development with React & Node JS (Live)
    • Full Stack Development
    • Data Science Program
    • All Courses
  • Tutorials
    • Data Structures & Algorithms
    • ML & Data Science
    • Interview Corner
    • Programming Languages
    • Web Development
    • CS Subjects
    • DevOps And Linux
    • School Learning
  • Practice
    • Build your AI Agent
    • GfG 160
    • Problem of the Day
    • Practice Coding Problems
    • GfG SDE Sheet
  • Contests
    • Accenture Hackathon (Ending Soon!)
    • GfG Weekly [Rated Contest]
    • Job-A-Thon Hiring Challenge
    • All Contests and Events
  • Shell Scripting
  • Kali Linux
  • Ubuntu
  • Red Hat
  • CentOS
  • Docker in Linux
  • Kubernetes in Linux
  • Linux interview question
  • Python
  • R
  • Java
  • C
  • C++
  • JavaScript
  • DSA
Open In App
Next Article:
id command in Linux with examples
Next article icon

htop command in Linux with examples

Last Updated : 06 Oct, 2024
Comments
Improve
Suggest changes
Like Article
Like
Report

htop command in Linux system is a command line utility that allows the user to interactively monitor the system’s vital resources or server’s processes in real-time. htop is a newer program compared to top command, and it offers many improvements over top command. htop supports mouse operation, uses color in its output, and gives visual indications about processor, memory, and swap usage. htop also prints full command lines for processes and allows one to scroll both vertically and horizontally for processes and command lines respectively.

Syntax

htop 

This will open an interactive interface showing all running processes, along with CPU, memory, and swap usage. You can also specify options when launching htop.

Basic Example:

Common Options used with htop command

Here are some of the most commonly used options with htop:

Option

Description

-d <delay>

sets the delay between updates (delay of some sec)

-u <user>

displays only the process which owned by the user

-p <pid>

shows only process with specific ids.

-s <column>

sorts the process of the given column

-t

displays the process hierarchy in tree view in the commands column

–no-color

Runs htop in monochrome mode, disabling color

htop command Examples in Linux

1. htop -d <delay>:

htop -d 10 means shows delay between screen updates in 1 second. If you give delay as 15 means delay of 1.5 sec, similarly 23 means 2.3 sec etc. This delay is useful as it reduce frequent updates.

htop -d  <delay>” width=”755″ height=”190″ srcset=”https://media.geeksforgeeks.org/wp-content/uploads/20240929102355/Screenshot-2024-09-29-102333.png 755w,https://media.geeksforgeeks.org/wp-content/uploads/20240929102355/Screenshot-2024-09-29-102333-100.png 100w,https://media.geeksforgeeks.org/wp-content/uploads/20240929102355/Screenshot-2024-09-29-102333-200.png 200w,https://media.geeksforgeeks.org/wp-content/uploads/20240929102355/Screenshot-2024-09-29-102333-300.png 300w,https://media.geeksforgeeks.org/wp-content/uploads/20240929102355/Screenshot-2024-09-29-102333-660.png 660w” loading=”lazy”><figcaption>Before adding delay</figcaption></figure> <div style=After adding delay of 30

After adding delay of 30

2. htop -u <username>:

Used to show only the processes of a given user. Here it is:

htop -u kunwarvikas

htop -u <username>” width=”inherit” height=”inherit” loading=”lazy”></p> <h3><b><strong>3. htop -p <pid>:</strong></b><span> </span></h3> <p dir=Used to show only the given PIDs.

htop -p <pid>” width=”763″ height=”102″ srcset=”https://media.geeksforgeeks.org/wp-content/uploads/20240929103358/Screenshot-2024-09-29-103249.png 763w,https://media.geeksforgeeks.org/wp-content/uploads/20240929103358/Screenshot-2024-09-29-103249-100.png 100w,https://media.geeksforgeeks.org/wp-content/uploads/20240929103358/Screenshot-2024-09-29-103249-200.png 200w,https://media.geeksforgeeks.org/wp-content/uploads/20240929103358/Screenshot-2024-09-29-103249-300.png 300w,https://media.geeksforgeeks.org/wp-content/uploads/20240929103358/Screenshot-2024-09-29-103249-660.png 660w” loading=”lazy”><figcaption>htop  -p 369</figcaption></figure> <h3><span>4. htop -s <column>: </span></h3> <p dir=Sorts the given column.
htop -s <column>” width=”733″ height=”344″ srcset=”https://media.geeksforgeeks.org/wp-content/uploads/20240929103822/Screenshot-2024-09-29-103759.png 733w,https://media.geeksforgeeks.org/wp-content/uploads/20240929103822/Screenshot-2024-09-29-103759-100.png 100w,https://media.geeksforgeeks.org/wp-content/uploads/20240929103822/Screenshot-2024-09-29-103759-200.png 200w,https://media.geeksforgeeks.org/wp-content/uploads/20240929103822/Screenshot-2024-09-29-103759-300.png 300w,https://media.geeksforgeeks.org/wp-content/uploads/20240929103822/Screenshot-2024-09-29-103759-660.png 660w” loading=”lazy”><figcaption>htop -s PRIORITY</figcaption></figure> <h3><span>5. htop -t: </span></h3> <p dir=Displays the process hierarchy in tree view in the commands column. htop -t

6. htop -no-color:

Disables color.

htop -no-color

7. -v –version:

Output version information and exit. -v --version

Interactive Commands

  • Arrows, Page Up, Page Down, Home, End: Scroll the process list.
  • Space: Tag or untag a process.
  • U – Untag all processes (remove all tags added with the Space key).
  • s – Trace process system calls.
  • F1 – Help
  • F2 – setup
  • F3 – search
  • F4 – filtering: type in part of a process command line and only processes whose names match will be shown.
  • F5 – Tree view.
  • F6 – Sorting.
  • F7 – Increase the selected process’s priority. This can only be done by the superuser.
  • F8 – Decrease the selected process’s priority.
  • F9 – Kill process.
  • F10 – Quit.

Conclusion

The htop command is a powerful tool for monitoring and managing system processes in real-time. With its interactive interface and advanced features like sorting and filtering, it will be beneficial for system administrators and users who want a detailed view of system performance.



Next Article
id command in Linux with examples

K

KV30
Improve
Article Tags :
  • Linux-Unix
  • linux-command
  • Linux-system-commands

Similar Reads

  • halt command in Linux with examples
    This command in Linux is used to instruct the hardware to stop all the CPU functions. Basically, it reboots or stops the system. If the system is in runlevel 0 or 6 or using the command with --force option, it results in rebooting of the system otherwise it results in shutdown. Syntax: halt [OPTION]
    2 min read
  • hash command in Linux with examples
    The `hash` is a command in Linux that helps in managing the hash table. It facilitates with mapping the names of executable files to their locations on disk. It helps in speeds uping the commands execution by remembering paths of frequently used commands. It uses the `hash` to view hashed commands (
    5 min read
  • hdparm command in Linux with Examples
    "hdparm" (i.e., hard disk parameter) is one of the command line programs for Linux that is used to handle disk devices and hard disks. With the help of this command, you can get statistics about the hard disk, alter writing intervals, acoustic management, and DMA settings. It can also set parameters
    4 min read
  • Head Command in Linux With Examples
    Need to quickly view the beginning of a file in Linux? The head command is your best option. This essential command-line tool enables users, developers, and system administrators to preview the start of log files, configuration files, CSV datasets, and other text documents in seconds. The head comma
    6 min read
  • help Command in Linux with examples
    If you’re new to the Linux operating system and struggling with command-line utilities, the help command is one of the first tools you should learn. As its name suggests, the 'help' command provides detailed information about built-in shell commands, making it an essential resource for beginners and
    5 min read
  • hexdump command in Linux with examples
    The 'hexdump' command in Linux is a versatile utility used to display file content or data from standard input in a human-readable format. It is invaluable for programmers and system administrators for debugging binary data, analyzing file structures, and verifying data integrity. Here we will get a
    6 min read
  • How to Display Command History in Linux | history Command
    The history command in Linux is essential for terminal users, enabling them to view, search, and manipulate previously executed commands. Now, mastering this Linux command allows for efficient commands of commands, automation of repetitive tasks, and troubleshooting without the need to retype length
    4 min read
  • host command in Linux with examples
    host command in Linux system is used for DNS (Domain Name System) lookup operations. In simple words, this command is used to find the IP address of a particular domain name or if you want to find out the domain name of a particular IP address the host command becomes handy. You can also find more s
    2 min read
  • hostid command in Linux with examples
    hostid is a command in Linux that is used to display the Host's ID in hexadecimal format. It provides a quick and straightforward way to retrieve the host ID, allowing administrators to associate it with software licenses or perform system-specific operations. Syntax of `hostid` command in Linuxhost
    1 min read
  • hostname command in Linux with examples
    hostname command in Linux is used to obtain the DNS (Domain Name System) name and set the system's hostname or NIS (Network Information System) domain name. A hostname is a name given to a computer and attached to the network. Its main purpose is to uniquely identify over a network.  Syntax of the `
    6 min read
geeksforgeeks-footer-logo
Corporate & Communications Address:
A-143, 7th Floor, Sovereign Corporate Tower, Sector- 136, Noida, Uttar Pradesh (201305)
Registered Address:
K 061, Tower K, Gulshan Vivante Apartment, Sector 137, Noida, Gautam Buddh Nagar, Uttar Pradesh, 201305
GFG App on Play Store GFG App on App Store
Advertise with us
  • Company
  • About Us
  • Legal
  • Privacy Policy
  • In Media
  • Contact Us
  • Advertise with us
  • GFG Corporate Solution
  • Placement Training Program
  • Languages
  • Python
  • Java
  • C++
  • PHP
  • GoLang
  • SQL
  • R Language
  • Android Tutorial
  • Tutorials Archive
  • DSA
  • Data Structures
  • Algorithms
  • DSA for Beginners
  • Basic DSA Problems
  • DSA Roadmap
  • Top 100 DSA Interview Problems
  • DSA Roadmap by Sandeep Jain
  • All Cheat Sheets
  • Data Science & ML
  • Data Science With Python
  • Data Science For Beginner
  • Machine Learning
  • ML Maths
  • Data Visualisation
  • Pandas
  • NumPy
  • NLP
  • Deep Learning
  • Web Technologies
  • HTML
  • CSS
  • JavaScript
  • TypeScript
  • ReactJS
  • NextJS
  • Bootstrap
  • Web Design
  • Python Tutorial
  • Python Programming Examples
  • Python Projects
  • Python Tkinter
  • Python Web Scraping
  • OpenCV Tutorial
  • Python Interview Question
  • Django
  • Computer Science
  • Operating Systems
  • Computer Network
  • Database Management System
  • Software Engineering
  • Digital Logic Design
  • Engineering Maths
  • Software Development
  • Software Testing
  • DevOps
  • Git
  • Linux
  • AWS
  • Docker
  • Kubernetes
  • Azure
  • GCP
  • DevOps Roadmap
  • System Design
  • High Level Design
  • Low Level Design
  • UML Diagrams
  • Interview Guide
  • Design Patterns
  • OOAD
  • System Design Bootcamp
  • Interview Questions
  • Inteview Preparation
  • Competitive Programming
  • Top DS or Algo for CP
  • Company-Wise Recruitment Process
  • Company-Wise Preparation
  • Aptitude Preparation
  • Puzzles
  • School Subjects
  • Mathematics
  • Physics
  • Chemistry
  • Biology
  • Social Science
  • English Grammar
  • Commerce
  • World GK
  • GeeksforGeeks Videos
  • DSA
  • Python
  • Java
  • C++
  • Web Development
  • Data Science
  • CS Subjects
@GeeksforGeeks, Sanchhaya Education Private Limited, All rights reserved
We use cookies to ensure you have the best browsing experience on our website. By using our site, you acknowledge that you have read and understood our Cookie Policy & Privacy Policy
Lightbox
Improvement
Suggest Changes
Help us improve. Share your suggestions to enhance the article. Contribute your expertise and make a difference in the GeeksforGeeks portal.
geeksforgeeks-suggest-icon
Create Improvement
Enhance the article with your expertise. Contribute to the GeeksforGeeks community and help create better learning resources for all.
geeksforgeeks-improvement-icon
Suggest Changes
min 4 words, max Words Limit:1000

Thank You!

Your suggestions are valuable to us.

What kind of Experience do you want to share?

Interview Experiences
Admission Experiences
Career Journeys
Work Experiences
Campus Experiences
Competitive Exam Experiences