Deductions & credits

My question is about capital gains taxes.  What are the rules when you buy real estate for one price and sell for a higher price.  How long must you live there to avoid or decrease taxes - Is the entire amount of gain taxable? I think speaking with someone would be helpful - Thank you