See the command telinit:
$ man telinit
telinit may be used to change the runlevel of the system.
The RUNLEVEL argument should be one of the multi-user runlevels 2-5, 0
to halt the system, 6 to reboot the system or 1 to bring the system
down into single-user mode.
RUNLEVEL may also be S or s which will place the system directly into
single-user mode without actually stopping processes first, you proba‐
bly won’t want that.
So, in short:
$ sudo telinit 1 # Recommended
$ sudo telinit S