Gravity is a force which gives us weight. This force generates when an object attracts other object. This force depends on the mass and the distance between the objects- it is proportional to the multiplication of the masses of the objects and inversely proportional to square of the distance between them.
When someone is on earth, earth pulls him towards itself and he also pulls earth towards himself with the same force. This is also true for every object. When we are on earth, we feel the gravitational force. It keeps us standing on earth but in space, there is no gravitational force.
According to Newton’s third law of motion, every action has an equal reaction. That reaction applies in the opposite directions. When a gun is shot, bullet goes out of the barrel of the gun and the gun also faces deflationary force. It moves in the opposite direction. This is the reason that one, who pulls trigger of a gun, also feels a strong shock.
If a gun is pulled in the space where nothing, including dust, is available to slow down the speed of the bullet, the bullet will keep moving for eternity till it collides to something or slowed down by dust particles, etc. It may be attracted by some comparatively small object which may make it to revolve around that object like a satellite. Also, the person who pulls trigger will move in the opposite direction on account of Newton’s third law of motion. However, he will move very slow compared to the speed of the bullet because of his large mass. This law can be expressed in this equation-m1v1=m2v2. Where m1 and m2 are the mass of the objects and v1, v2 are their velocities in the opposite direction.
One may think that there is no oxygen in space so how can one fire a gun there? But, it is possible to fire a gun in space. Modern guns have their own mechanism which can make it possible. Smoke of the gun will not go around the gun but will move in a straight line and follow the bullet.