Raspberry Pi send gcodes direct from ssh shell to system at running print

Hi,

I have the following considerations and would like to implement them with ssh from the shell and also not with a plugin for the WEB frontend.

If I am directly on my Octoprint Pi with (ssh connection) I would like to transfer a GCODE control command to the running system while it is printing.

I would like to achieve the same thing as via the web frontend only as an entry with ssh.

In which file do I have to write my control command so that it is recorded in the current G-CODE that is currently being printed?

Or does anyone have a simpler solution from the shell?

Greetings Raini

Using the REST API is probably your best option, specifically Printer operations to send your commands.