xhost command not found

In this troubleshooting guide we learn how to fix xhost command not found error message

Introduction

When you run more command in linux terminal / console, you get the following error message

xhost: command not found

or when using sudo you get the following error message

sudo: xhost: command not found

Solutions to xhost: command not found

How To Fix xhost: command not found in Ubuntu / Debian / Kali Linux / Raspbian

In Ubuntu xhost is provided by x11-xserver-utils package.

x11-xserver-utils is:

An X client is a program that interfaces with an X server (almost always via the X libraries), and thus with some input and output hardware like a graphics card, monitor, keyboard, and pointing device (such as a mouse).

This package provides a miscellaneous assortment of X Server utilities that ship with the X Window System, including:

  • iceauth, a tool for manipulating ICE protocol authorization records;
  • rgb;
  • sessreg, a simple program for managing utmp/wtmp entries;
  • xcmsdb, a device color characteristic utility for the X Color Management System;
  • xgamma, a tool for querying and setting a monitor’s gamma correction;
  • xhost, a very dangerous program that you should never use;
  • xmodmap, a utility for modifying keymaps and pointer button mappings in X;
  • xrandr, a command-line interface to the RandR extension;
  • xrdb, a tool to manage the X server resource database;
  • xrefresh, a tool that forces a redraw of the X screen;
  • xset, a tool for setting miscellaneous X server parameters;
  • xsetmode and xsetpointer, tools for handling X Input devices;
  • xsetroot, a tool for tailoring the appearance of the root window;
  • xstdcmap, a utility to selectively define standard colormap properties;
  • xvidtune, a tool for customizing X server modelines for your monitor.

To fix this problem, we can install more using the command below.

sudo apt-get -y install x11-xserver-utils

This command might take some time to finish depending on your machine internet connection.

You can also use apt command to install x11-xserver-utils.

sudo apt -y install x11-xserver-utils

Or if you have aptitude installed you can use the following command.

sudo aptitude install x11-xserver-utils

Summary

In this tutorial we learn how to fix xhost command not found error in Ubuntu / Debian / Kali Linux or Raspbian distribution.