Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Horizontal scroll in a bash window

I used printf to output a columnar display of a text file.

However the length I wanted will cause the columns to flow into the next line.

I've been searching for a flag or workaround that will make the console window scroll and could only come across the following:

set horizontal-scroll-mode On

It's right under the #! /bin/bash line, but couldn't work

Is there another way?

like image 397
eruina Avatar asked Jan 29 '10 16:01

eruina


People also ask

How do I scroll horizontally in terminal?

Terminals are not designed to scroll horizontally. Use less -S to allow scrolling left and right as well as up and down.

How do I add a scroll horizontally?

Horizontal scrolling can be achieved by clicking and dragging a horizontal scroll bar, swiping sideways on a desktop trackpad or trackpad mouse, pressing left and right arrow keys, or swiping sideways with one's finger on a touchscreen.

How do I scroll horizontally in PuTTY?

As noted in PuTTY wish horiz-scroll, if you really need horizontal scrolling, you will only get that by using an application running in the terminal emulator which simulates the feature. The example given (less) provides this using the -S option (see Use less -S for horizontal scrolling).


2 Answers

No. Terminals are not designed to scroll horizontally. Use less -S to allow scrolling left and right as well as up and down.

like image 182
Ignacio Vazquez-Abrams Avatar answered Sep 28 '22 10:09

Ignacio Vazquez-Abrams


Maybe you should look into using dialog, here's the man page for dialog, or ncurses to do this for you instead of wrestling with the means of outputting text and scrolling. Let those libraries take care of that for you.

Hope this helps, Best regards, Tom.

like image 20
t0mm13b Avatar answered Sep 28 '22 09:09

t0mm13b