How do I change the DPI settings in terminal?

To change the Font DPI in the terminal (default is 1.0)

gsettings set org.gnome.desktop.interface text-scaling-factor 1.0

If you are talking about changing the screen DPI then you can follow the directions for:

How to find and change the screen DPI?