The glances command in Linux supplies a complete evaluation of device efficiency. Performing as a real-time tracking device, it gives insights into CPU, reminiscence, disk utilization, and extra, all in an easy-to-read interface. Very similar to instructions like best and htop, glances takes device tracking a step additional by way of showing additional info and taking into consideration extra customization.

Whether or not you’re a device admin or internet developer, the glances command will also be an very important a part of your toolkit. It’s in particular at hand for many who want to control device assets, troubleshoot efficiency problems, or optimize device potency. Along gear like vmstat and iostat, glances can give a extra holistic view of your device’s well being and function.

Methods to Set up the glances Command

glances isn’t generally integrated by way of default in maximum Linux distributions, so it is very important set up it. Right here’s how you’ll set up and uninstall glances on quite a lot of Linux methods:

For Ubuntu/Debian-based methods:

To put in:

sudo apt-get replace
sudo apt-get set up glances

To uninstall:

sudo apt-get take away glances

For Fedora:

To put in:

sudo dnf set up glances

To uninstall:

sudo dnf take away glances

For CentOS/RHEL:

To put in:

sudo yum set up glances

To uninstall:

sudo yum take away glances

For macOS (the use of Homebrew):

To put in:

brew set up glances

To uninstall:

brew uninstall glances

Methods to Use glances

1. Observe Gadget Assets

Syntax: glances

Clarification: Shows a real-time evaluation of device assets.

Instance: 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  learn  0b/s     write 20Kb/s

This output presentations the present CPU utilization at 5.6%, reminiscence utilization at 42.1%, no switch utilization, community and disk I/O charges, and device load averages.

2. Observe Gadget Assets with a Particular Refresh Period

Syntax: glances -t <seconds>

Clarification: Refreshes the show at a particular period in seconds.

Instance: glances -t 5

Output:

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

This output is very similar to the fundamental command however refreshes each 5 seconds.

3. Observe Particular Processes by way of Identify

Syntax: glances -p <process_name>

Clarification: Filters the show to turn simplest explicit processes by way of title.

Instance: glances -p firefox

Output:

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

This output presentations information about the Firefox procedure, together with PID, person, digital and resident reminiscence, CPU and reminiscence utilization, and overall time.

4. Run Glances in Internet Server Mode

Syntax: glances -w

Clarification: Runs glances in internet server mode, permitting get admission to by means of a internet browser.

Instance: glances -w

Output:

Glances Internet Consumer Interface began on http://0.0.0.0:61208/

This output signifies that glances is working as a internet server, and the person interface will also be accessed in the course of the equipped URL.

5. Observe Gadget Assets with a Particular Configuration Record

Syntax: glances -C <path_to_config_file>

Clarification: Begins glances with a particular configuration dossier.

Instance: glances -C /and so on/glances/glances.conf

This command lets you use a customized configuration dossier to switch the habits and look of glances.

6. Export Statistics to a CSV Record

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

Clarification: Exports the statistics to a CSV dossier.

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

This command exports the monitored knowledge to a CSV dossier named stats.csv, taking into consideration additional research or record-keeping.

7. Observe Disk I/O by way of Disk Identify

Syntax: glances -d <disk_name>

Clarification: Screens explicit disk I/O by way of disk title.

Instance: glances -d sda

Output:

DISK I/O  sda  learn  100Kb/s  write  50Kb/s

This output presentations the learn and write speeds particularly for the sda disk.

8. Observe with Docker Plugin

Syntax: glances --enable-plugin docker

Clarification: Screens Docker packing containers the use of the Docker plugin.

Instance: glances --enable-plugin docker

Output:

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

This output presentations information about a particular Docker container, together with its ID, title, CPU and reminiscence utilization, and standing.

9. Show Community Cumulative Stats

Syntax: glances --enable-plugin ip

Clarification: Shows cumulative community stats the use of the IP plugin.

Instance: glances --enable-plugin ip

Output:

NETWORK  eth0  rx  1.2GB  tx  800MB

This output presentations the cumulative gained rx and transmitted tx knowledge for the eth0 community interface.

Extra Linux instructions:
Listing Operations rmdir · cd · pwd
Record Operations cat · cp · dd · much less · ls · mkdir · mv · tail · tar · zip
Record 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 · best · who
Consumer and Consultation Control display screen · su · sudo

The put up Methods to Use the ‘glances’ Command in Linux seemed first on Hongkiat.

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

[ continue ]