Issues with direct g-code transmission via serial port Model of the printer is unknown, got it as present, probably something generic cartesian on arduino mega and ramps boards stitched together and with marlin firmware.

I've used accepted answer from here to try moving this thing from terminal.
How to directly send G-code to printer from a Linux terminal?

My first attempt to get access to low-level printer interface looked like that: 

./baud.py &lt;&gt; /dev/ttyACM0 250000
tail -f /dev/ttyACM0 &amp;
cat &gt; /dev/ttyACM0


First it was fine: i've entered g-code, printer executed it and returned an ok message into my terminal.

Then i've turned the printer off and on again and repeated the whole process, but now tail -f didn't output anything and printer LCD displayed garbage in the status line after I ran the command.

I've also noticed that printer controller reboots every time the serial port is accessed, not sure if it happened in the first time when everything worked well.

The output of cat /dev/ttyACM0 after baud setting is a bit weird too - and there's garbage in the status line instead of standard "%printername% ready" as well:

start
echo:Marlin1.0.0
echo: Last Updated: May 20 2017 18:12:04 | Author: (none, default config)
Compiled: May 20 2017
echo: Free Memory: 3763  PlannerBufferBytes: 1232
echo:Hardcoded Default Settings Loaded
echo:Steps per unit:
echo:  M92 X80.00 Y80.00 Z3200.00 E97.94
echo:Maximum feedrates (mm/s):
echo:  M203 X50.00 Y50.00 Z2.50 E25.00
echo:Maximum Acceleration (mm/s2):
echo:  M201 X750 Y750 Z100 E10000
echo:Acceleration: S=acceleration, T=retract acceleration
echo:  M204 S500.00 T500.00
echo:Advanced variables: S=Min feedrate (mm/s), T=Min travel feedrate (mm/s), B=minimum segment time (ms), X=maximum XY jerk (mm/s),  Z=maximum Z jerk (mm/s),  E=maximum E jerk (mm/s)
echo:  M205 S0.00 T0.00 B20000 X20.00 Z1.00 E5.00
echo:Home offset (mm):
echo:  M206 X0.00 Y0.00 Z0.00
echo:PID settings:
echo:   M301 P22.20 I1.08 D114.00
echo:SD init fail
echo:Unknown command: "starto"
ok
echo:Unknown command: "SD init failstartuthor"
ok
echo:Unknown command: " (none, default config)50.00 Z2.50 E2rBy00.00 Y0.00 Z0.00echo"
ok
echo:Unknown command: "Unknown command"
ok
echo:Unknown command: " "starto"own comm"
ok
echo:Unknown command: "aximum XY jerk (mm/s),  Z=maximum Z jerk (mm/s),  E=maximum E jerk (mm/s)echo"
ok
echo:Unknown command: "PID settings"
ok
echo:Unknown command: "okechecho"
ok


The "SD init fail" line and everything after it appears when sensor data appears on the LCD, there's a delay before that during which the LCD is empty.

If you send commands to printer using something like echo "G0 X10" &gt; /dev/ttyACM0, it executes them only on next serial port accessing (and therefore reboot) - or doesn't execute at all.

The interesting part is that Cura "Monitor" tab can actually manipulate the caret and the Cura itself can print things in general - but i want to be able to do it manually.
Mine is a wild guess, but judging from:

echo:Unknown command: "starto"
ok
echo:Unknown command: "SD init failstartuthor"
ok
echo:Unknown command: " (none, default config)50.00 Z2.50 E2rBy00.00 Y0.00 Z0.00echo"
ok
echo:Unknown command: "Unknown command"
ok
echo:Unknown command: " "starto"own comm"
ok
echo:Unknown command: "aximum XY jerk (mm/s),  Z=maximum Z jerk (mm/s),  E=maximum E jerk (mm/s)echo"
ok
echo:Unknown command: "PID settings"
ok


It looks like you may be looping back the output of your printer as an input to itself.  I am very suspicious of your line: tail -f /dev/ttyACM0 &amp; as that seems to indicate your are trying to perform other actions in the same terminal window after you started to monitor the serial connection.

If this is the case, you should definitively open the monitor in a separate terminal (tail -f /dev/ttyACM0) and feed the input in a different one (note that yo must not use the final &amp;).

Finally, you probably want to use cat &gt;&gt; /dev/ttyACM0 instead of cat &gt; /dev/ttyACM0 as you want to append your commands without truncating the existing stream.