技术解析

运行 systemctl status 或 service status 后如何不等待输入 / 输出。
0
2021-06-17 19:34:39
idczone

在使用 sudo systemctl status ***sudo service *** status 这样的命令时,打印出来的通常都会处于等待输入或输出的状态,类似这样:

● nginx.service - The NGINX HTTP and reverse proxy server
   Loaded: loaded (/etc/systemd/system/nginx.service; enabled; vendor preset: enabled)
   Active: active (running) since Tue 2020-03-31 18:38:55 CST; 4 days ago
 Main PID: 23306 (nginx)
    Tasks: 4 (limit: 1078)
   Memory: 11.3M
   CGroup: /system.slice/nginx.service
           ├─23306 nginx: master process /etc/nginx/sbin/nginx -c /etc/nginx/conf/nginx.conf
           ├─23307 nginx: worker process
           ├─23308 nginx: worker process
           └─23309 nginx: worker process

Mar 31 18:38:55 vps systemd[1]: Starting The NGINX HTTP and reverse proxy server...
Mar 31 18:38:55 vps nginx[23304]: nginx: the configuration file /etc/nginx/conf/nginx.conf syntax i
Mar 31 18:38:55 vps nginx[23304]: nginx: configuration file /etc/nginx/conf/nginx.conf test is succ
Mar 31 18:38:55 vps systemd[1]: nginx.service: Failed to parse PID from file /etc/nginx/logs/nginx.
Mar 31 18:38:55 vps systemd[1]: Started The NGINX HTTP and reverse proxy server.

然后终端一直在等待输出的状态(不知道怎么形容),需要按 q 才能退出(也不知道怎么形容普通的模式叫啥,有没有老铁科普下?),我的系统是 Ubuntu 19.10 。

请问有能一次输出不需要按任何键才能退出的方法吗?看过 help 貌似没有一次性输出这种参数。


--no-pager
Do not pipe output into a pager.

感谢
数据地带为您的网站提供全球顶级IDC资源
在线咨询
专属客服