First, pick a word or phrase that will be your command to stop barking. Suggestions can be: “Quiet!”, “Enough!”, “No Bark!”, “Hush!”
Never use “Shut Up!”, its better to use “No”.
Set up for barking, and have a leash on the dog. When the barking happens, take the leash (step on the leash if you have to “catch” the dog or just have the leash in your hand to start!), give a firm tug horizontally to the floor and firmly use your word.
When the dog is quiet, calmly & quietly praise (“GOOD quiet”). Sometimes a tiny soft-moist treat can reinforce your praise (brought down to the dog’s level).
If the pop on the leash doesn’t help, you can incorporate a squirt bottle into the equation. Give a sharp series of squirts right in the face, firm command to quiet, and, for extra measure, have the dog SIT. Your correction should only be as firm as it needs to be. You can also use a small “shaker container”. Do not use these tools to threaten.
Teach a command for “guard barking” – my command is “Who’s there?” My dogs will run to the door and bark. Tell them “Good who’s there!” and then use a quiet command to tell them that is enough. Use this to get dogs to respond to the doorbell or knock.
Although you have no way to correct barking when you are not home, you may want to leave a tape recorder or video camera on to see when barking happens, what causes the barking and the duration of the barking. Guard barking, for example, is handled a little differently than lonely or random barking.
Barking is a normal dog behavior. In excess, it can be irritating. If controlled, barking can be useful!