Pipe #
Output logs both into a file and terminal #
When building using maven, specifying the --log-file flag or using > to redirect the output inhibits the output to terminal. As a workaround, use tee.
mvn install | tee log.txt
For another solution using less +F, also see
this answer.
Xargs with placeholder #
Use -I{} flag and the curly braces which needs to be replaced. For example, in order to put the output from the last command between quotes, use the following command.
tail -n 20 | xargs jdnotify -m "{}"