为什么“man”命令消失了?

Nan*_*iao 9 man rhel package-management

我发现man命令消失在我的RHEL7

# man ls
bash: man: command not found...
# which man
/usr/bin/which: no man in (/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/usr/local/go/bin:/root/gocode/bin:/root/bin:/opt/linuxki)
Run Code Online (Sandbox Code Playgroud)

manman-pages都在我的盒子:

# yum install man
Loaded plugins: auto-update-debuginfo, langpacks, product-id, search-disabled-repos, subscription-manager
Package man-db-2.6.3-9.el7.x86_64 already installed and latest version
Nothing to do
# yum install man-pages
Loaded plugins: auto-update-debuginfo, langpacks, product-id, search-disabled-repos, subscription-manager
Package man-pages-3.53-5.el7.noarch already installed and latest version
Nothing to do
Run Code Online (Sandbox Code Playgroud)

man去哪儿了?

更新 1

尝试重新安装man,但提示以下错误:

......
Running transaction
  Installing : man-db-2.6.3-9.el7.x86_64                                                                                                 1/1
Error unpacking rpm package man-db-2.6.3-9.el7.x86_64
error: unpacking of archive failed on file /usr/bin/man: cpio: rename
  Verifying  : man-db-2.6.3-9.el7.x86_64                                                                                               1/1

Failed:
  man-db.x86_64 0:2.6.3-9.el7
Run Code Online (Sandbox Code Playgroud)

更新 2

# ls -lt /usr/bin/man
total 4
drwxr-xr-x. 2 nan nan   81 Mar 24 22:30 man1
drwxr-xr-x. 2 nan nan 4096 Mar 24 22:30 man7
# stat /usr/bin/man
  File: ‘/usr/bin/man’
  Size: 28              Blocks: 0          IO Block: 4096   directory
Device: fd00h/64768d    Inode: 67811254    Links: 4
Access: (0755/drwxr-xr-x)  Uid: ( 1000/     nan)   Gid: ( 1000/     nan)
Context: unconfined_u:object_r:bin_t:s0
Access: 2016-04-15 17:47:56.613595324 +0800
Modify: 2016-03-24 22:30:30.000000000 +0800
Change: 2016-04-08 11:08:45.605815500 +0800
 Birth: -
Run Code Online (Sandbox Code Playgroud)

Eig*_*ony 13

我怀疑我们永远无法告诉您它去了哪里,但是您应该能够使用yum.

yum reinstall man

yum运行时不检查文件是否存在yum install,它只检查已安装软件包的数据库。如果有人删除了包管理器之外的所有文件,它不会知道(您可以检查它,但默认情况下不会)。利用yum reinstall告诉它做的事,即使它认为包已经存在的安装。

根据已删除或删除的内容,您可能需要yum reinstall ...其他内容,例如man-pages.

根据新信息更新:

出于某种原因,您/usr/bin/man是一个目录,而不是单个文件,从内容来看,它看起来像是有人做了一些奇怪的mv /usr/share/man /usr/bin事情或奇怪的事情。

您无法简单地撤消此操作 - 您需要进行调查,查看损坏或移动的内容,然后进行更正。

可能只能删除/usr/bin/man其内容,然后重新安装manman-pages使用,yum但如果不进行更多调查,就不清楚了。

  • @NanXiao:如果`/usr/bin/man` 是一个目录,谁知道还有什么搞砸的?在这一点上,我建议备份您的文件并从头开始重新安装操作系统。下次不要让你三岁的孩子玩 root shell。;) (3认同)