0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

[Linux][command] プロセス管理_リソース確認_top, free, uptime

Last updated at Posted at 2025-04-12

topコマンド

$ top [オプション]
オプション 由来 説明
default table of processe - システムのプロセスとリソース使用状況をリアルタイムで表示
-d delay - 更新間隔を秒単位で指定(例:top -d 3 で3秒ごとに更新)
-u user - 指定したユーザーのプロセスのみを表示
-p process - 指定したPIDのプロセス情報のみを表示
-n number - 指定回数の更新後に自動終了(例:top -n 5 で5回更新後に終了)
-b batch - バッチモード(対話なし)で出力

使用例:

$ top -b -n 1

top - 12:57:01 up 13 min,  1 user,  load average: 0.00, 0.00, 0.00
Tasks: 173 total,   1 running, 172 sleeping,   0 stopped,   0 zombie
%Cpu(s):  0.3 us,  0.1 sy,  0.0 ni, 99.6 id,  0.0 wa,  0.0 hi,  0.0 si,  0.0 st
MiB Mem :   1986.6 total,   241.9 free,   677.2 used,  1067.6 buff/cache
MiB Swap:    448.5 total,   447.7 free,     0.8 used.  1067.6 avail Mem

  PID USER      PR  NI    VIRT    RES    SHR S  %CPU %MEM     TIME+ COMMAND
    1 root      20   0  102020  11744   8552 S   0.0  0.3   0:00.46 systemd
    2 root      20   0       0      0      0 S   0.0  0.0   0:00.00 kthreadd
    3 root      20   0       0      0      0 S   0.0  0.0   0:00.00 ksoftirqd/0
    4 root      20   0       0      0      0 S   0.0  0.0   0:00.00 kworker/0:0
    5 root      20   0       0      0      0 S   0.0  0.0   0:00.00 kworker/0:0H
    6 root      20   0       0      0      0 S   0.0  0.0   0:00.00 kworker/u256:0
    7 root      20   0       0      0      0 S   0.0  0.0   0:00.00 mm_percpu_wq
    8 root      20   0       0      0      0 S   0.0  0.0   0:00.00 ksoftirqd/1
    9 root      20   0       0      0      0 S   0.0  0.0   0:00.00 rcu_sched
   10 root      20   0       0      0      0 S   0.0  0.0   0:00.00 rcu_bh
   ...

freeコマンド

$ free [オプション]
オプション 由来 説明
default free memory - システムの物理メモリおよびスワップメモリの使用状況をキロバイト単位で表示
-b bytes - メモリ容量をバイト単位で表示
-k kilo - メモリ容量をキロバイト単位で表示(デフォルト動作)
-m mega - メモリ容量をメガバイト単位で表示
-g giga - メモリ容量をギガバイト単位で表示
--tera tera - メモリ容量をテラバイト単位で表示
--peta peta - メモリ容量をペタバイト単位で表示
-h human-readable - 人間が読みやすい形式(適切な単位)でメモリ容量を表示
-w wide - ワイドモードで表示し、バッファとキャッシュの使用状況を個別に表示
-c 回数 count - 指定した回数分、メモリ情報を表示
-l lohi - LowメモリとHighメモリの使用状況を表示
-s 秒数 seconds - 指定した秒数ごとにメモリ情報を継続的に表示
--si SI units - 単位換算に1000を基準としたSI単位を使用
-t total - 物理メモリとスワップメモリの合計を表示

使用例:

$ free -h

              total        used        free      shared  buff/cache   available
Mem:           1.9Gi       638Mi       248Mi        20Mi       1.1Gi       1.1Gi
Swap:          448Mi          0B       448Mi

uptimeコマンド

$ uptime
オプション 由来 説明
default uptime (稼働時間) - システムの起動時間、稼働時間、ログインユーザー数、ロードアベレージ(負荷平均)を表示

使用例:

$ uptime

14:35:07 up 5 days,  3:22,  2 users,  load average: 0.04, 0.01, 0.00

Ping-t

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?