本帖转自倔强小梦https://www.cnblogs.com/xphdbky/p/8243008.html

倔强小梦参考自:http://blog.csdn.net/csdnones/article/details/51513163,感谢原作者解决了我的问题。

在root用户下执行xhost +,报以下错误,原因是因未没有安装相关的包(其他类似command not found命令没有可以用这种方式解决)

[root@rac01 ~]# xhost +
-bash: xhost: command not found

安装该包即可:

[root@rac01 ~]# yum whatprovides "*/xhost"     ----------------------查看是哪些提供了 */xhost
Loaded plugins: product-id, security, subscription-manager
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
base/filelists_db                                                               | 3.4 MB     00:00 ... 
xorg-x11-server-utils-7.7-2.el6.x86_64 : X.Org X11 X server utilities    ---------------------就是缺少这个包xorg-x11-server-utils-7.7-2.el6.x86_64
Repo        : base
Matched from:
Filename    : /usr/bin/xhost

安装xorg-x11-server-utils-7.7-2.el6.x86_64

[root@rac01 ~]# yum -y install xorg-x11-server-utils-7.7-2.el6.x86_64
Loaded plugins: product-id, security, subscription-manager
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package xorg-x11-server-utils.x86_64 0:7.7-2.el6 will be installed
--> Processing Dependency: mcpp for package: xorg-x11-server-utils-7.7-2.el6.x86_64
--> Processing Dependency: libXxf86misc.so.1()(64bit) for package: xorg-x11-server-utils-7.7-2.el6.x86_64
--> Running transaction check
---> Package libXxf86misc.x86_64 0:1.0.3-4.el6 will be installed
---> Package mcpp.x86_64 0:2.7.2-4.1.el6 will be installed
--> Processing Dependency: libmcpp.so.0()(64bit) for package: mcpp-2.7.2-4.1.el6.x86_64
--> Running transaction check
---> Package libmcpp.x86_64 0:2.7.2-4.1.el6 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

=======================================================================================================
 Package                           Arch               Version                   Repository        Size
=======================================================================================================
Installing:
 xorg-x11-server-utils             x86_64             7.7-2.el6                 base             155 k
Installing for dependencies:
 libXxf86misc                      x86_64             1.0.3-4.el6               base              18 k
 libmcpp                           x86_64             2.7.2-4.1.el6             base              69 k
 mcpp                              x86_64             2.7.2-4.1.el6             base              23 k

Transaction Summary
=======================================================================================================
Install       4 Package(s)

Total download size: 265 k
Installed size: 570 k
Downloading Packages:
-------------------------------------------------------------------------------------------------------
Total                                                                  2.2 MB/s | 265 kB     00:00     
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
  Installing : libXxf86misc-1.0.3-4.el6.x86_64                                                     1/4 
  Installing : libmcpp-2.7.2-4.1.el6.x86_64                                                        2/4 
  Installing : mcpp-2.7.2-4.1.el6.x86_64                                                           3/4 
  Installing : xorg-x11-server-utils-7.7-2.el6.x86_64                                              4/4 
  Verifying  : libmcpp-2.7.2-4.1.el6.x86_64                                                        1/4 
  Verifying  : xorg-x11-server-utils-7.7-2.el6.x86_64                                              2/4 
  Verifying  : libXxf86misc-1.0.3-4.el6.x86_64                                                     3/4 
  Verifying  : mcpp-2.7.2-4.1.el6.x86_64                                                           4/4

Installed:
  xorg-x11-server-utils.x86_64 0:7.7-2.el6

Dependency Installed:
  libXxf86misc.x86_64 0:1.0.3-4.el6    libmcpp.x86_64 0:2.7.2-4.1.el6    mcpp.x86_64 0:2.7.2-4.1.el6

Complete!

安装完成,,再在root下执行xhost

[root@localhost database]# xhost +
xhost: unable to open display ":0.0"

xhost命令可以用啦啦。。

linux报错-bash: xhost: command not found的更多相关文章

  1. source /etc/profile报错-bash: id:command is not found

    由于误操作导致 source /etc/profile 报错 -bash: id:command is not found 此时,linux下很多命令到不能能用,包括vi ls 等... 可以使用 e ...

  2. linux下报错bash: service: command not found

    在linux下操作的时候经常会遇到,bash: service: command not found这个错误,以前在网上找了,照着弄了,也没细看原因,今天又碰到这个问题,就顺便研究一下. 1.通常这种 ...

  3. scp报错 -bash: scp: command not found

    环境:RHEL6.5 使用scp命令报错: [root@oradb23 media]# scp /etc/hosts oradb24:/etc/ -bash: scp: command not fou ...

  4. scp命令报错-bash: scp: command not found

    # scp -bash: scp: command not found # which scp /usr/bin/scp # rpm -qf /usr/bin/scp openssh-clients- ...

  5. scp拷贝文件报错-bash: scp: command not found

    今天用scp远程传输资料,报错如下: -bash: scp: command not found 在网上搜资料解决办法如下: 安装scp的软件包: # yum install openssh-clie ...

  6. Mac 终端命令行报错 -bash: vi: command not found

    我遇到的问题与这个类似,但是我的问题也是用该博文作者方法进行中断才解决的,在此表示感谢. 前段时间在 Mac 下使用终端遇到了这个问题: appledeMacBook-Air:~ air$ vi .b ...

  7. Mac 执行 gulp 报错 -bash: gulp: command not found

    在mac系统下安装gulp,之后执行gulp 报如下错误: -bash: gulp: command not found 回溯安装过程发现问题如下 1.执行 npm root: Application ...

  8. Linux pip命令报错 -bash: pip: command not found

    下载 $ wget https://bootstrap.pypa.io/get-pip.py 安装 $ python get-pip.py 查看版本 $ pip -V 查看安装路径: find / - ...

  9. linux 报错 bash ‘/bin/sh: Syntax error: “(” unexpected

    今天用make 编译 蹦到 bash ‘/bin/sh: Syntax error: “(” unexpected 和 /bin/sh: [[: not found 这种莫名奇妙的错误 原因是是lin ...

随机推荐

  1. LOJ #6539 奇妙数论题

    不想咕太久..就随便找个题更一下 LOJ#6539 题意 求题面里那个式子 题解 有一个常用的小式子 $$\sum_{x|a,x|b}\varphi(x)=\gcd(a,b)$$ 用这个式子直接对题面 ...

  2. HTML和XHTML区别

    HTML和XHTML 可扩展超文本标记语言XHTML(eXtensible HyperText Markup Language)是将超文本标记语言HTML(HyperText Markup Langu ...

  3. 拷贝本地文件到docker容器

    查找所有容器 docker ps -a 查找容器长ID docker inspect -f '{{.ID}}' python 拷贝本地文件到容器 docker cp 本地路径 容器长ID:容器路径

  4. VS2017 性能优化方法

    原文地址:https://www.cnblogs.com/mahatmasmile/p/10394168.html 出处1:https://docs.microsoft.com/zh-cn/visua ...

  5. Idea中一些常用设置

    idea展开和折叠方法的快捷键 Ctrl+”+/-”,当前方法展开.折叠Ctrl+Shift+”+/-”,全部展开.折叠 idea中也有自定代码块的功能 //region 描述.....业务代码//e ...

  6. j2ee之监听页面请求

    本博客的起因是我想监听浏览器端每个页面都访问了哪些资源~~: 我是个菜鸡,所以我要记在我的小本本上,我怕忘了又~~~: 代码我是写在springboot2.1中的,有兴趣的同学可以玩一下~ 1:代码如 ...

  7. python 视频转成代码视频

    # -*- coding:utf-8 -*- # coding:utf-8 import os, cv2, subprocess, shutil from cv2 import VideoWriter ...

  8. 洛谷P5284 [十二省联考2019]字符串问题 [后缀树]

    传送门 思路 设\(dp_i\)表示以\(i\)结尾的\(A\)串,能达到的最长长度. 然后发现这显然可以\(i\)往自己控制的\(k\)连边,\(k\)往能匹配的\(j\)连边,就是个最长路,只要建 ...

  9. ffmypeg 视频处理类库使用方法

    (经常用到ffmpeg 做一些视频数据的处理转换等,用来做测试,今天总结了一下,参考了网上部分朋友的经验,一起在这里汇总了一下,有需要的朋友可以收藏测试一下,有问题欢迎在下面回帖交流,谢谢;by te ...

  10. Revit二次开发 推荐

    学习revit二次开发,建议还是先把revit熟悉一下,去建立一下模型,亲自感受一下是如何创建模型的流程,其中会遇到什么问题.这样在自己做二次开发的时候,一些问题自己就能提前想到,规避掉.我大概用了半 ...