vmstat 명령어 생성기
가상 메모리 통계를 보고하는 vmstat 명령어 생성하기
vmstat 입문하기
## vmstat이란 무엇인가요?
`vmstat` 명령어는 가상 메모리, 프로세스, CPU 및 I/O에 관한 통계 정보를 보고합니다. 한 번 실행하면 부팅 이후의 현재 상태를 확인할 수 있으며, 지연 시간을 지정하면 지속적으로 모니터링하는 루프가 작동합니다. 이는 메모리 압력, 스왑 사용량, CPU 과부하를 진단하는 데 매우 유용합니다.
## 사용 방법
1. **지연 시간 설정**: 지속적으로 실행할 시간 간격(초)을 입력합니다(예: `2`). 한 번의 스냅샷만 원할 경우 생략합니다. 2. **횟수 설정**: 샘플 수를 제한합니다(예: `5`). 3. **옵션 선택**: 활성/비활성 메모리는 `-a`, 이벤트 카운터는 `-s`, 디스크 통계는 `-d`를 사용하며, 확장된 형태나 타임스탬프가 포함된 출력을 원할 경우 `-w`/`-t`을 사용합니다. 4. **복사 및 실행**: 생성된 명령어를 터미널에 복사합니다.
일반 옵션
### `delay` and `count` (positional) Pass an interval in seconds and an optional sample count. `vmstat 2 5` reports five samples two seconds apart and then exits. Without a count, vmstat runs indefinitely.
### `-a` Active/inactive memory Show the `active` and `inact` (inactive) memory columns instead of the default `buff`/`cache` split. Helpful for spotting how much RAM is genuinely in use.
### `-s` Statistics Display a table of event counters and memory totals since boot (forks, context switches, swap in/out, free/shared/buffer/cache memory). Output is a one-off, not a loop.
### `-d` Disk statistics Report per-disk reads, writes, and IO totals. Useful when investigating which device is busy.
### `-w` Wide output Widen the columns so values never wrap — easier to read on high-resolution terminals or when piping to a log.
### `-t` Timestamp Add a timestamp column to every sample, which is essential when archiving output for later analysis.
### `-S` Unit Set the display unit for memory with one of `k`, `K`, `m`, `M`. Example: `vmstat -S M 2` shows memory in megabytes.
▶어떤 열을 통해 시스템의 메모리가 부족한지 알 수 있나요?
▶시간스탬프와 함께 vmstat을 파일에 어떻게 기록하나요?
▶CPU의 us/sy/id/wa 열은 무엇을 의미하나요?
이 도구가 당신에게 도움이 되었다면, 저에게 커피 한 잔 사주세요.
제게 커피 한 잔 사주세요.