- IT 리더가 지목한 AI 가치 실현의 최대 걸림돌은 ‘비용 관리’
- Los CIO consideran que la gestión de costes puede acabar con el valor de la IA
- 칼럼 | AI 에이전트, 지금까지의 어떤 기술과도 다르다
- The $23 Echo Dot deal is a great deal to upgrade your smart home this Black Friday
- Amazon's Echo Spot smart alarm clock is almost half off this Black Friday
Gauging system activity on Linux with dstat
Default dstat options
Were you to use the dstat command with no options, the output would include a lot more details than you might expect and would look more like what you see below.
$ dstat You did not select any stats, using -cdngy by default. ----total-usage---- -dsk/total- -net/total- ---paging-- ---system-- usr sys idl wai stl| read writ| recv send| in out | int csw 1 1 96 1 0| 16k 1128k| 54B 674B| 0 0 | 195 295 0 0 99 0 0| 0 4093B| 54B 354B| 0 0 | 129 208 1 0 99 0 0| 0 0 | 500B 354B| 0 0 | 115 170 0 0 99 0 0| 0 0 | 54B 354B| 0 0 | 65 111 1 1 99 0 0| 0 0 | 54B 354B| 0 0 | 99 157 0 0 99 0 0| 0 0 | 54B 354B| 0 0 | 63 113^c
Notice that this output includes stats usage, disk read and write, network activity, paging and system stats. The output from using dstat without options is the same as using dstat with the “cdngy” options (dstat -cdngy).
To get eight lines of this information in 2-second intervals, add the numeric arguments as shown in this command:
$ dstat 2 8 You did not select any stats, using -cdngy by default. ----total-usage---- -dsk/total- -net/total- ---paging-- ---system-- usr sys idl wai stl| read writ| recv send| in out | int csw 0 0 99 0 0| 0 0 | 298B 541B| 0 0 | 123 197 0 0 99 0 0| 0 0 | 54B 346B| 0 0 | 64 114 0 0 99 0 0| 0 0 | 87B 515B| 0 0 | 66 117 0 0 99 0 0| 0 0 | 54B 346B| 0 0 | 78 125 1 0 100 0 0| 0 0 | 277B 346B| 0 0 | 62 113 1 1 99 0 0| 0 0 |3893B 411B| 0 0 | 110 144 5 0 85 10 0| 0 128k| 54B 346B| 0 0 | 213 152 1 0 98 0 0| 0 180k| 54B 354B| 0 0 | 92 149
Getting help
Note that the dstat command doesn’t always come with a man page. However, you can get a list of the command’s options and what each option represents using the dstat –help command.
$ dstat --help Usage: dstat [-afv] [options...] [delay [count]] Versatile tool for generating system resource statistics Dstat options: -c, --cpu enable cpu stats -C 0,3,total include cpu0, cpu3 and total -d, --disk enable disk stats -D total,sda include sda and total --dm, --device-mapper enable device mapper stats -L root,home,total include root, home and total --md, --multi-device enable multi-device driver stats -M total,md-0 include md-0 and total --part, --partition enable disk partition stats -P total,sdb2 include sdb2 and total -g, --page enable page stats -i, --int enable interrupt stats -I 9,CAL include int9 and function call interrupts -l, --load enable load stats -m, --mem enable memory stats -n, --net enable network stats -N eth1,total include eth1 and total -p, --proc enable process stats -r, --io enable io stats (I/O requests completed) -s, --swap enable swap stats -S swap1,total include swap1 and total -t, --time enable time/date output --time-adv enable time/date output (with milliseconds) -T, --epoch enable time counter (seconds since epoch) --epoch-adv enable time counter (milliseconds since epoch) -y, --sys enable system stats --aio enable aio stats --fs, --filesystem enable fs stats --ipc enable ipcstats --lock enable lockstats --raw enable rawstats --socket enable socketstats --tcp enable tcpstats --udp enable udpstats --unix enable unixstats --vm enable vmstats --vm-adv enable advanced vm stats --list list all available plugins --plugin enable external plugin by name, see --list -a, --all equals -cdngy (default) -f, --full automatically expand -C, -D, -I, -N and -S lists -v, --vmstat equals -pmgdsc -D total --bits force bits for values expressed in bytes --float force float values on screen --integer force integer values on screen --bw, --blackonwhite change colors for white background terminal --color force colors --nocolor disable colors --noheaders disable repetitive headers --noupdate disable intermediate updates --nomissed disable missed ticks warnings -o file, --output=file write CSV output to file
Using other options
The cdngy arguments (as you can tell from the output above) represent cpu, disk, network, paging and system stats. To display used and free memory with dstat, use a command like this:
$ dstat -s ---total--- used free 768k 3783M 768k 3783M 768k 3783M 768k 3783M 768k 3783M 768k 3783M
To display top CPU usages, you could use a command like this: