linux/Unix tools for multiline grep

grep -A 2 SearchString # find and return SearchString and the two lines after the line that matches
grep -B 3 SearchString # find and return SearchString and the three lines before the line that matches

also,
pcregrep
pcregrep -M ‘a\nb’ files…

redirecting standard error (stderr) and standard output (stdout) to a file

Capturing both errors and normal list output from ls, with “long” and recursive options set,  to a file called /tmp/allout :

ls -lR > /tmp/allout 2>&1