There are a lot of comments which stray from the question. OP's question was
But now I need to use tail -f
, and it also line wraps the output. Is it possible to disable line wrap in a bash shell for all the commands?
Some comments were made about the autowrap feature, stating that not all terminals have it. Perhaps. But (aside from terminator, whose developers document no terminal description) all of the examples given were xterm, rxvt and some look-alike or descendent. Those are all related.
The +aw
option in xterm
corresponds to the autoWrap
resource. Consulting the manual, it says that
autoWrap (class AutoWrap)
Specifies whether or not auto-wraparound should be enabled.
This is the same as the VT102 DECAWM. The default is "true".
and in XTerm Control Sequences it says
CSI ? Pm h
...
DEC Private Mode Set (DECSET).
Ps = 7 -> Wraparound Mode (DECAWM).
which certainly does not "depend on your choice of terminal", since any terminal with VT100-compatibility supports the feature. xterm and rxvt do this, for example. The others do as well.
Whether the feature would be useful to OP is debatable. Suppressing line-wrapping is only one aspect of the problem:
- The shell knows the width of the terminal—but that can be overridden by setting
COLUMNS
to a "large" value.
- Of course that means that applications will spend a lot of time writing on the right-margin (and some, getting it wrong, will start a new line anyway).
- OP probably assumed that the application would scroll left/right to make the wide terminal usable. (terminator does this — partly — but its other drawbacks cancel that out, except for those who only use the terminal for
cat
'ing a logfile to the screen).
- what OP actually is looking for is a set of tools that can be told to disable line-wrap, especially for viewing logfiles. If the terminal works well enough for general use, it is irrelevant to the choice of tools which one uses within the terminal.
There are pagers which can do what is needed, e.g., multitail which lists in its features
Line wrapping can be switched off, after that one can scroll to the left/right with the cursor keys
Being ncurses-based, it should work on any of the cited terminals.
screen
, there is a "wrap" command. Inxterm
, there is a-aw
option to prevent automatic line wraps. Likely there are some X resources for other terminal emulators. What emulator are you using? – Arcege Sep 12 '11 at 20:04gnome-terminal
. – nunaxe Sep 17 '11 at 08:53+aw
forxterm
:) But, this solves the issue for output (e.g., onls -l
with a bunch on long Windows-ish names from TPB, it works fine), for input, when entering a command, you probably still want wrap (or, at least you don't want it the way it is now on+aw
: try write beyond the "column border" and then backtrack for a huge GFX bug). – Emanuel Berg Nov 09 '12 at 23:37urxvt
norrxvt
can disable line wraps. – Emanuel Berg Nov 09 '12 at 23:50