If you are not allergic, you can eat peanuts with a cold and cough, but you need to avoid getting a foreign body stuck in your throat.
Peanuts are mainly composed of proteins and fats, and do not contain substances that irritate the throat or aggravate coughing, so you can eat peanuts even during a cold or cough without affecting the course of the cold.
However, care should be taken to avoid foreign bodies getting stuck in the throat. Especially if you eat peanuts when you have a cough, the peanuts can go down the mouth into the trachea or esophagus, and in severe cases may even cause choking.
Therefore, you can eat peanuts normally if you have a cold and cough, and avoid getting a foreign body stuck in your throat.