Linux command
ttyplot 命令
文本
涉及管道、覆盖或删除,执行前请先确认路径和参数。
常用示例
Plot
printf "1\n2\n3\n" | ttyplot
Example
printf "10\n20\n30\n" | ttyplot -t "Title" -u "ms"
Continuously
while true; do echo $RANDOM; sleep 1; done | ttyplot
Plot ping
ping 8.8.8.8 | sed -u 's/^.*time=//g; s/ ms//g' | ttyplot -t "Ping" -u ms
Monitor CPU usage
while true; do grep 'cpu ' /proc/stat | awk '{u=$2+$4; t=$2+$4+$5; printf "%.1f\n", u/t*100}'; sleep 1; done | ttyplot -t "CPU %" -u "%"
Example
command | ttyplot -2
说明
ttyplot is a real-time terminal plotting utility that reads numeric values from stdin and displays them as a scrolling graph in the terminal. It is useful for visualizing streaming data like network latency, CPU usage, or sensor readings.
参数
- -t TITLE
- Set the plot title
- -u UNIT
- Set the unit label for values
- -s SCALE
- Set the vertical scale (max value)
- -m MIN
- Set the minimum value
- -2
- Enable dual/two value plotting mode
- -c COLOR
- Set the plot color
- -e
- Exit when stdin closes
- -r
- Rate mode (values per second)
- -w WIDTH
- Set the plot width in characters
FAQ
What is the ttyplot command used for?
ttyplot is a real-time terminal plotting utility that reads numeric values from stdin and displays them as a scrolling graph in the terminal. It is useful for visualizing streaming data like network latency, CPU usage, or sensor readings.
How do I run a basic ttyplot example?
Run `printf "1\n2\n3\n" | ttyplot` in a terminal, then adjust file names, paths, flags, or remote targets for your system.
What does -t TITLE do in ttyplot?
Set the plot title