For how long did World War 1 soldiers live in trenches?

soldiers lived in trenches for the whole war but they would take turns in each kind such as the front line and back at the back line.