I had a friend call asking for advice on a plumbing issue. He was relocating a washing machine and he needed to secure the piping to a masonry wall.
The easiest way is to use pipe straps or hangers. These are small clamp-like mechanisms that come in various sizes to match the diameter of the pipe being secured. They will come with one or two holes and you simply place the strap over the pipe and screw it into the wall. With wood or drywall surfaces it is easy, but masonry makes for a more time-consuming job. You will need to place the strap where you want it, mark the hole location(s) and pre-drill a hole. You can use masonry screws or tapcon bolts. Basically, you will use the appropriate sized drill bit, drill the hole, and then place the strap back over the hole location and install a screw there.
You will want to place enough straps so that the piping is held securely to the wall. Washing machines can produce water hammer via the electric valves quickly closing shut. You want to minimize the potential by strapping the piping any time the pipe changes direction and along the length of the run.