Bootstrap FreeKB - OpenShift - List projects using the oc get projects command
OpenShift - List projects using the oc get projects command

Updated:   |  OpenShift articles

If you are not familiar with the oc command, refer to OpenShift - Getting Started with the oc command.

The oc get projects command will list the available projects, like this. The * character is used to indicate the current project being used.

The oc config view or oc get apiserver commands can be used to display the API Server URL ( in this example).

oc get projects

You have access to the following projects and can switch between them with 'oc project <projectname>':

 * project2
   et cetera

Using project "project2" on server "".


The -q or --short flag can be used to display only the project names.

~]# oc get projects --short


--short=false can be used to return something like this.

oc get projects --short=false

Using project "project2" on server "".


The oc describe projects command will describe every project.

oc describe projects


The oc describe project/project_name will describe a specific project. In this example, the foo project will be described.

oc describe project/foo


Something like this should be returned.

Name:                   foo
Created:                2 months ago
Labels:                 <none>
Display Name:           <none>
Description:            <none>
Status:                 Active
Node Selector:          <none>
Quota:                  <none>
Resource limits:        <none>


Or, the oc get projects command with the --output json‚Äč or --output yaml option can be used.

~]$ oc get project foo --output json
    "apiVersion": "",
    "kind": "Project",
    "metadata": {
        "annotations": {
            "": "",
            "": "",
            "": "c065234",
            "": "s0:c29,c4",
            "": "1000820000/10000",
            "": "1000820000/10000"
        "creationTimestamp": "2021-12-29T05:49:11Z",
        "labels": {
            "": "foo"
        "name": "foo",
        "resourceVersion": "411411327",
        "uid": "74fe0011-b0d4-4378-827b-971556803367"
    "spec": {
        "finalizers": [
    "status": {
        "phase": "Active"


The --output jsonpath option can be used to print the value of a specific JSON key.

~]$ oc get project foo --output jsonpath={.status.phase}


Did you find this article helpful?

If so, consider buying me a coffee over at Buy Me A Coffee


Add a Comment

Please enter ff9653 in the box below so that we can be sure you are a human.