I've read a few articles that say that astronauts have already brought guns in space and that shooting bullets in space is possible.
But won't the recoil of the gun be too strong?
Law of conservation of momentum:
$m_{gun}v_{gun}=m_{bullet}v_{bullet}$
$v_{gun}=\dfrac{m_{bullet}}{m_{gun}}v_{bullet}$
I've found some values on Google:
$m_{bullet}=0.03$ kg
$m_{gun}=1$ kg
$v_{bullet}=800$ m.s$^{-1}$
And therefore we get:
$v_{gun}=24$ m/s
$v_{gun}=87$ km/h
$v_{gun}=54$ mph
That's the typical speed of a car on a freeway.
It's an uncontrollable recoil.
The gun would be pushed back so powerfully that it would very probably damage the astronaut's spacesuit and kill him.
But Russian Soyuz capsules wouldn't carry firearms if using them would lead to an instantaneous death for their own user. So I must be missing something.
Still even if the astronaut could somehow hold extremely tightly to his gun and absorb all the momentum, he would still be ejected at a speed of around $1.5$ km/h $=$ $1$ mph (and maybe he'll even get stuck spinning for a while like in the movie Gravity), which would make guns not very effective in space since it would take time to find a way to re-stabilize yourself and re-aim in order to fire a second bullet.
Note: I know nothing about guns (I don't live in the US), so forgive me if I missed something obvious.