The metal strips that hold down the edges of carpets in doorways and along transitions to other types of flooring, such as hardwood, are called gripper strips, and they're important for safety as well as the carpet's appearance. Without them, the edges of the carpet would quickly start fraying, and the loose edges would trip someone up sooner or later. With a series of inclined points, they function much like the tackless strips that hold the carpet against the walls. If you're replacing your carpeting or just need to replace worn grippers, installing new grippers is fairly unchallenging.
Install the carpet across the doorway or flooring transition and and use a knee kicker to stretch it onto the tackless strips against the wall so that the edge of the carpet is where you want it to be.
Draw a line along the edge of the carpet onto the subfloor with a felt pen. Fold the carpet back about four inches to give you room to place the gripper strip.You may need to pull part of it off the tackless strips along the wall to do this.
Measure the length of the transition with a tape measure. Cut a piece of metal gripper strip to this length with a hacksaw.
Set the gripper strip on the floor so that its closed edge is flush with the line and the tacks are facing the carpet. Nail it to the subfloor with 1-inch spiral-shank nails. These are usually supplied with the strip.
Fold the carpet back down and force the edge under the top of the metal strip with a carpet tool or a stiff putty knife. The carpet will catch on the tacks as you do this. Reset any carpet you pulled away from the wall in the same way, using the tool to force it under the baseboard.