How different is the G-code between Mach and LinuxCNC? What are the main differences?
Basically, you should consider the g-code for Mach4 and LinuxCNC to be incompatible and under no circumstances run programs from one machine on the other.
Although simple code from a simple postprocessor will be executed correctly on both machines, this should be considered the exception, not the rule.
In extreme cases, running a foreign code will result in damage to the machine or injury to the operator, because there are codes that are written identically but executed differently. Such code will not generate an error, only unexpected movement.