// Module included in the following assemblies:
//
// * cli_reference/openshift_cli/extending-cli-plugins.adoc

:_content-type: PROCEDURE
[id="cli-installing-plugins_{context}"]
= Installing and using CLI plug-ins

After you write a custom plug-in for the {product-title} CLI, you must install
it to use the functionality that it provides.

.Prerequisites

* You must have the `oc` CLI tool installed.
* You must have a CLI plug-in file that begins with `oc-` or `kubectl-`.

.Procedure

. If necessary, update the plug-in file to be executable.
+
[source,terminal]
----
$ chmod +x <plugin_file>
----
. Place the file anywhere in your `PATH`, such as `/usr/local/bin/`.
+
[source,terminal]
----
$ sudo mv <plugin_file> /usr/local/bin/.
----
. Run `oc plugin list` to make sure that the plug-in is listed.
+
[source,terminal]
----
$ oc plugin list
----
+
.Example output
[source,terminal]
----
The following compatible plug-ins are available:

/usr/local/bin/<plugin_file>
----
+
If your plug-in is not listed here, verify that the file begins with `oc-`
or `kubectl-`, is executable, and is on your `PATH`.
. Invoke the new command or option introduced by the plug-in.
+
For example, if you built and installed the `kubectl-ns` plug-in from the
 link:https://github.com/kubernetes/sample-cli-plugin[Sample plug-in repository],
  you can use the following command to view the current namespace.
+
[source,terminal]
----
$ oc ns
----
+
Note that the command to invoke the plug-in depends on the plug-in file name.
For example, a plug-in with the file name of `oc-foo-bar` is invoked by the `oc foo bar`
command.
