Environment:
RedHat
Originally, the output of ps -ef will not wrap lines, but ps -ef | grep java will change the line.
If you want the grep results to not have new lines, there are two methods.
Solution:
(1) Splice less -S:
ps -ef | grep java | less -S
(2) Use tput
tput rmam # 关闭换行 tput smam # 打开换行
Recommended tutorial: Linux tutorial
The above is the detailed content of What are the methods to prevent the output of linux grep from breaking new lines?. For more information, please follow other related articles on the PHP Chinese website!