trapped gas how to relive it

I know I have trapped gas as I can feel it in my back... also have stabbing pain the side of my right rib can you get trapped gas there also how do I relieve it