27

How can you get the lines in the GNOME Terminal to wrap dynamically when you resize the window?

0

8 Answers 8

19

At the time the question was asked, this was not possible in Gnome Terminal. However, a fix was committed in late 2013. This change didn't make it into Ubuntu 14.04, but it should be part of Ubuntu 14.10.

According to the issue on Launchpad, you can have this feature today by enabling the Gnome-team PPA. You can activate the Gnome-team Staging PPA (staging required to get latest version) by doing the following

 sudo apt-add-repository ppa:gnome3-team/gnome3-staging

Update your sources

sudo apt-get update

Re-install gnome-terminal to get latest version

sudo apt-get install gnome-terminal

Check so you have version 3.13 or later (as of 10 September, should be 3.13.1)

$ gnome-terminal --version
GNOME Terminal 3.12.1
5
  • I just installed the Gnome-team PPA, updated, now I have Gnome Terminal 3.10.2. No dynamic line wrapping. So...? Jul 21, 2014 at 5:27
  • @notfed You'll probably need 3.12, which is available for Ubuntu 14.04 in the staging ppa. Try (at your own risk) ppa:gnome3-team/gnome3-staging Jul 26, 2014 at 20:32
  • Just tried adding the "normal" ppa:gnome3-team:gnome3 ppa, got a version that was 3.10. After adding ppa:gnome3-team:gnome3-staging I got the correct version 3.13.1, so I can confirm this is working. Sep 10, 2014 at 14:56
  • It's the version number of VTE that really matters. The feature appeared in vte-0.36 (correspondingly, echo $VTE_VERSION should report at least 3600).
    – egmont
    Apr 25, 2015 at 17:41
  • 1
    I now have GNOME Terminal 3.12.3 on Ubuntu 14.04 using this method, and reflowing works.
    – nh2
    Jun 29, 2015 at 11:48
11

The default Gnome Terminal doesnt allow you to do this - however, if whilst in the terminal you type screen - it will run the terminal in a terminal emulator which does resize correctly.

For example - here is my home folder whilst running ls -l

enter image description here

and here is the same screen resized horizontally

enter image description here

Starting Gnome-Terminal automatically with Screen

cp /usr/share/applications/gnome-terminal.desktop ~/.local/share/applications

then edit the gnome-terminal.desktop file and change the Exec command line to:

Exec=gnome-terminal -x screen -q
11
  • 2
    After installing the package - sudo apt-get install screen - it does the line wrapping, but running screen every time for that purpose is not really unintrusive. Let's see what other workarounds are there. Aug 3, 2011 at 22:03
  • very true- have updated with a further suggestion.
    – fossfreedom
    Aug 3, 2011 at 23:06
  • There's a topic about gnome-terminal + GNU screen integration and a bug report but no one is working on it. Still, GNU screen looks like the way to go for dynamic line wrapping.
    – Maxime R.
    Apr 6, 2012 at 14:10
  • 1
    Just one more issue: now scrolling is a chore. :( Maybe worse than not having the reflow.
    – allprog
    Oct 31, 2013 at 9:30
  • 1
    To all thinking of trying this: it's cool at first, but really quirky, and I eventually stopped using it Aug 27, 2014 at 20:48
10

I'm making great progress in implementing rewrapping in VTE (gnome-terminal etc.). Please see the upstream bug at https://bugzilla.gnome.org/show_bug.cgi?id=336238 , feel free to try my patch if you're a hacker kind. In case of any technical feedback, please comment in that upstream bug, thanks! Hopefully my work will soon end up in mainstream VTE.

4
  • 2
    I just want to register my sincere gratitude to you for this work. It's obscene that VTE doesn't rewrap in 2013. Sep 11, 2013 at 18:40
  • If this feature could make it to the next Ubuntu version it would be super duper awesome!
    – allprog
    Oct 31, 2013 at 8:47
  • I hope it will make it. It's now included in VTE version 0.35, which will become stable 0.36, part of stable Gnome 3.12.
    – egmont
    Dec 3, 2013 at 12:48
  • Unfortunately it didn't make it into ubuntu trusty, but you can upgrade your vte (and gnome-terminal) packages from the gnome3 staging area at launchpad.net/~gnome3-team/+archive/gnome3-staging/+packages
    – egmont
    Apr 13, 2014 at 23:59
7
+25

gnome-terminal can't do it (upstream bug).

After some experimentation, rxvt-unicode seems like it will work.

Install via the software center

sudo apt-get install rxvt-unicode

The reflowing only works after you have enough text to fill up an entire screen's worth, aka once you hit the scrollback buffer.

On a personal note, I find rxvt to be quite ugly, but if reflowing is more important to you, go for it.

1
  • What amazes me is that to this day- no one has thought to develop a fresh new terminal that isn't based on VTE- that's the reason why most terminal apps for Linux don't reflow. Just look at Mac OSX's Terminal.app- it reflows, and is one of the best terminal emulator I have used.
    – papashou
    Jun 8, 2012 at 22:48
6

While I unfortunately don't know the answer to this for a normal terminal session, I know how to do it if you're using screen (even if you're using byobu): reattach your screen by using the following:

screen -raAd

This will scale your screen session as you resize (and also detach any existing running sessions) and is what I always use to bring back a screen session.

2
  • 2
    This is cool ... but now I can't scroll up in the terminal .... :(
    – gregghz
    Jun 28, 2012 at 20:17
  • For scrolling in screen, see this question.
    – Ruslan
    Sep 24, 2015 at 15:47
2

As far as I know, it depends on the program that you are using. The terminal itself cannot dynamically wrap text. However, some terminal programs can, e.g. less[1].

A work around would be to try to pipe[2] what you want to display through less.

[1] http://linuxcommand.org/lts0030.php#less

[2] http://linuxcommand.org/lts0060.php#pipes

0

Solution: install screen (sudo apt-get screen), and launch it in your terminal.

1
  • 3
    Better yet, install byobu. It's basically a nice wrapper around screen, but one nice feature is that you can have it auto start in all terminals, so you hardly know it's there.
    – ams
    Nov 18, 2011 at 9:44
0

Over the last 5+ years I have periodically spent lengthy sessions in care & feeding of Linux machines (in far away places). And, basically, Gnome Terminal doesn't quite cut it ..

I have often used Windows-based SecureCRT and SecureFX (SFTP) on both XP and Win7, as well as on Ubuntu (under Wine), giving me a much better set of features, including: multi-windows and/or tabs, saved settings, login macros, by-session colorization, much customization, integrated SFTP, and even scripting .. There were always minor glitches (with Wine, partic. with SFTP), and I often strayed back to Gnome Terminal for local tasks on Ubuntu.

However, since early this year (in beta), I have had SecureCRT (native to Ubuntu). Other than getting tighter integration with Nautilus (or something) for SFTP/SSH file transfer, this has nearly replaced my use of Gnome Terminal.

Even new machine setup is better with hassle-free cut & paste, full session capture, and saved connection settings. It has always had superior re-size, re-flow, and character-set handling even over most of the other terminal apps.

I've not tried it, but it has also just been released for Mac OS X v1.5 (Intel), or v10.6+.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .