The length of time a cough lasts depends on the reason for your cough.
1. If you have a viral infection such as a cold or the flu, the resultant cough should only last for 5 days or so. If it lingers for a longer period of time, it is likely that you may have a bacterial infection complicating the infection
2. Coughs can be caused by allergies such as that to dust, pollution and animal fur. In this case, the cough should come and go, depending on when you are exposed to the allergen and also, be worse during exercise or at night.
3. A variety of lung conditions can lead to coughs. These can be acute such as pneumonia (a lung infection), or TB, or bronchitis. The list is large and in general, the cough will last as long as the condition exists. Of course, some chest conditions cannot be completely cured so you may find that the cough becomes chronic.