Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

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

share|improve this question

8 Answers 8

up vote 7 down vote accepted

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.

share|improve this answer
    
I just installed the Gnome-team PPA, updated, now I have Gnome Terminal 3.10.2. No dynamic line wrapping. So...? –  notfed Jul 21 at 5:27

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
share|improve this answer
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. –  Marius Butuc Aug 3 '11 at 22:03
    
very true- have updated with a further suggestion. –  fossfreedom Aug 3 '11 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 '12 at 14:10
    
You made my day! It works like a charm. Now I just need to look for something similar for the Win terminal. (However, that's so extremely dumb that I think it's impossible.) –  allprog Oct 31 '13 at 8:33
1  
Just one more issue: now scrolling is a chore. :( Maybe worse than not having the reflow. –  allprog Oct 31 '13 at 9:30

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.

share|improve this answer
2  
This is cool ... but now I can't scroll up in the terminal .... :( –  greggory.hz Jun 28 '12 at 20:17

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.

share|improve this answer
    
I just want to register my sincere gratitude to you for this work. It's obscene that VTE doesn't rewrap in 2013. –  sidewaysmilk Sep 11 '13 at 18:40
    
If this feature could make it to the next Ubuntu version it would be super duper awesome! –  allprog Oct 31 '13 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 '13 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 at 23:59

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.

share|improve this answer
    
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 '12 at 22:48

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

share|improve this answer

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

share|improve this answer
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 '11 at 9:44

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+.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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