xpt*_*xpt 1 linux terminal command-line ubuntu
通常当在terminal/console/xterm中输出长行时,它们会自动换行。然而,也有一些情况并非如此。ps就是这样的情况之一——它在窗口宽度处截断输出。
ps ax | grep [d]nsmasq
4459 ? S 0:03 /usr/sbin/dnsmasq -x /run/dnsmasq/dnsmasq.pid -u dnsm
Run Code Online (Sandbox Code Playgroud)
对于dnsmasq,即使我最大化我的 xterm,输出仍然被削减。
我试过了,
$ ps ax | fold | grep [d]nsmasq
4459 ? S 0:03 /usr/sbin/dnsmasq -x /run/dnsmasq/dnsmasq.pid -u dnsm
$ ps ax | grep [d]nsmasq | fold
4459 ? S 0:03 /usr/sbin/dnsmasq -x /run/dnsmasq/dnsmasq.pid -u dnsm
$ ps ax | grep [d]nsmasq | fold --spaces
4459 ? S 0:03 /usr/sbin/dnsmasq -x /run/dnsmasq/dnsmasq.pid -u dnsm
Run Code Online (Sandbox Code Playgroud)
这样的切割看起来ps像是没有写入标准输出,但它的响应证明grep事实并非如此。但为什么fold不工作呢?
如何包裹这么长的线来显示所有内容而不是切割到窗口的宽度?
| 归档时间: |
|
| 查看次数: |
5060 次 |
| 最近记录: |