让 Linux grep 的输出不换行

在Redhat中亲测。

本来ps -ef的输出是不会换行的,但是 ps -ef | grep java 就换行了。

如果想让grep完的结果不要换行,找到两种方法。

 

1. 在后面拼接 less -S:

ps -ef | grep java | less -S

 

2. 使用 tput   

tput rmam  # 关闭换行

tput smam  # 打开换行

 

posted @ 2018-11-12 17:45  Pekkle  阅读(6965)  评论(0编辑  收藏  举报