The radio will store a small amount of packets (around 30) in its memory for when it's not connected to a client app. If it's full, it will replace the oldest packets with newly incoming text messages only.
https://meshtastic.org/docs/overview/
And yes, they persist if you restart the node. Not sure what you mean by “terminal”, there are a couple of CLI tools for meshtastic, including a practically complete chat app.