Methods to Use the ‘glances’ Command in Linux

by | Sep 27, 2023 | Etcetera | 0 comments

The glances command in Linux provides a whole analysis of software potency. Appearing as a real-time monitoring software, it offers insights into CPU, memory, disk usage, and additional, all in an easy-to-read interface. Similar to directions like best and htop, glances takes software monitoring a step further by the use of appearing more information and making an allowance for further customization.

Whether or not or now not you’re a tool admin or web developer, the glances command can also be an essential part of your toolkit. It’s particularly to hand for those who wish to keep watch over software property, troubleshoot potency issues, or optimize software efficiency. Alongside equipment like vmstat and iostat, glances can provide a further holistic view of your software’s neatly being and serve as.

How you can Arrange the glances Command

glances isn’t typically built-in by the use of default in most Linux distributions, so you will need to arrange it. Proper right here’s the way you’ll arrange and uninstall glances on relatively numerous Linux strategies:

See also  What Maximum Manufacturers Pass over With Person Trying out (That Prices Them Conversions)

For Ubuntu/Debian-based strategies:

To position in:

sudo apt-get exchange
sudo apt-get arrange glances

To uninstall:

sudo apt-get remove glances

For Fedora:

To position in:

sudo dnf arrange glances

To uninstall:

sudo dnf remove glances

For CentOS/RHEL:

To position in:

sudo yum arrange glances

To uninstall:

sudo yum remove glances

For macOS (the usage of Homebrew):

To position in:

brew arrange glances

To uninstall:

brew uninstall glances

How you can Use glances

1. Practice Machine Belongings

Syntax: glances

Rationalization: Displays a real-time analysis of software property.

Example: glances

Output:

CPU     5.6%  MEM    42.1%  SWAP    0.0%  LOAD    0.45  0.36  0.31 
NETWORK   rx   102Kb/s   tx   58Kb/s 
DISK I/O  be told  0b/s     write 20Kb/s

This output shows the prevailing CPU usage at 5.6%, memory usage at 42.1%, no transfer usage, neighborhood and disk I/O fees, and software load averages.

2. Practice Machine Belongings with a Explicit Refresh Duration

Syntax: glances -t <seconds>

Rationalization: Refreshes the display at a specific duration in seconds.

Example: glances -t 5

Output:

CPU     3.2%  MEM    40.2%  SWAP    0.0%  LOAD    0.25  0.30  0.28

This output is similar to the elemental command alternatively refreshes every 5 seconds.

3. Practice Explicit Processes by the use of Establish

Syntax: glances -p <process_name>

Rationalization: Filters the display to show most straightforward particular processes by the use of name.

Example: glances -p firefox

Output:

PID  1234  USER  john  VIRT  2.3G  RES  200M  CPU  12%  MEM  5%  TIME+  2:03  NAME  firefox

This output shows details about the Firefox process, at the side of PID, particular person, virtual and resident memory, CPU and memory usage, and general time.

4. Run Glances in Web Server Mode

Syntax: glances -w

Rationalization: Runs glances in web server mode, allowing get right of entry to by the use of a web browser.

See also  Object-oriented programming in PHP: reworking WordPress building

Example: glances -w

Output:

Glances Web Client Interface started on http://0.0.0.0:61208/

This output means that glances is operating as a web server, and the individual interface can also be accessed for the duration of the supplied URL.

5. Practice Machine Belongings with a Explicit Configuration Document

Syntax: glances -C <path_to_config_file>

Rationalization: Starts glances with a specific configuration file.

Example: glances -C /and so forth/glances/glances.conf

This command permits you to use a custom designed configuration file to change the conduct and glance of glances.

6. Export Statistics to a CSV Document

Syntax: glances --export csv --output-file <file.csv>

Rationalization: Exports the statistics to a CSV file.

Example: glances --export csv --output-file stats.csv

This command exports the monitored wisdom to a CSV file named stats.csv, making an allowance for further analysis or record-keeping.

7. Practice Disk I/O by the use of Disk Establish

Syntax: glances -d <disk_name>

Rationalization: Displays particular disk I/O by the use of disk name.

Example: glances -d sda

Output:

DISK I/O  sda  be told  100Kb/s  write  50Kb/s

This output shows the be told and write speeds specifically for the sda disk.

8. Practice with Docker Plugin

Syntax: glances --enable-plugin docker

Rationalization: Displays Docker bins the usage of the Docker plugin.

Example: glances --enable-plugin docker

Output:

DOCKER  ID  12345678  NAME  my_container  CPU  5%  MEM  10%  STATUS  Up 3 hours

This output shows details about a specific Docker container, at the side of its ID, name, CPU and memory usage, and status.

9. Display Group Cumulative Stats

Syntax: glances --enable-plugin ip

Rationalization: Displays cumulative neighborhood stats the usage of the IP plugin.

See also  How you can Release Opera Browser in Personal Mode via Default

Example: glances --enable-plugin ip

Output:

NETWORK  eth0  rx  1.2GB  tx  800MB

This output shows the cumulative received rx and transmitted tx wisdom for the eth0 neighborhood interface.

Additional Linux directions:
List Operations rmdir · cd · pwd
Document Operations cat · cp · dd · much less · ls · mkdir · mv · tail · tar · zip
Document 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 · best · who
Client and Session Regulate display screen · su · sudo

The publish Methods to Use the ‘glances’ Command in Linux appeared first on Hongkiat.

WordPress Website Development

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

[ 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!