As demonstrated by this script you can turn off laptop screen:
To discover the power setting for your laptop display use:
$ ls /sys/class/backlight/*/bl_power
/sys/class/backlight/intel_backlight/bl_power
On my laptop the driver name is intel_backlight
Move your terminal window to your external screen and turn off your laptop display with:
echo 4 | sudo tee /sys/class/backlight/intel_backlight/bl_power
or a shorter version without specifying the name should work for all laptops:
echo 4 | sudo tee /sys/class/backlight/*/bl_power
To turn the screen back on:
echo 0 | sudo tee /sys/class/backlight/*/bl_power
You can also get a list of your monitors for xrandr
software control:
$ xrandr | grep " connected"
HDMI-0 connected 1920x1080+0+0 (normal left inverted right x axis y axis) 1107mm x 623mm
eDP-1-1 connected primary 1920x1080+3840+2160 (normal left inverted right x axis y axis) 382mm x 215mm
DP-1-1 connected 3840x2160+1920+0 (normal left inverted right x axis y axis) 1600mm x 900mm
xrandr
allows you to turn off a screen but then all windows will move to the screen that is left turned on which is what you don't want.