As described here (ubuntuhandbook.org – Boot into text console ubuntu) you need to edit /etc/default/grub to have the next boot end up in text mode. In summary you will set these parameters:

GRUB_CMDLINE_LINUX_DEFAULT="text"
GRUB_TERMINAL=console

After saving changes you need to run:

sudo update-grub
sudo systemctl set-default multi-user.target

Undoing text-mode

To undo sudo systemctl set-default multi-user.target simply type

sudo systemctl set-default graphical.target