On ubuntu20.04,an issue where xrandr cannot be used to set up a dual screen mirror display after closing the graphical interface

Hi, I’m new to linux. My development environment is ubuntu20.04, the graphics card is 4070ti, and I have configured the driver. After I closed the desktop graphics program and started my application directly at boot time, I found that I couldn’t configure the monitors properly when I connected the two monitors. I wanted the two monitors to mirror each other. When I want to use xrandr, I can’t set it up because the x service has been turned off. Excuse me, how can I solve this problem?