Shooting a gun on the moon is no different than shooting one here on earth, with the exception that the bullet will travel much further, and maintaining balance a lot more difficult.
If you look at a bullet, it appears as an enclosed capsule with the actual bullet protruding from one end. This is filled with a high explosive which is ignited by the gun hammer. This explosive contains enough oxidant that it does not require oxygen from an atmosphere. When placed within the firing chamber of a gun, and struck, the explosive creates a very high pressure gas that pushes the bullet down the barrel, and out of the mussel.
On the moon, there is no atmosphere, so the explosive gas, in effect, has an easier job to push the bullet out. This means that it will reach a higher velocity with the same barrel length. On exiting the mussel, the bullet will stop accelerating, and with no air resisting its motion, it will continue at the same speed – if fired horizontally (in fact it will accelerate slightly as it arches down). Despite the lack of atmosphere, the bullet is unlikely to reach escape velocity even with a high powered rifle, so regardless of what angle the gun is fired, the bullet will hit the lunar surface at some point.
Initially, I thought that the recoil would be greater, after all the bullet travels faster. However, on further thought, this would not be the case, as the impulse from the cartridge is no different. Despite this the recoil will be more difficult to control. On earth, your body is prevented from being forced backward by your weight and friction between your feet and the ground. On the moon, you weight much less (even though your mass is the same), so maintaining balance is more difficult – think of the films of the astronauts doing simple things, and the difficulties they had.
The other problem with shooting a gun on the moon revolves around the space suits needed for an astronaut to survive. Placing a bullet into a chamber would be imposible with the type of gloves needed, let alone pulling the trigger. This means a weapon would need to be loaded into the chamber whilst in a lunar lander, the acidental discharge of which would almost certainly prematurely end any mission. If all went well and the astronaut was in a position to fire, aiming the weapon through a helmet and visor would be hit and miss at best!