For a machine, either daisy chain it, or put it in a mesh bag, then use a soft laundry soap like Woolite. Use warm water, not hot.
By hand, as you say, in a bathtub or my preference, in a utility sink (washing by hand is a long, physical process, and doing it on your knees sux
). Warm water. Woolite is still a good choice. You have to work every stinkin' inch of the rope through your hands, over and over. Then the rinse, which requires even more attention to detail, squeezing repeatedly refreshened clean water through the rope.
Now if you have pitch issues, it takes application of a petroleum based hand cleaner like Goop or equivalent to the affected areas. Never use one with a pumice component. Complete rinse is vital...either by hand (more intense labor) or in the machine just by pushing a button
.
To dry, hang the rope loosly over rounded surfaces (i.e. not nails driven into a wall) in a dark, middle temperature environment (say 55 to 75 degrees is good) until it's dry to the touch, ideally. Of course, you can climb on a wet rope, but it gets dirty much easier and faster than a dry rope will.