G (Geometric) and M (Machine) codes used in CNC ( Computer Numeric Control ) in Milling and Turning machines. These G and M codes are generally used in Fanuc controller series CNC Machines. The articles explains the most commonly used codes.
G – Geometric codes controls the movement of the tool holder or the tool. It provides linear as well as circular motion. Rapid movement is given by the code G00. T codes are also used to specify the tool number like T0202.
M – Machine codes control the movement of the spindle, head stock and the tail stock. For example M 06 code is used to switch on the coolant of the machine.
Follow the YTvideo for explanation : https://youtu.be/I1zeAr8sHLI