By PolskiBus bus it takes 9:30 hours and costs 15-26 EUR (62-109 PLN), depending if you buy in advance. It leaves ~3 times a day, isn't very comfortable.
Direct Euro InterCity train takes around 5 hours and costs around 54 EUR (230 PLN) for second class, around twice as much as the bus. You can check the routes and prices on Polish railways website.
You can also go by BlaBlaCar, it should take 6-7 hours.