How long does a shifter, rear mech and front mech last? I am talking about absolutely dirt cheap components which are non-branded. In terms of number of kilometres how long do they last? The bicycle is ridden on city and country roads and maintained regularly.
As the comments have stated, wear is going to depend on a variety of factors. If you maintain your equipment it can last for years. Generally speaking, parts will fail in order of material strength and usage. Jockey wheels on the rear derailleur become rounded as they are made of synthetic materials such as plastic that wear much quicker than metal. Next up are the cables and hoses connecting everything (technically you didn't ask about this, but they run into all the parts). Fine parts, such as the springs/tensioners in the derailleurs will also be susceptible to mud and grime much faster than the stainless cages. A shifter would probably be the last to go as it's action is fairly well contained within the shifter assembly and isn't really prone to wearing out as quickly.

Another important consideration is setup. If the cables are too tight or there's a misalignment and something is rubbing, it's obviously going to wear much quicker. If you follow the manufacturer's recommended maintenance schedule and regularly clean all the parts after riding in the rain, mud, or dust, you should be able to enjoy a long life on even bargain bin parts!