Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I've been trying to grab the output of man pages and use it in some other things. That's working OK, but linux is hyphenating the words that are at the end of a line and that's kind of irritating because when the text is reconstructed on a variable width viewing window (think HTML), the line breaks reamin split- ting up ran- dom words.

How should I do this? I saw the entry regarding MANWIDTH but I can't get it to work...

I tried:

man ls

-- also --

man ls

No luck. I tried creating a man.conf that had MANWIDTH 30 (no "=" sign) and putting it in ~ and then tried:

man -C ~/man.conf ls

Man opens and it give me something like this:

AUe X...-qe>uyo{R2}Ia\fzuyv?>Oy|3+aaOGN+->ynuuLu{Ey3/4aecSYI~3[=5KVc]aem|6ME=ei2E,
>>Z-:-OT3p<<cMnUA]ColXa+-No?6 AzQakmoEyo32HaeUoEaIxfSc;@S3[&%VDaODO(C)3O}I3
oMNb"ao"OOu>EDaD&E`haUooEiw;f1C.bU-C KpAyb^92uE
o2LKAe   N}2OFSFi~MAO QA9|xT@k1/4zy$l'eAAy']CC/>>K^%T*LmI~An&qu
ot;o1/2i2(R)141L,Z o.LXniE$~R6.a5O#AEUA14UiFwY~xIpB8<<JOo(R)QoMAEnUxu$Iw&Cj3eO
fBLJ[Q^Xi-:->>(R)Eo2pm1c, _3ii<<EsCa;

So how do I get rid of those hyphenated words in the mid- dle of my man output?

share|improve this question
"$ MANWIDTH=40 man ls" work in Ubuntu(man-db 2.5.7-2ubuntu1) – osdyng Jan 23 '11 at 20:40
Try export MANWIDTH=4000; man ls. You probably need to have the variable exported for ls to use it properly. – Scrivener Jan 23 '11 at 21:47
Have you considered using a troff to html tool since you mentioned HTML? – Zoredache Jan 23 '11 at 22:01
Either of the above suggestions should work. If you simply set the variable as you show in your question, it's not exported into the environment of man. Note that @Scrivener meant to say "for man to use it". – Dennis Williamson Jan 23 '11 at 22:03
up vote 1 down vote accepted

On my Debian system, man man offers the --no-hyphenation (--nh) option. The same man page also refers to MANOPT, which allows you to set the default options for any future invocation of man. Another option possibly of interest to you is --no-justification (--nj).

Putting this in your .profile (.bash_profile) would disable hyphenation and justification:

export MANOPT='--nh --nj'

However, what slightly puzzles me is why you don't use the --html flag to generate HTML directly from the man command:

export MANOPT='--html'


share|improve this answer
I guess this was the best answer, although I think Scrivener's comment "Try export MANWIDTH=4000; man ls. You probably need to have the variable exported for ls to use it properly." was probably the most helpful. Thanks to you both! – cwd Jan 28 '11 at 5:21

Edit /usr/share/tmac/doc.tmac and search for the line .de reset-args. Within that macro definition, you should see a line saying something like:

.hy \n[hyphen-flags]

Change that line to:

.hy 0

If you have any pre-generated cat manpages, you'll need to nuke those to force regeneration.

You're done. But it's global.

share|improve this answer

I like

man zshall | fold -w 80 -s | less

where "zshall" is the man topic

share|improve this answer

Your Answer


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.