There’s multiple ways to achieve the same:
Use a command like:
arecord -D hw:pisound -c 2 -r 48000 -f S16_LE | tee recording.wav | aplay -D hw:pisound -
or use Audacity for graphical user interface (latest version(s) are known to have an issue when recording and playing back at the same time: Audacity and New Mono Track Recording with Monitoring?)
or use MODEP image, connect the left and the right sockets directly, ssh to it and use sudo jack_capture
to record to file.
or use some alternative audio recording software on Linux.