Linux watch + PostgreSQL 一行命令实现数据每秒实时监控
PostgreSQL Linux psql About 356 words相关命令
Linux
中的watch
PostgreSQL
的psql
命令
watch -n
指定间隔执行命令的秒数。
psql -U
指定使用哪个数据库的用户。
psql -d
指定连接哪个数据库。
psql -c
指定需要执行的命令。
watch -n 5 "psql -U postgres -d rights -c 'select count(*) from test;'"
报错
注意:watch
执行的命令外层需要加""
双引号,否则会报以下错误。
sh: -c: line 0: syntax error near unexpected token `('
sh: -c: line 0: `psql -U postgres -d rights -c select count(*) from test;'
Views: 58 · Posted: 2025-10-01
————        END        ————
Give me a Star, Thanks:)
https://github.com/fendoudebb/LiteNote扫描下方二维码关注公众号和小程序↓↓↓

Loading...