Short answer is yes. But you have to be prepared (willing and able) to kill them all, including woman and children).
Before you say we could never do that, look back at WWII. We were carpet bombing cities. We were in fact willing and able to kill civilians, men, women and children. As harsh as this was, it ended the war.
Since then we have fought wars in half measures trying to spare the “innocents”. The harsh truth is there are no innocents when two nations go to war. The men fighting on the front line would not be able to fight without the support of the people behind them.
This is also true in a guerrilla war. Without the people’s support they would not be able to fight for long.
To win a war you need to break the will of your enemy to resist. One way to do that is by killing their families.
Terrorism will continue as long as they know their families are safe from reprisals.
World War II was the last war the U.S. fought as a sovereign nation against other sovereign nations.
Since World War II, every U.S. military conflict has involved the U.S. as a global empire building and maintaining its foothold in other countries. That's why these military campaigns were fought using "half measures." You can lay waste to an enemy nation and leave it as a smoking ruins if you are fighting for the survival of your country, but that approach is pointless and completely defeats the purpose when the aim of your military campaign is to defeat your enemy so you can do business with him.