Commands Cheat Sheet

Evaluating engineering tools? Get the comparison in Google Sheets

(Perfect for making buy/build decisions or internal reviews.)

Most-used commands
Your email is safe thing.

Thankyou for your submission

We have sent the cheatsheet on your email!
Oops! Something went wrong while submitting the form.

Connection

oc login
Authenticate with an OpenShift cluster

oc logout
Log out of current session

oc whoami
Show current logged in user

oc status
Show a high-level overview of the current project

Project Management

oc project
Switch to a project

oc new-project
Create a new project

oc get projects
List all projects

oc delete project
Delete a project

Resource Management

oc get
List resources (pods, services, deployments, etc.)

oc get -o yaml
Describe a resource in YAML format

oc describe
Show detailed information about a resource

oc edit
Edit a resource

oc delete
Delete a resource

Pod Operations

oc get pods
List pods in current project

oc logs
View pod logs

oc logs -f
Stream pod logs

oc exec -it --
Execute command in a pod

oc rsh
Open a remote shell into a pod

oc port-forward :
Forward local port to pod port

Deployment Operations

oc rollout status deployment/
Check deployment status

oc rollout history deployment/
View deployment history

oc rollout undo deployment/
Rollback to previous deployment

oc scale deployment/ --replicas=
Scale deployment

Resource Creation

oc create -f
Create resource from file

oc apply -f
Create or update resource from file

oc new-app
Create a new application

oc start-build
Start a new build

Observability

oc get events
List events in current project

oc adm top nodes
Show CPU/memory usage of nodes

oc adm top pods
Show CPU/memory usage of pods

oc get routes
List routes (ingress points)

Troubleshooting

oc debug node/
Debug a node

oc debug deployment/
Debug a deployment

oc get nodes
List nodes and their status

oc adm diagnostics
Run diagnostics

oc get pod -o yaml
Get pod definition for troubleshooting