Using wmctrl to toggle full screen mode of the active window from the terminal in Linux.
The tool you want for this is
wmctrl, it’s a command that lets you interact
with an X Window manager and you’ll probably find it’s already installed.
wmctrl -r ':ACTIVE:' -b toggle,fullscreen
-r specifies a target window for an action to apply our action to.
:ACTIVE is the name of the target window. We’re using a special name here
which targets whatever window is currently active, but you can specify any
window here too (hint: use
wmctrl -l to list all available windows).
-b lets us manipulate the window properties of the chosen window. You can
either add, remove, or toggle up to 2 properties simultaneously. Why 2? Because
some actions (such as maximising a window) are made up of 2 shell command line
toggle,fullscreen are the 1st and 2nd property required by the
-b action to
put you in full screen mode.