17

I installed ubuntu from the minimalcd because I just want to use vim and command line tools.

However I would like more than 80 columns of text. I have a large monitor so I would like at least a couple hundred columns so I can split panes in vim and have several windows open.

BTW ubuntu is installed as a VMWare Player VM. I have already verified that the VM settings are for a large monitor; it seems that my ubuntu setup is at issue.

4 Answers4

11

The following command:

docker exec -e COLUMNS="`tput cols`" -e LINES="`tput lines`" -ti container bash

works under most, if not all circumstances.

Fabby
  • 34,259
  • 1
    Welcome to Ask Ubuntu! ;-) Although your answer made me smile, it's better this way. If you still want to add "like a boss", put it in parentheses at the end of above. Just press [edit] to edit your answer if you want to... (also +1 for a very good first answer) – Fabby Jun 28 '18 at 13:29
  • I am not convinced that the dockercommand will work for a WM-PLAYER installation. – Soren A Jun 28 '18 at 13:42
  • 1
    I like to add sassiness, thats just what I do :D @Fabby – Dusan Gligoric Jun 28 '18 at 13:44
  • Try it out and tell us how it went, I dont have that environment unfortunately! :) @SorenA – Dusan Gligoric Jun 28 '18 at 13:45
7

The variable $COLUMNS specifies how wide the terminal session is; so running COLUMNS=200 would make it 200 columns wide.

If you wanted to change that permanently you should put this in your ~/.bashrc file which is run every time you start a terminal.

jackweirdy
  • 3,440
  • 2
    I added COLUMNS=200 to ~/.bashrc, then logged out and back in, but it didn't seem to help. I should point out that I don't even install any kind of graphical desktop, since I wanted it totally lean b/c it's in a VM on a laptop that's a few years old. That's why I went with ubuntu minimal. So it seems that the terminal is already started before I even have a chance to login and run my .bashrc... – Kevin Pauli Nov 20 '12 at 00:19
  • In that case, it's likely that the width is determined by the getty program, which creates the command line interface you see on ubuntu minimal & server; I'll have a look into it – jackweirdy Nov 20 '12 at 13:20
  • Thanks, I appreciate it. In case it is not going to be possible, and I do end up needing a desktop, I have asked another question here: http://askubuntu.com/questions/219841/lightest-weight-ubuntu-desktop-for-text-editing-in-big-terminal-windows about which is the lightest weight desktop to give me what I need. – Kevin Pauli Nov 20 '12 at 17:01
  • Unable to change this variable in fish, even when using env.. – Pysis Jan 10 '22 at 18:45
  • adding export COLUMNS=200 to ~/.bashrc worked for me – dany L Feb 05 '24 at 18:24
4

I met about the same situation and the above answer was just what I was needed.

But in your case, here are some hints if you are still interested:

Execute: echo $COLUMNS. In my case is was 141. By manipulating with export COLUMNS=XXX I was indeed been able to adjust the columns amount.

And this 141 number comes from the next. My .bashrc file contains the next code:

# check the window size after each command and, if necessary,
# update the values of LINES and COLUMNS.
shopt -s checkwinsize

I don't know for sure, but pretty much seems like using shopt command Ubuntu detects my screen resolution and sets the according number of terminal columns. Again, setting export COLUMNS=XXX allows me to change this number for the current terminal window.

So in your particular case, you would have to add export COLUMNS=200 after the quoted shopt -s checkwinsize or at the very end of .bashrc.

2

Just make the terminal larger with your mouse and type:

sudo resize

:-)

Marc
  • 339
  • An edit and an upvote! (I suppose this is what you meant) If not: please [edit] and clarify! – Fabby May 23 '19 at 23:02