There are many ways. I usually copy the raw video stream to a ffplay instance with the help of tee:
ffmpeg -hide_banner -loglevel error -f v4l2 -pixel_format yuyv422 -video_size 1280x960 -i /dev/video0 -c:v copy -f rawvideo - |\
tee >(ffplay -f rawvideo -pixel_format yuyv422 -video_size 1280x960 -) |\
ffmpeg -f rawvideo -pixel_format yuyv422 -video_size 1280x960 -i - -c:v libx264 -crf 21 -y /tmp/encoded.mp4
In case you want to see the raw input as well as the output, the example is a bit more convoluted:
ffmpeg -hide_banner -loglevel error -f v4l2 -pixel_format yuyv422 -video_size 640x480 -r 25 -i /dev/video0 -c:v copy -f rawvideo - | \
tee >(ffplay -hide_banner -loglevel error -window_title "Input" -f rawvideo -pixel_format yuyv422 -video_size 640x480 -) | \
ffmpeg -hide_banner -loglevel error -f rawvideo -pixel_format yuyv422 -video_size 640x480 -i - -c:v libx264 -crf 21 -f h264 - | \
tee >(ffplay -hide_banner -loglevel error -window_title "Encoded" -f h264 -) | \
ffmpeg -f h264 -r 25 -i - -y /tmp/encoded.mp4
Be sure to specify matching pixel formats, resolutions and frame-rates.