Inject a newline in a linux command’s output to improve readability.

(for posterity, ’cause I always forget…)

  • Add alias:
alias nl="sed 'N;s/\n/\n\n/'"
  • Enjoy! For e.g.
ps -ef | grep -i username | nl

This injects an extra newline after every newline in the command’s output. Makes it much easier to read verbose output such as searching for java server processes (glassfish, WL) which have really long command lines.

Leave a comment