FreeKB - OpenShift Change Project using the oc project command
OpenShift - Change Project using the oc project command

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

Before you can use the oc projects command, you must first login using the oc login command

Before selecting or changing your selected project, you'll probably want to use the oc get projects command to list the available and currently selected project. Let's say the oc get projects command returns the following, which indicates that project2 is the currently selected project.

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 oc project command followed by the project name will change your current project. In this example, project1 becomes the selected project.

oc project project1
. . .
Now using project "project1" on server "".


By default, the output will include "Now using project namespace on server hostname". The -q flag or --short=true option can be used to only return the project name.

oc project project1 --short=true
. . .


Add a Comment

We will never share your name or email with anyone. Enter your email if you would like to be notified when we respond to your comment.

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


Web design by yours truely - me, myself, and I   |   |