The regular teacher can't always be in the classroom. Sickness, personal leave days or teacher training days are always going to come up. That's what makes a substitute teacher so valuable. Learn to be an excellent sub who maintains order and you'll be highly sought after.
Learn the names of your students. This isn't always easy, especially when you change from class to class daily. Kids know that when you make eye contact with them and call them by name, you in control.
Start the day with a friendly smile and a "Good morning." Write your name on the board if it's the first day with this class. Let them get familiar with you and always remember that you should set the tone. You'll have a better chance of keeping control of your class as a substitute teacher if you start the day off on a positive note.
Keep the students busy. Teachers usually have work mapped out for a substitute to implement. Lesson plans and materials are usually set. Have work ready if there's not enough planned. Looking up word definitions, drawing pictures of what the class has studied and reading out loud are all good fill-ins. Classes often get out of control simply because the students are bored.
Be strict in expecting the class to follow the rules, but be nice in the process. Resist the urge to raise your voice when students start to act up. Yelling rarely helps and often just escalates the problem. Let the students know that you care about them and want them to have a good day. At the same time, let him know that you will call the principal if necessary. Tell her that there are consequences for bad behavior, even with a substitute teacher.
It often helps to remind the students that the regular teacher will eventually be back. Then there may be additional consequences to face.