To set the sticky bit on a directory in Unix-based systems, you can use the chmod command followed by the octal representation 1 as the third digit. For example, to set the sticky bit on a directory named "shared", you would use the command chmod +t shared.