Are you working as a system admin? If yes, are you also aware of a handy solution to find system efficiency? Then this article is for you which helps you to find system efficiency leveraging the most commonly used tools in Linux.
TOP
The top program provides a dynamic real-time view of a running system. It can display system summary information as well as a list of processes or threads currently being managed by the Linux kernel. The type, order, and size of information displayed for these processes are all user configurable and configuration can be determined accordingly.
To use the Top program, use the following command as shown below –
$ sudo top
The sample output should be like this –
top - 11:39:06 up 3 days, 35 min, 1 user, load average: 1.18, 1.08, 0.81 Tasks: 298 total, 1 running, 287 sleeping, 9 stopped, 1 zombie %Cpu(s): 10.8 us, 1.0 sy, 0.0 ni, 87.9 id, 0.2 wa, 0.0 hi, 0.1 si, 0.0 st KiB Mem : 8077112 total, 873772 free, 5507480 used, 1695860 buff/cache KiB Swap: 8290300 total, 6969100 free, 1321200 used. 1346984 avail Mem PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND 1806 root 20 0 347764 7548 6104 S 22.9 0.1 51:34.26 upowerd 5216 linux 20 0 1138860 324968 105648 S 10.0 4.0 5:32.12 chrome 1017 root 20 0 403384 31348 17220 S 2.7 0.4 47:29.18 Xorg 32053 linux 20 0 1254564 335872 113912 S 2.3 4.2 11:38.17 chrome 2632 linux 9 -11 574972 6344 4420 S 1.7 0.1 9:59.77 pulseaudio 6132 linux 20 0 1578444 91320 28280 S 1.7 1.1 28:46.99 compiz 18589 linux 20 0 660332 24780 14444 S 1.3 0.3 0:07.33 gnome-term+ 30330 linux 20 0 2012684 297232 166156 S 1.3 3.7 12:00.15 chromium-b+ 31831 linux 20 0 1857452 243328 68856 S 1.3 3.0 13:42.67 chrome 7 root 20 0 0 0 0 S 0.3 0.0 3:15.82 rcu_sched 32 root 39 19 0 0 0 S 0.3 0.0 0:13.80 khugepaged 1695 jenkins 20 0 5647356 827836 5532 S 0.3 10.2 2:03.08 java 12694 usbmux 20 0 257372 7448 6412 S 0.3 0.1 0:03.21 usbmuxd 13070 linux 20 0 1746040 624224 233092 S 0.3 7.7 0:40.53 chrome 13676 root 20 0 41932 3544 2856 R 0.3 0.0 0:00.03 top 18395 linux 20 0 942928 167740 63696 S 0.3 2.1 3:11.92 chrome
To get more information about TOP program, use the following command –
$ man top
PS
The ps command displays information about a selection of the active processes. If you want a repetitive update of the selection and the displayed information then use this.
To get the process information, use the following command –
$ ps
The sample output should be like this –
PID TTY TIME CMD 12986 pts/4 00:00:02 lsof 12987 pts/4 00:00:00 lsof 13558 pts/4 00:00:00 man 13569 pts/4 00:00:00 man 13570 pts/4 00:00:00 pager 13931 pts/4 00:00:00 man 13941 pts/4 00:00:00 man 13942 pts/4 00:00:00 pager 13969 pts/4 00:00:00 top 13970 pts/4 00:00:00 man 13980 pts/4 00:00:00 man 13981 pts/4 00:00:00 pager 14180 pts/4 00:00:00 ps 18597 pts/4 00:00:00 bash
HTOP
It is similar to a top command, but allows you to scroll vertically and horizontally, so that, you can see all the processes running on the system, along with their full command lines as well as viewing them as a process tree, and selecting multiple processes and acting on them all at once.
To install HTOP, use the following command –
$ sudo apt install htop
The sample output should be like this –
Reading package lists... Done Building dependency tree Reading state information... Done The following NEW packages will be installed: htop 0 upgraded, 1 newly installed, 0 to remove and 61 not upgraded. Need to get 76.4 kB of archives. After this operation, 215 kB of additional disk space will be used. Get:1 http://bit.ly/1rEZidB xenial-updates/universe amd64 htop amd64 2.0.1-1ubuntu1 [76.4 kB] Fetched 76.4 kB in 0s (132 kB/s)
To get information about a process using HTOP, use the following command-
$sudo htop
The sample output should be like this –
To get the more information about HTOP, use the following command –
$ htop -help
The sample output should be like this –
htop 2.0.1 - (C) 2004-2016 Hisham Muhammad Released under the GNU GPL. -C --no-color Use a monochrome color scheme -d --delay=DELAY Set the delay between updates, in tenths of seconds -h --help Print this help screen -s --sort-key=COLUMN Sort by COLUMN (try --sort-key=help for a list) -u --user=USERNAME Show only processes of a given user -p --pid=PID,[,PID,PID...] Show only the given PIDs -v --version Print version info Long options may be passed with a single dash. Press F1 inside htop for online help. See 'man htop' for more information.
ATOP
The ATOP program is an interactive monitor to view the load on a Linux system. It shows the occupation of the most critical hardware resources (from a performance point of view) on a system level, i.e. CPU, memory, disk and network.
To install ATOP, use the following command –
$ sudo apt install atop
The sample output should be like this –
Reading package lists... Done Building dependency tree Reading state information... Done The following NEW packages will be installed: atop 0 upgraded, 1 newly installed, 0 to remove and 61 not upgraded. Need to get 90.0 kB of archives. After this operation, 237 kB of additional disk space will be used. Get:1 http://bit.ly/1rEZidB xenial/universe amd64 atop amd64 1.26-2build1 [90.0 kB] Fetched 90.0 kB in 0s (165 kB/s) Selecting previously unselected package atop. (Reading database ... 235747 files and directories currently installed.) Preparing to unpack .../atop_1.26-2build1_amd64.deb ... Unpacking atop (1.26-2build1) ... .........................................................................
To get information using ATOP, use the following command –
$sudo atop
The sample output should be like this –
ATOP - linux-Inspiron-3542 2017/01/12 11:58:22 ------ 3d0h55m8s elapsed PRC | sys 131m19s | user 734m02s | #proc 316 | #zombie 1 | #exit 0 | CPU | sys 24% | user 153% | irq 0% | idle 219% | wait 4% | cpu | sys 10% | user 62% | irq 0% | idle 27% | cpu001 w 1% | cpu | sys 10% | user 61% | irq 0% | idle 28% | cpu002 w 1% | cpu | sys 9% | user 62% | irq 0% | idle 29% | cpu003 w 0% | cpu | sys 3% | user 18% | irq 0% | idle 78% | cpu000 w 1% | CPL | avg1 1.30 | avg5 1.12 | avg15 0.95 | csw 853266e3 | intr 11400e4 | MEM | tot 7.7G | free 552.2M | cache 1.5G | buff 55.5M | slab 228.4M | SWP | tot 7.9G | free 6.6G | | vmcom 13.9G | vmlim 11.8G | PAG | scan 4294e3 | stall 0 | | swin 370276 | swout 837851 | DSK | sda | busy 10% | read 365375 | write 457557 | avio 5.23 ms | NET | transport | tcpi 1567171 | tcpo 1123671 | udpi 482845 | udpo 290359 | NET | network | ipi 4198397 | ipo 3171915 | ipfrw 1749e3 | deliv 2271e3 | NET | enp7s0 0% | pcki 3637936 | pcko 1859339 | si 130 Kbps | so 10 Kbps | NET | wlp6s0 ---- | pcki 699906 | pcko 1270349 | si 5 Kbps | so 56 Kbps | NET | lo ---- | pcki 47295 | pcko 47295 | si 0 Kbps | so 0 Kbps | *** system and process activity since boot *** PID SYSCPU USRCPU VGROW RGROW RDDSK WRDSK ST EXC S CPU CMD 1/79 830 23m12s 222m43s 1.9G 713.2M 40180K 520K N- - S 34% NetworkManager 2761 15m16s 126m31s 1.1G 72924K 8636K 0K N- - S 20% nm-applet 759 8m04s 68m56s 44488K 3136K 1628K 0K N- - S 11% dbus-daemon 951 13m26s 43m57s 290.3M 5636K 4648K 0K N- - S 8% polkitd
To get more information about ATOP, use the following command –
$ sudo atop -h
The sample output should be like this –
Usage: atop [-flags] [interval [samples]] or Usage: atop -w file [-S] [-a] [interval [samples]] atop -r [file] [-b hh:mm] [-e hh:mm] [-flags] generic flags: -a show or log all processes (i.s.o. active processes only) -P generate parseable output for specified label(s) -L alternate line length (default 80) in case of non-screen output -f show fixed number of lines with system-statistics -l show limited number of lines for certain resources -1 show average-per-second i.s.o. total values .............................................................................
POWERTOP
The powertop program helps you to diagnose various issues with power consumption and power management. It also has an interactive mode allowing one to experiment with various power management settings.When invoking powertop without arguments powertop starts in interactive mode.
To install powertop, use the following command –
$ sudo apt install powertop
The sample output should be like this –
Reading package lists... Done Building dependency tree Reading state information... Done Suggested packages: cpufrequtils laptop-mode-tools The following NEW packages will be installed: powertop 0 upgraded, 1 newly installed, 0 to remove and 61 not upgraded. Need to get 164 kB of archives. After this operation, 537 kB of additional disk space will be used. Get:1 http://bit.ly/1rEZidB xenial/main amd64 powertop amd64 2.8-1build1 [164 kB] Fetched 164 kB in 0s (215 kB/s) Selecting previously unselected package powertop. (Reading database ... 235764 files and directories currently installed.) Preparing to unpack .../powertop_2.8-1build1_amd64.deb ...
To get information about power consumption of a machine, use the following command –
$ sudo powertop
The sample output should be like this-
PowerTOP 2.8 Overview Idle stats Frequency stats Device stats Tunables Summary: 1223.5 wakeups/second, 15.8 GPU ops/seconds, 0.0 VFS ops/sec and 46.4% CPU use Usage Events/s Category Description 77.8 ms/s 311.3 Process /opt/google/chrome/chrome --type=renderer --enable-featur 21.1 ms/s 217.7 Process /opt/google/chrome/chrome 12.1 ms/s 160.6 Process /usr/bin/pulseaudio --start --log-target=syslog 299.3 ms/s 10.8 Process /usr/lib/upower/upowerd 547.2 us/s 86.7 Process [rcu_sched] 13.8 ms/s 61.1 Process compiz 1.6 ms/s 71.9 Timer tick_sched_timer 3.9 ms/s 38.4 Process /opt/google/chrome/chrome --type=gpu-process --enable-fea 2.8 ms/s 30.5 Process /usr/sbin/usbmuxd --user usbmux --systemd 472.5 us/s 21.7 Process /usr/bin/java -Djava.awt.headless=true -jar /usr/share/je 1.5 ms/s 20.7 Interrupt [4] block(softirq) 285.8 us/s 20.7 Interrupt [40] xhci_hcd 1.4 ms/s 15.8 Process /usr/lib/gnome-terminal/gnome-terminal-server 533.3 us/s 17.7 Process /usr/sbin/mysqld 6.8 ms/s 8.9 Process /usr/lib/xorg/Xorg -core :0 -seat seat0 -auth /var/run/li 260.9 us/s 10.8 Interrupt [6] tasklet(softirq)
To get more information about powertop, use the following command –
$ sudo powertop -h
The sample output should be like this –
Usage: powertop [OPTIONS] --auto-tune sets all tunable options to their GOOD setting -c, --calibrate runs powertop in calibration mode -C, --csv[=filename] generate a csv report --debug run in "debug" mode --extech[=devnode] uses an Extech Power Analyzer for measurements -r, --html[=filename] generate a html report -i, --iteration[=iterations] number of times to run each test -q, --quiet suppress stderr output -t, --time[=seconds] generate a report for 'x' seconds -w, --workload[=workload] file to execute for workload -V, --version print version information -h, --help print this help menu For more help, please refer to the 'man 8 powertop'
In our next articles, we will come up with more Linux based tricks and tips. Keep reading!
Thanks to: Short Articles on The Latest Technologies Permanent link
No hay comentarios.:
Publicar un comentario
Thanks for your comment