Is there a terminal command that changes the terminal window dimensions?

Yes. resize -s <rows> <columns> works with Ubuntu's default terminal application (gnome-terminal).

How to resize the terminal until a program is finished

To get a nice effect of having, say, vim in a specially-sized window only while it's running:

  1. mkdir ~/bin
  2. ~/.profile by default adds ~/bin to the PATH; For now, you can either source ~/.profile or declare the new PATH yourself: export PATH="$PATH":~/bin
  3. vim ~/bin/vim
  4. Add the following:

    #!/bin/bash
    
    source <(/usr/bin/resize -s)
    /usr/bin/resize -s 38 120
    /usr/bin/vim "$@"
    /usr/bin/resize -s $LINES $COLUMNS
    
  5. Save

  6. chmod +x ~/bin/vim

Now vim will run at size 120×38 and the resizing will be undone when vim finishes.


In Ubuntu 16.10 (and maybe older versions too), if you open a terminal window, and go to the Terminal menu, you can select alternate window sizes directly. In fact, almost exactly the sizes that you are asking for!

Also, F11 will toggle full screen mode.

You can also create multiple profiles that set the screen to exactly the size(s) that you want. Go to the File menu and choose New Profile... call it "My editing profile". Then, when you want to change to a different profile, go to the Terminal menu and choose Change Profile. Then go to the Edit menu and choose Profile Perferences. Set your custom screen size there. Different profiles, each with different screen sizes!