Ask Your Question

I'm looking for a tail program that does word wrap

asked 2017-01-20 13:48:19 -0600

oddestNeeds gravatar image

For some reason, gnome-terminal does not provide word-wrap capabilities.

Too complicated I guess.

The photo background images were a nice feature of gnome-terminal before they were disabled. They were too complicated as well, according to the articles I read, and that was the reason that functionality was dropped as a terminal capability.

But there's hope for word-wrapping in some distant future, I'm fairly certain.

In the meantime I could use a linux tail program that incorporates --follow & also does word wrapping.

I've tried web searches and came up blank.

For the moment I'm formatting the text programmatically, but I'd prefer an OS solution.

Any suggestions would be appreciated.

edit retag flag offensive close merge delete

4 Answers

Sort by ยป oldest newest most voted

answered 2018-05-21 12:33:27 -0600

fcomida gravatar image

Plenty of terminal emulators in Fedora, you don't have to stick to gnome-terminal. You don't have to stick to Gnome either if you like functionality and customization.

edit flag offensive delete link more

answered 2018-05-21 19:15:54 -0600

ed209 gravatar image

Pipe your commands through fold, e.g.

\ls -lR | fold -s

fold -s breaks at spaces

edit flag offensive delete link more

answered 2017-01-20 15:51:52 -0600

sideburns gravatar image

I don't know if there's a program that does exactly what you want, but I know how to create a shell script that has that effect. First, see if you have ~/bin in your home directory; it's on your path, but isn't created by default. If not, create it. Then, use your favorite editor to create the following file and store it as ~/bin/tailf (for tail fold):

!# /bin/bash

tail $1 |more

Then use chmod a+x ~/bin/tailf to make it executable. (If you're doing this in a GUI from your file manager, just go into the Properties and mark it as executable.) Then, you can use tailf $FILE to get your output properly folded. Yes, using more for so few lines is a bit of overkill, but as long as it does what you want, who cares? And, it follows the Unix/Linux philosophy of chaining together several small utilities instead of writing custom programs for odd jobs like this.

edit flag offensive delete link more


thank you for answer Sideburns.

The only hitch to the solution you offer is that using "more" requires the user to manually advance the screen.

ie. tail --follow $ | more -l

with or without -l displays one screen of data then halts. I'm looking for continuous scrolling.

I'd like something that wraps to the window-width whatever the size and displays the file continuously as it updates.

oddestNeeds gravatar imageoddestNeeds ( 2017-02-12 15:53:59 -0600 )edit

answered 2018-05-21 08:36:48 -0600

erikig gravatar image

The command below will tail follow tail -f a file and only print the first line without word wrapping

tail -f <FILENAME> | cut -c 1-$COLUMNS


tail -f <FILENAME> Pretty Self Explanatory - tail follow

cut -c 1-X Cuts the first X characters of a line

$COLUMN The bash variable for the width of the terminal (the number of columns displayed)

edit flag offensive delete link more


This doesn't even begin to answer the question. It prints one line, truncated, instead of the complete output with word wrap.

sideburns gravatar imagesideburns ( 2018-05-21 14:49:10 -0600 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower


Asked: 2017-01-20 13:48:19 -0600

Seen: 493 times

Last updated: May 21