How run Flex in the background and access to particle states while doing a physics simulation?

Hi. I’m pretty new to Flex and apologize if my question can be answered easily. I just complied Flex on Ubuntu and wonder, how can I run Flex in the background without a UI and only through command line? My goal, eventually, is to get access to the state of the particles for different objects in the scene while doing some physics simulation (with some granularity) and store them on disk. Would appreciate if someone can tell me how I can do that