文書の過去の版を表示しています。
プロセス関連
プロセス表示[ps]
現在実行されているプロセスのスナップショットを表示する。
$ ps
PID TTY TIME CMD 2084 pts/4 00:00:12 bash 3879 pts/4 00:00:00 ps
aux オプションでユーザー、CPU使用率、メモリー使用率などを表示する。
$ ps aux
USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND root 1 0.1 0.2 105560 12216 ? Ss 17:52 0:14 /usr/lib/systemd/systemd --switched-root root 607 0.0 0.0 32760 1840 ? S<sl 17:52 0:00 /sbin/auditd root 634 0.0 0.2 258548 16444 ? Ssl 17:52 0:05 /usr/sbin/rsyslogd -n root 636 0.0 0.0 17112 5932 ? Ss 17:52 0:02 /sbin/rngd -f root 637 0.0 0.0 80080 3128 ? Ssl 17:52 0:06 /usr/sbin/irqbalance --foreground root 638 0.0 0.0 9592 5096 ? Ss 17:52 0:00 /usr/libexec/bluetooth/bluetoothd root 639 0.0 0.1 316256 9892 ? Ssl 17:52 0:00 /usr/sbin/ModemManager root 642 0.0 0.1 53936 11084 ? Ss 17:52 0:00 /usr/bin/VGAuthService -s root 643 0.0 0.0 7716 4004 ? Ss 17:52 0:00 /usr/sbin/smartd -n -q never root 644 0.0 0.0 17768 5464 ? Ss 17:52 0:00 /usr/lib/systemd/systemd-machined root 645 0.0 0.1 253708 11088 ? Ss 17:52 0:00 /usr/sbin/sssd -i --logger=files dbus 648 0.0 0.0 22960 5292 ? Ssl 17:52 0:01 /usr/bin/dbus-daemon --system --address= polkitd 649 0.0 0.3 1996000 22244 ? Ssl 17:52 0:00 /usr/lib/polkit-1/polkitd --no-debug root 651 3.6 0.2 342680 13108 ? Ssl 17:53 5:30 /usr/bin/vmtoolsd chrony 657 0.0 0.0 88744 3240 ? S 17:53 0:02 /usr/sbin/chronyd root 661 0.0 0.0 263744 3532 ? Ssl 17:53 0:00 /usr/sbin/gssproxy -D root 685 0.0 0.1 472364 11580 ? Ssl 17:53 0:00 /usr/sbin/abrtd -d -s root 708 0.0 0.5 332184 35932 ? Ssl 17:53 0:01 /usr/bin/python3 /usr/sbin/firewalld --n root 735 0.0 0.2 254468 12156 ? S 17:53 0:00 /usr/libexec/sssd/sssd_be --domain impli root 739 0.0 0.1 302116 11296 ? Ss 17:53 0:00 /usr/bin/abrt-dump-journal-core -D -T -f root 740 0.0 0.2 347688 17984 ? Ss 17:53 0:01 /usr/bin/abrt-dump-journal-oops -fxtD root 741 0.0 0.1 294068 11132 ? Ss 17:53 0:00 /usr/bin/abrt-dump-journal-xorg -fxtD root 742 0.0 0.5 273656 30480 ? S 17:53 0:01 /usr/libexec/sssd/sssd_nss --uid 0 --gid root 743 0.0 0.1 27976 8772 ? Ss 17:53 0:01 /usr/lib/systemd/systemd-logind root 750 0.0 0.3 547924 19840 ? Ssl 17:53 0:02 /usr/sbin/NetworkManager --no-daemon root 769 0.0 0.4 480052 27084 ? Ssl 17:53 0:02 /usr/bin/python3 -Es /usr/sbin/tuned -l root 770 0.0 0.1 27088 6900 ? Ss 17:53 0:00 /usr/sbin/sshd -D -oCiphers=aes256-gcm@o root 774 0.0 0.7 1766520 45400 ? Ssl 17:53 0:03 /usr/sbin/libvirtd root 777 0.0 0.0 18156 2260 ? Ss 17:53 0:00 /usr/sbin/atd -f root 782 0.0 0.0 225424 3604 ? Ss 17:53 0:00 /usr/sbin/crond -n root 786 0.0 0.0 221672 1492 tty1 Ss+ 17:53 0:00 /sbin/agetty -o -p -- \u --noclear tty1 dnsmasq 1203 0.0 0.0 24252 2040 ? S 17:53 0:00 /usr/sbin/dnsmasq --conf-file=/var/lib/l root 1204 0.0 0.0 24224 408 ? S 17:53 0:00 /usr/sbin/dnsmasq --conf-file=/var/lib/l dnsmasq 1232 0.0 0.0 24324 2512 ? S 17:53 0:00 /usr/sbin/dnsmasq --conf-file=/var/lib/l root 1281 0.0 0.2 252740 12372 ? Ss 17:53 0:00 /usr/sbin/virtlogd qemu 1300 7.1 9.8 3008152 599500 ? Sl 17:53 10:40 /usr/bin/qemu-system-x86_64 -machine acc qemu 1341 13.4 19.2 3543676 1167724 ? Sl 17:53 19:58 /usr/bin/qemu-system-x86_64 -machine acc qemu 1398 8.2 9.9 2998624 605712 ? Sl 17:53 12:21 /usr/bin/qemu-system-x86_64 -machine acc qemu 1445 4.5 9.7 3032820 593312 ? Sl 17:53 6:48 /usr/bin/qemu-system-x86_64 -machine acc root 1470 0.0 0.1 15832 9240 ? S 17:54 0:08 /sbin/dhclient -d -q -sf /usr/libexec/nm root 2053 0.2 0.1 39168 9812 ? Ss 18:16 0:16 sshd: tomoyan [priv] tomoyan 2075 0.0 0.1 19776 8932 ? Ss 18:17 0:05 /usr/lib/systemd/systemd --user tomoyan 2077 0.0 0.0 127344 4580 ? S 18:17 0:00 (sd-pam) tomoyan 2083 0.0 0.0 39168 5404 ? R 18:17 0:04 sshd: tomoyan@pts/4 tomoyan 2084 0.1 0.0 225876 4892 pts/4 Ss 18:17 0:12 -bash 〜省略〜 tomoyan 4234 0.0 0.0 228192 3972 pts/4 R+ 20:22 0:00 ps aux
タスク表示[top]
Linux のタスクを表示する。
$ top
top - 20:43:42 up  2:51,  1 user,  load average: 0.09, 0.06, 0.04
Tasks: 191 total,   1 running, 190 sleeping,   0 stopped,   0 zombie
%Cpu(s):  0.1 us,  0.3 sy,  0.0 ni, 99.3 id,  0.0 wa,  0.2 hi,  0.2 si,  0.0 st
MiB Mem :   5935.2 total,    217.2 free,   3157.0 used,   2561.0 buff/cache
MiB Swap:   8081.0 total,   8071.7 free,      9.3 used.   2540.8 avail Mem
   PID USER      PR  NI    VIRT    RES    SHR S  %CPU  %MEM     TIME+ COMMAND
  1341 qemu      20     3543676   1.1g  25060 S   3.3  19.2  20:34.06 qemu-system-x86
  1300 qemu      20     3008152 599292  24536 S   1.7   9.9  10:59.51 qemu-system-x86
  1398 qemu      20     2998624 605556  24728 S   1.0  10.0  12:39.87 qemu-system-x86
  1445 qemu      20     3032820 593308  24760 S   0.3   9.8   6:57.63 qemu-system-x86
  2573 root      20                           I   0.3         0:31.07 kworker/2:1-mm_percpu_wq
     1 root      20      105560  12216   7800 S         0.2   0:14.82 systemd
     2 root      20                           S               0:00.23 kthreadd
     3 root       0 -20                       I                       rcu_gp
     4 root       0 -20                       I                       rcu_par_gp
     6 root       0 -20                       I                       kworker/0:0H-kblockd
     8 root       0 -20                       I                       mm_percpu_wq
     9 root      20                           S               0:18.60 ksoftirqd/0
    10 root      20                           I               0:02.47 rcu_sched
    11 root      20                           I                       rcu_bh
    12 root      rt                           S               0:02.21 migration/0
    14 root      20                           S                       cpuhp/0
    15 root      20                           S                       cpuhp/1
    16 root      rt                           S               0:00.04 migration/1
    17 root      20                           S               0:03.27 ksoftirqd/1
    19 root       0 -20                       I                       kworker/1:0H-kblockd
    20 root      20                           S                       cpuhp/2
top コマンドでよく使うキーの説明
| キー | 説明 | 
|---|---|
| 1 | CPU使用率の表示切替 | 
| h | ヘルプの表示(ESCキーで戻る) | 
| c | コマンド名/コマンドライン切替 | 
| z | カラー/モノクロ切替 | 
| Shift + w | 設定の保存 | 
| q | top コマンドの終了 | 
プロセス優先度の変更[renice]
$ sudo renice -3 1982 1982 (process ID) 従来の優先順位は 0 で, 新しい優先順位は -3 です