How do I get a bash script to run in full screen when it's executed or how can I change the terminal size if I can't make it full screen?


"Fullscreen" isn't a bash concept at all, it's down to your terminal emulator window and X.

However if you're scripting, you can tell X to add a fullscreen hint to a client. I most applications this will work. I've tested with Terminator and I've no reason to suspect it won't work with Gnome Terminal:

# set fullscreen on startup
wmctrl -r :ACTIVE: -b add,fullscreen

# ... do your stuff ...

# and before you quit
wmctrl -r :ACTIVE: -b remove,fullscreen

With regard to keeping this at a minimum footprint, the only way I've found to do this is to launch another terminal. Unfortunately lxterminal doesn't have a fullscreen launch option so you could either hack through the OpenBox settings (beurgh) or just fall back to xterm:

xterm -fullscreen -hold -e ./anotherscript.sh

Yeah, I'm suggesting launching another terminal. If you're shipping this with a launcher of sorts, you can avoid needing a secondary script.

xterm doesn't adhere to standard fonts or anything like that though you can configure almost everything through command line arguments (see man xterm for a riveting read).

| improve this answer | |
  • I appreciate it but wmctrl isn't on Lubuntu – Roboman1723 Jun 10 '14 at 19:31
  • Is installing it (sudo apt-get install wmctrl) too much? – Oli Jun 10 '14 at 19:34
  • Ha no but I'm sending this script to many people on different distros on Linux and I just want it to work right out of the gate. – Roboman1723 Jun 10 '14 at 19:43
  • That's understandable. It's adding more work for you but you could package it into a .deb that depended on the wmctrl package. That would also save on people putting it in the wrong places (and needing to set permissions). Might be less work in the long run. – Oli Jun 10 '14 at 19:47
  • 1
    @Roboman1723 there is no terminal/tty agnostic way to force a fullscreen because the shell must be aware of the terminal properties, which is what wmctrl does, it is best to stick to a tool that is compatible with the largest amount of window managers and require/suggest your users to use it as a dependency, wmctrl is not ubuntu specific, and works with a large number of WM/DE's (it works with KDE,Gnome/unity Gnome/metacity, L/XFCE, etc. and is available as a package on Fedora, CentOS, Ubuntu, Debian, Arch, Gentoo, Slackware, and RHEL among others. – crasic Jun 10 '14 at 21:26

Press F11 to make the terminal full screen. If you always want it full screen, you need to edit the .desktop file:

Create a new file, via gedit or similar in /.local/share/applications. Call it fsterminal.desktop

[Desktop Entry]
Name=Full Screen Terminal
Comment=Open Terminal full screen
Exec=gnome-terminal --full-screen
| improve this answer | |
  • Is there a way to force terminal to run full screen in a script? – Roboman1723 Jun 10 '14 at 18:51
  • So you are running a script, and it opens gnome-terminal? Yeah, add the options --full-screen – Tim Jun 10 '14 at 18:53
  • I saw that and put it in like this: gnome-terminal --full-screen It still doesn't launch full screen – Roboman1723 Jun 10 '14 at 19:00
  • Does it from terminal (i.e. if you open one then run gnome-terminal --full-screen does it open in in full screen mode? – Tim Jun 10 '14 at 19:03
  • 1
    @Roboman1723 Lubuntu normally uses LXTerminal. – TuKsn Jun 11 '14 at 9:27

You can try if xterm escape sequences work for your terminal, e.g.

  • echo -ne "\e[8;XXX;YYYt" resizes terminal to show XXX columns and YYY rows
  • echo -ne "\e[9;1t" maximizes the terminal window (doesn't work for me)
  • ...

On my ubuntu 14.04 machine running unity, echo -ne "\e[8;200;200" resizes the terminal beyond screen edges effectively maximizing the window.

| improve this answer | |
  • Didn't seem to work on Lubuntu, thank you though. – Roboman1723 Jun 10 '14 at 19:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.