跳至主要内容

emulate htop with top

The top program from procps-ng (debian, centos/el7 later)

Ever being with htop for some time and miss the process tree and graphical CPU/memory usage?

The top program from procps-ng (debian, centos/el7 later) can easily emulate the presentation of htop view.

Start the top program, it looks like following with its default configuration:

top - 09:20:54 up 307 days, 22:58,  4 users,  load average: 0.80, 0.74, 0.75
Tasks: 486 total,   1 running, 485 sleeping,   0 stopped,   0 zombie
%Cpu(s):  0.6 us,  0.6 sy,  0.0 ni, 98.8 id,  0.0 wa,  0.0 hi,  0.0 si,  0.0 st
KiB Mem : 65796532 total,   808264 free, 22970744 used, 42017524 buff/cache
KiB Swap: 16777212 total, 15433868 free,  1343344 used. 39944388 avail Mem

  PID USER      PR  NI    VIRT    RES    SHR S  %CPU %MEM     TIME+ COMMAND
30561 clouder+  20   0   16.0g   2.3g  23296 S  11.6  3.6  11037:25 java
  703 yarn      20   0 2586468 429556  20704 S   1.0  0.7 258:14.48 java
   10 root      20   0       0      0      0 S   0.7  0.0   3613:19 rcu_sched
 2736 ericsson  20   0  162316   2684   1588 R   0.7  0.0   0:00.12 top
 2979 hdfs      20   0 6243524   1.9g  21560 S   0.7  3.0 576:11.19 java
 7197 root      20   0       0      0      0 S   0.7  0.0   0:34.26 kworker/8:2

Press ttmmcVz in the top screen, then the top view will be turn to like this:

top - 09:25:20 up 307 days, 23:03,  4 users,  load average: 0.61, 0.60, 0.68
Tasks: 485 total,   2 running, 483 sleeping,   0 stopped,   0 zombie
%Cpu(s):   0.9/0.6     1[                                                                                               ] 
KiB Mem : 39.3/65796532 [                                                                                               ]
KiB Swap:  8.0/16777212 [                                                                                               ]

  PID USER      PR  NI    VIRT    RES    SHR S  %CPU %MEM     TIME+ COMMAND
    1 root      20   0  199708   3652   1836 S   0.0  0.0  91:41.00 /usr/lib/systemd/systemd --system --deserialize 23
  699 root      20   0   53892  21140  20540 S   0.0  0.0  20:04.10  `- /usr/lib/systemd/systemd-journald
 1052 root      39  19   16808     20      0 S   0.0  0.0   0:10.43  `- /usr/sbin/alsactl -s -n 19 -c -E ALSA_CONFIG_PAT+  1056 libstor+  20   0    8524     32      0 S   0.0  0.0   1:57.23  `- /usr/bin/lsmd -d
 1058 root      20   0  419456   1288    704 S   0.0  0.0   7:34.04  `- /usr/sbin/ModemManager
 1063 root      20   0   25212   2328   1000 S   0.0  0.0  39:10.69  `- /usr/lib/systemd/systemd-logind

And if you really like the per CPU details, presss 1 in in the top screen.

Top Key Press Command explained

Press ? in the top screen, to get full list of supported KeyPress command.

t
toggles task/cpu stats, which cycles from 3 avaiable CPU stats presention styles.
m
toggles memory info, which also cycles from 3 avaiable Memory info presention styles.
c
toggles between Cmd name or Cmd line presention styles.
V
toggles between normal process list or Forest view (process tree with parent/children relationship).
z
toggles between color and mono display.

评论

此博客中的热门博文

Use MobaDiff with git difftool

Recently there's an activity in IT that forces the deletion of all unauthorized softwares from all work machines. Unfortunately, kdiff3 is one in the list. As it is generally okay to use vimdiff as an alternative for kdiff3, A gui tool is better suited for desktop workflows. Known that MobaXterm is shipping a gui diff tool named MobaDiff. But it only appears in the windows right click context menu. Find the real application name takes me some time to search in the windows registry. "MobaRTE.exe", which is the one invoked by HKCR\*\shell\MobaDiff. And it was invoked with "-contextdiff" switch to show MobaDiff UI, while when the switch is "-contextedit" it shows MobaTextEditor. Too bad that the "-contextdiff" switch do not support pre-image post-image as other diff tool did, which effectively made it unable to be used as a command line diff utility. Also MobaTech did not mention anything in their document of this Mob...

Emacs 26.2 windows Hunspell setup

 Hunspell failed with default setup With my shining new emacs26.2 setup, I am happy until trying to `M-$’ on a word. I got following error message, it used to be work by just set ispell program to hunspell. Starting new Ispell process hunspell with default dictionary... split-string: Wrong type argument: stringp, nil After some check in my customization setting. nothing found. install a copy of hunspell dictionary At first I think it was caused by no hunspell dictionary. I downloaded en US and en CA hunspell dictionary from wordlist.sf.net project. After put the .aff and .dic files into C:directory I’ve also made a symbolic link from en US ones by running the `mklink’ tool: mklink default.aff en_US.aff mklink default.dic en_US.dic Err… hunspell does not work, still. Time to read code Dig into ispell.el I suprisingly find there’re lots of hunspell specific logic. Originally I was thinking hunspell support involves no elisp work. Acturally ispell did many work to de...

XEmacs 21.5 beta 35 "kohlrabi" has been released.

If you are an old XEmacs user, you may feel happy to see this from https://www.xemacs.org/.    After ten years, XEmacs released a new version 21.5. So there's still many people cares about XEmacs. The XEmacs' source repo have been moved from altassian Bitbucket to https://heptapod.net/. As Bitbucket have been dropped Mercurial support many years ago.