![Linux“man”页面在 CentOS 中显示为乱码](https://linux22.com/image/1442262/Linux%E2%80%9Cman%E2%80%9D%E9%A1%B5%E9%9D%A2%E5%9C%A8%20CentOS%20%E4%B8%AD%E6%98%BE%E7%A4%BA%E4%B8%BA%E4%B9%B1%E7%A0%81.png)
在我的 CentOS 6 机器上,所有手册页和一些支持的工具--help
都显示乱码。例如,如果我输入:
man man
我明白了:
^HZ[wã¸~ǯÀjZÊèvg:=3ÌlËm’¾¤ÞÎl<;HHBL´Z}òãSe{l?´)B¡ê«¯ Hî{"¹ïɺХªt&U]ÙªLªò|/¥ÝÈ*ãÄr±ÕZSÔK³ªK-]Zmà[úr
¹U+-¶Ä®²¯ûá¦w[UMS»Ýfµ®d?Èãï¾{;ÄÿòOv]ÈϨÊí?ÚFÙË̸ª4ºÒ².2g©t¹qÒ.éÇÇO~m¹¼«¹Ii+êÂi©t[¥Ã±Ët2>»È¥Éa¬µª‘©íäÎTkúK:NÞÒ8IJ°#7½ùûNÿ1]ëdý¢¢³^é*«.*øt7¨x9)V¦Ðº4ÅÍaÞOyÔ¥3ÕÎq ÒkWþüðíãwñ¶ìeºVÅ
3J/øµ-l_/ó{Ì/x¡²7ÓÛJoÝãïòÝÛ·ïáóÕ<ÉìBÞ¯’[ÞhA"ÜnPÌ6Wd.Ò£VãÕ°6´G}g?ÞÜÞÍ.g"9¡ÉD2=T-Ï×®våOþíhF#j[màñr*ÝÞ|ñÿP¡þâ§üm÷gÚáèë5ÅirØ×fæûÑÿ°%DNèõ¢´;×ýpAÖÕ&ÒgæeÓ)ÚÌÏ<~¾Ïþ-½¸½Bm´L¤’H]gÙéôòn~y{ã5&Xã.V¹{Qç‘K¹ßaßÇÈaÓà÷¹µ=v4´ñNÅ&(#(
ßIîN[‘(wk®%4¯ö[0¡½ö ]:dC¹¬r(........Dp£Ð».ìN¥Y6sÃ^VÊéråÖ¤è¾<)‘l4*o¦dØÔe*ô|Å>î....... U<³¼fÔS ý2#ôpähimæ2
Eóá(ÍðÓÑB«¯÷Ëir¿¼?¹»3åBçvG¨d¦1½BwkÏzÇÊ#Y]"$ÂõøæÓøJÎ&§h3øà*Ð*³°[î‘Læu¦¿ß¾ÃéÅ’4ÛSV¹¯ß;Ô)ìOóö·â@sQªr/ÏýÞ4¿gúípúùÎQàÐä½Àò<²×S[;ýN|TµºJä_×Æ¥:ÏU¡UxùmsmL8L(+ksàL«Mü,j’SJ»1_u¬‘ä6ec.®]V‘P^ReÁmWô0vÕÛ;Þ/ëýèþÿNe/!ò8ôXY;ý_ô9ÓKUçx6GºJ0(s7>}ÞößA,Á5Hà,%3%¬Âôs;JXrá
‘Ë®&°TQ©ÍY ãBêÍn¢r¢°U gîZ‘àÈsèÒMÆÓÓy7Xt~;F7þ8õd/íPÛ®·ñuHðÆzß()M¦sÇ ]<ÒUiÔ"oÁ¤.éÍ]CsXÇÉ>ì[ ï‘ï¨våÑÂGà#w;XÐÉÁ:Bá¼ËùõWÖu2½ý<{aYɯùDJr3vÙdD¼æS½&+öxy^%ï
9Ó£mOy£Tl°ð:k|?$¯ZBòó²ÇB)ñÌBv&Ï¥þÁ ¦.......س)Aº8$J,@7Û’ÇÍZáÀsSR¼ì0¸8Þ6æt=0²%yêß...*Ûé;HÅT{ÊGþmk±A!Ho±¬·£Ê2ÄÜ"Öê*çu±v......ݵ*‘)˯¦ùN9O1q¯8B(ÕUð¡Õ,MAëEMöö¸ÞH@;&µeYÓÍ:kÌÄ-ÞÀ¤UM|%&¶0%D‘ 02°¹²
¾^Ô«rxSð²vø3qbAòfkÀx¦«Ä®>K1ù¥6*ÇuVLÛí¦Ôð,ÝãfÍc°$7B¡q½ÖâdQró-ìs¸($Zi§íÃ3B©mi·ÖuíÏCÈBfÓä_¯ÂþTý(îÈϪD«ø-Â
½¯ÚKpÁ=0?»ûyYì®0y’ù’2e+WGÁÒÖ+ÀóL«!âéf¦k$Í4I¥¶¶FÅÌMlÁ¦Þ¿}Ö°Äb%m*w.Ðôøü®´å@sPDFq»V³ÅiHYÝPîô/µ.RâÞ°ß#@gK¦¬Ñ¿@ëTEiKà±´Qþmº±aKÛbð#XZ+Ò¸eÑ....¨mIwòþç~׸P$í̪ðlb#U©¿BÿRȾåªT[Ù_Á¤
²¿jË~+X|&ûðvÒ/¯cóôöü|6ùï×á¹Bj?¸"æ‘]#s6EHЯçls...¶Á~¶5Ùèª^$DØ«ó-ü‘vùÊÄÑêÎrR4À´µ^ óGÕ¨ù¡k,QBYÌÞBPÇEÕ9xqÈúñ½zT&WûBáb‘Æ9Â0ÒÀ"N¡ÙüQoøc;éФ>‘0D´dÉ[1üÁQiøÐÞIHÀl CpÞÿÍZÎûnêä@¹³u¡àm8±MÜ¡0ß.,Xöª&c#oþ^ùûÈ?È&/³q
º2PÀ}ÿÇ0y¹ôhÉDqrS<vá%i¾ÒSǨÍÉ,Zz~ÒôY¹¬%Ve*åláËC9Û$©çãêAÝyy²ôsfÔgZí?äP)´.CÎ{س®ÞéxîÓUHB® â¢,X(BòVEûóÛ2c/¾°R÷,¿6¿°E&68/UXn¾FSQáΧäÜf<»b÷Bà¬Yx6÷V3[üFm· kʱh(+r#x<ŵÌ2ÅÛ*’&,Ñ"Jxã&+±ÚQ
Îöê0{zwHÖ¨"¶¶ãl©éÛ·¿>f´¦âÃþCÞÜO/&Tä+À;Yp½Q:8«BË#ßI°¸Z‘M xÑbÓî nG·±ø¿ýðþ=:.ÀÈ®4F¬G.....q$B
A¡ó¹a~÷Ío¿¿ÏG.÷$Ã4*‘°¦Àz-˸ÒìDZ6$Æ._èî,6®ça:R¢Â<p¨<àÖçóá@=Û¡P.4........ÓT~3rÍ[ñP,Í;1£7Ã’¬*5tÝQÅÙmÈvô$‘Lô0mâìÔ{ã6Gjhü"¼eX¸xÝ7‘Ë9ÐMá^¤.àBrå<<6_·ê/[ðz ÙC×ÖÅ‘DûÈe|ïáÃÓ+òlÀ¾þñ@kBÕt)ä»5ø:ÿÎ.....rÓ2hçWk,qKµ[@m<"ôÔðÊÄyRvH-$A>úmfjøó,èË.§µ2ö:bÚ‘¬ÕEúºÖuIÂ;6¶sʦ-ë°¿¦®ÜÄlOÜPµfÙ$LáÐøÃÓ3|î´
täp>¾s ôhóGb5 êI]å2;:P8ö#B#ÅñBÁ<{‘+Ãfv:t|î|7ÞZ·Ê"1’ïðÈÛx){£PyDv#xï(xsÔ"ÚrÌèi9æ°ØHÒ5uý°°Ñ½æãD®ÆSÌ]ârßüâjÎ ÞXûFµßB=3N¼$Þ¿ z9ÀBnRS-
Fxd*ixÉAãäô^äö¬8µÎíÍBUÔ¿O¢QÀú#® Üóø¼«,H!1¥¡LñRéÒ.ð<Xm´ÎUyX^¡nB6AI0ïý³.Ñ76Àô[,ðRü|=¾±(À2Cþ V³Þ˦Jµ}è>sôû¬MÙÏñäG¥ë(
úÊÙ¥Q Í"¢Y¢ÐÊßÐ6G%¬ÎÀQÍ2}°JA«ô9ÀáAQç@É’©aMFv^î²ÔnkYg;v¶hÛ0îÕnØcù8Õ«±ýÒþ.º.....ÌÔÍQ½ûËþkb«®ºHÔ‘¢U©6qNÕ³lG’¤aûi|Zz¯,<Hûáw·µcbý~iD[Ùî½..Éu|ö~màu¾ªò²i·a¥s+£=%ì*¤¹W}JHÐ;]½xqQÑ OÀo^VÚ¶h@ä+kóÇppj>,
ñÁd{¤Fì|s;þ4¿íâÊûDù-|~ÓâÍ%ðáë ÝÂ>bû0<FQbìÕuI‘{÷ËéÐ×Áãz¹4_ÚC_&³óY?/Ù³ã FSÉÈ£º:]{qøxs8W:¢MO^»è>7>t;¾ÄÐúnb,-jïODãÄÔêð ÷Sí>É~‘몷ô;ãô,ª.ðlµ¡liÐ0õqX"ε)ñP‘8|ªeÙçÊXR²úú"q[}5Ûí..±Ù)¦NòÕ§3AsCÐCûöäô¬*dQCGÌxþK8åh’*y®>¹ùËéíÍõäfJ3!*sê~Q©¨j·è;_y‘wF|><á«éÝê3¾©ù5îÝ yH¸°"ËÃ)ÀÊg_Àjä|ø+ÿÓ_ôU¤«fùHÁ_sö
^Hµ7Z.#ÑÚ µAS¶¥AÎmÖÛ=UºúÀTWú*Ì<áÅËBQ!ï¬ñÉ~¶¼ñLøº’<t/ì*~t²ÕRº¥U*db9=¥=òÈ-ÓÁf³.úõ/.#߯©¶|¾<;º¡;Uk.{âr[ÎÔVbÛýõ>=kkZ¥òkqíÉ!5vª#çïJßjë·§´".LóÅ-
ioø©ÎLä±2IQrØùM×°pI‘I¨¯,mçTjOn FPºæxzàpîöÐÑhN¾OðìíÅç¦7g¼ß|ôGOl÷éu8G....*ÄS9¡åeQQYqLþsþ!{ð7,Ö¾áÃÿTáñ-VÊ‘°âB ’Ir=QU/¥s9Áö*xJ =øÞqW^¼å¸1½ç²3Vaïæjà<W§?_Of3æ!©³Gûøl]èwLôãî¢OXÆ{ÒÔdrüåA z
øÄ試ð’5þÐ-UÃ+ÛU"úXDÁ/béñ:´‘pD ²9×Pí¡eaÃ0h&¡>ð¸ÔWJ¼S¼bcyé:W ©ô;¶i¬÷éüÇ»I£QRJøË’Ù¡å²/í÷öÔìÇÙ|r=E¾âbIsPcóÕ;r>]DHü¸z»ñÑOg¡p? e ¾°³åãb.E±ê±...Gât"M¼(JÞ¬Ä.Üö{ýîý{¬vÿ~|öuÐÊëý,ɲþí Líôb<MæÀîâøZU"MHæùåÝ,LF5â
ì¯r»P‘cô÷ò¯ýåñà’àj³Èìd.w~ñf‘lð«~ZT‘åÙþ <NæÄ%0S½Q©ãº÷Úµáò÷ù1sºÄrÅ¢Ü_Õ¤¼Ô’ÿ~JüÁrãï£Ý¹õù5xfNxÔUUt’í-Túà¶
/¡ËÐ|@´+÷#ùÔ±ëèr´?àÏ^W_*Ò1¤z·Sѹ1OW}è¸4+¹0̵-C..KhÃÿ«÷¼Nä.F*7pÏoé¿cw1Nüìð$ð믳5tÇÉo$Õðð~s’µòªNÍüÞÈß/óðüGn[®5Áã(«°Jù:ûD¯f·=áoÅ:ýµzÄàHtJOOmW9Å?..ÑAy«1.
我认为这与环境变量无关,但我所拥有的是:
$ env
MANPATH=/usr/share/man
TERM=xterm
PATH=/usr/local/bin:/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/sbin
PWD=/home/UNIXHOME/mlakata
SHLVL=1
HOME=/home/UNIXHOME/mlakata
_pam_krb5_stash_mlakata_.COM__1_shm5=327688/23401
_=/bin/env
我也尝试了我的旧备用tset
来修复损坏的终端窗口,但这没有帮助。
答案1
我建议检查一下/etc/sysconfig/i18n
:
该
/etc/sysconfig/i18n
文件设置默认语言、任何支持的语言和默认系统字体。
有一个更大规模的讨论man
,且可能存在字符损坏在这个网站上讨论类似的事情。有趣的是man.config
位于此处的文件的讨论:
/etc/man.config
我使用 Ubuntu — 因此在我的系统上找不到该文件;man
Ubuntu 上的设置与 CentOS 不同 — 但所显示的示例显示了两行我认为与此相关的内容:
COMPRESS /bin/gzip
COMPRESS_EXT .gz
在我看来,您所描述的逻辑就像man
屏幕上显示的原始压缩文件。所以也许解压过程中的某些东西搞砸了一切?
答案2
这是 CentOS6 的“好”内容/etc/man.conf
,以防有人进入这种状态(即某些东西被抹去/etc/man.conf
,你因为无法阅读手册页而陷入困境!)。谢谢@Giacomo1968 的回答为我指明了正确的方向。在本例中,解压缩程序是lzma
。
#
# Generated automatically from man.conf.in by the
# configure script.
#
# man.conf from man-1.6f
#
# For more information about this file, see the man pages man(1)
# and man.conf(5).
#
# This file is read by man to configure the default manpath (also used
# when MANPATH contains an empty substring), to find out where the cat
# pages corresponding to given man pages should be stored,
# and to map each PATH element to a manpath element.
# It may also record the pathname of the man binary. [This is unused.]
# The format is:
#
# MANBIN pathname
# MANPATH manpath_element [corresponding_catdir]
# MANPATH_MAP path_element manpath_element
#
# If no catdir is given, it is assumed to be equal to the mandir
# (so that this dir has both man1 etc. and cat1 etc. subdirs).
# This is the traditional Unix setup.
# Certain versions of the FSSTND recommend putting formatted versions
# of /usr/.../man/manx/page.x into /var/catman/.../catx/page.x.
# The keyword FSSTND will cause this behaviour.
# Certain versions of the FHS recommend putting formatted versions of
# /usr/.../share/man/[locale/]manx/page.x into
# /var/cache/man/.../[locale/]catx/page.x.
# The keyword FHS will cause this behaviour (and overrides FSSTND).
# Explicitly given catdirs override.
#
# FSSTND
FHS
#
# This file is also read by man in order to find how to call nroff, less, etc.,
# and to determine the correspondence between extensions and decompressors.
#
# MANBIN /usr/local/bin/man
#
# Every automatically generated MANPATH includes these fields
#
MANPATH /usr/man
MANPATH /usr/share/man
MANPATH /usr/local/man
MANPATH /usr/local/share/man
MANPATH /usr/X11R6/man
#
# Uncomment if you want to include one of these by default
#
# MANPATH /opt/*/man
# MANPATH /usr/lib/*/man
# MANPATH /usr/share/*/man
# MANPATH /usr/kerberos/man
#
# Set up PATH to MANPATH mapping
#
# If people ask for "man foo" and have "/dir/bin/foo" in their PATH
# and the docs are found in "/dir/man", then no mapping is required.
#
# The below mappings are superfluous when the right hand side is
# in the mandatory manpath already, but will keep man from statting
# lots of other nearby files and directories.
#
MANPATH_MAP /bin /usr/share/man
MANPATH_MAP /sbin /usr/share/man
MANPATH_MAP /usr/bin /usr/share/man
MANPATH_MAP /usr/sbin /usr/share/man
MANPATH_MAP /usr/local/bin /usr/local/share/man
MANPATH_MAP /usr/local/sbin /usr/local/share/man
MANPATH_MAP /usr/X11R6/bin /usr/X11R6/man
MANPATH_MAP /usr/bin/X11 /usr/X11R6/man
MANPATH_MAP /usr/bin/mh /usr/share/man
#
# NOAUTOPATH keeps man from automatically adding directories that look like
# manual page directories to the path.
#
#NOAUTOPATH
#
# NOCACHE keeps man from creating cache pages ("cat pages")
# (generally one enables/disable cat page creation by creating/deleting
# the directory they would live in - man never does mkdir)
#
#NOCACHE
#
# Useful paths - note that COL should not be defined when
# NROFF is defined as "groff -Tascii" or "groff -Tlatin1";
# not only is it superfluous, but it actually damages the output.
# For use with utf-8, NROFF should be "nroff -mandoc" without -T option.
# (Maybe - but today I need -Tlatin1 to prevent double conversion to utf8.)
#
# If you have a new troff (version 1.18.1?) and its colored output
# causes problems, add the -c option to TROFF, NROFF.
#
TROFF /usr/bin/groff -Tps -mandoc
NROFF /usr/bin/nroff -c -mandoc 2>/dev/null
EQN /usr/bin/geqn -Tps
NEQN /usr/bin/geqn -Tutf8
TBL /usr/bin/gtbl
# COL /usr/bin/col
REFER /usr/bin/grefer
PIC /usr/bin/gpic
VGRIND
GRAP
PAGER /usr/bin/less -is
BROWSER /usr/bin/less -is
HTMLPAGER /bin/cat
CAT /bin/cat
#
# The command "man -a xyzzy" will show all man pages for xyzzy.
# When CMP is defined man will try to avoid showing the same
# text twice. (But compressed pages compare unequal.)
#
CMP /usr/libexec/man-cmp.sh
#
# Compress cat pages
#
COMPRESS /usr/bin/lzma
COMPRESS_EXT .lzma
#
# Default manual sections (and order) to search if -S is not specified
# and the MANSECT environment variable is not set (1x-8x sections are used by
# xorg packages).
#
MANSECT 1:1p:8:2:3:3p:4:5:6:7:9:0p:n:l:p:o:1x:2x:3x:4x:5x:6x:7x:8x
#
# Default options to use when man is invoked without options
# This is mainly for the benefit of those that think -a should be the default
# Note that some systems have /usr/man/allman, causing pages to be shown twice.
#
#MANDEFOPTIONS -a
#
# Decompress with given decompressor when input file has given extension
# The command given must act as a filter.
#
.gz /usr/bin/gunzip -c
.bz2 /usr/bin/bzip2 -c -d
.lzma /usr/bin/unlzma -c -d
.z
.Z /bin/zcat
.F
.Y
#
# Enable/disable makewhatis database cron updates.
# If MAKEWHATISDBUPDATES variable is uncommented
# and set to n or N, cron scripts
# /etc/cron.daily/makewhatis.cron
# /etc/cron.weekly/makewhatis.cron
# will not update makewhatis database.
# Otherwise the database will be updated.
#
#MAKEWHATISDBUPDATES n
MANPATH /opt/intel/mic/share/man