Cloud Foundry CLI Reference Guide

Page last updated:


cf - A command line tool to interact with Cloud Foundry


cf [global options] command [arguments…] [command options]



Getting Started

Command Description
help Show help
version Print the version
login Log user in
logout Log user out
passwd Change user password
target Set or view the targeted org or space
api Set or view target api url
auth Authenticate non-interactively


Command Description
apps List all apps in the target space
app Display health and status for an app
create-app Create an Application in the target space
push Push a new app or sync changes to an existing app
scale Change or view the instance count, disk space limit, and memory limit for an app
delete Delete an app
rename Rename an app
cancel-deployment Cancel the most recent deployment for an app. Resets the current droplet to the previous deployment’s droplet.
start Start an app
stop Stop an app
restart Stop all instances of the app, then start them again.
stage-package Stage a package into a droplet
restage Stage the app’s latest package into a droplet and restart the app with this new droplet and updated configuration (environment variables, service bindings, buildpack, stack, etc.).
restart-app-instance Terminate, then instantiate an app instance
run-task Run a one-off task on an app
tasks List tasks of an app
terminate-task Terminate a running task of an app
packages List packages of an app
create-package Uploads a Package
droplets List droplets of an app
set-droplet Set the droplet used to run an app
download-droplet Download an application droplet
events Show recent app events
logs Tail or show recent logs for an app
env Show all env variables for an app
set-env Set an env variable for an app
unset-env Remove an env variable from an app
stacks List all stacks (a stack is a pre-built file system, including an operating system, that can run apps)
stack Show information for a stack (a stack is a pre-built file system, including an operating system, that can run apps)
copy-source Copies the source code of an application to another existing application and restages that application
create-app-manifest Create an app manifest for an app that has been pushed successfully
get-health-check Show the type of health check performed on an app
set-health-check Change type of health check performed on an app’s process
enable-ssh Enable ssh for the application
disable-ssh Disable ssh for the application
ssh-enabled Reports whether SSH is enabled on an application container instance
ssh SSH to an application container instance


Command Description
marketplace List available offerings in the marketplace
services List all service instances in the target space
service Show service instance info
create-service Create a service instance
update-service Update a service instance
delete-service Delete a service instance
rename-service Rename a service instance
create-service-key Create key for a service instance
service-keys List keys for a service instance
service-key Show service key info
delete-service-key Delete a service key
bind-service Bind a service instance to an app
unbind-service Unbind a service instance from an app
bind-route-service Bind a service instance to an HTTP route
unbind-route-service Unbind a service instance from an HTTP route
create-user-provided-service Make a user-provided service instance available to CF apps
update-user-provided-service Update user-provided service instance
share-service Share a service instance with another space
unshare-service Unshare a shared service instance from a space


Command Description
orgs List all orgs
org Show org info
create-org Create an org
delete-org Delete an org
rename-org Rename an org


Command Description
spaces List all spaces in an org
space Show space info
create-space Create a space
delete-space Delete a space
rename-space Rename a space
apply-manifest Apply manifest properties to a space
allow-space-ssh Allow SSH access for the space
disallow-space-ssh Disallow SSH access for the space
space-ssh-allowed Reports whether SSH is allowed in a space


Command Description
domains List domains in the target org
create-private-domain Create a private domain for a specific org
delete-private-domain Delete a private domain
create-shared-domain Create a domain that can be used by all orgs (admin-only)
delete-shared-domain Delete a shared domain
router-groups List router groups


Command Description
routes List all routes in the current space or the current organization
create-route Create a route for later use
check-route Perform a check to determine whether a route currently exists or not
map-route Map a route to an app
unmap-route Remove a route from an app
delete-route Delete a route
delete-orphaned-routes Delete all orphaned routes in the currently targeted space (i.e. those that are not mapped to an app or service instance)

Network Policies

Command Description
network-policies List direct network traffic policies
add-network-policy Create policy to allow direct network traffic from one app to another
remove-network-policy Remove network traffic policy of an app


Command Description
buildpacks List all buildpacks
create-buildpack Create a buildpack
update-buildpack Update a buildpack
delete-buildpack Delete a buildpack

User Admin

Command Description
create-user Create a new user
delete-user Delete a user
org-users Show org users by role
set-org-role Assign an org role to a user
unset-org-role Remove an org role from a user
space-users Show space users by role
set-space-role Assign a space role to a user
unset-space-role Remove a space role from a user

Org Admin

Command Description
org-quotas List available organization quotas
org-quota Show organization quota
set-org-quota Assign a quota to an organization
create-org-quota Define a new quota for an organization
delete-org-quota Delete an organization quota
update-org-quota Update an existing organization quota
share-private-domain Share a private domain with a specific org
unshare-private-domain Unshare a private domain with a specific org

Space Admin

Command Description
space-quotas List available space quotas
space-quota Show space quota info
create-space-quota Define a new quota for a space
update-space-quota Update an existing space quota
delete-space-quota Delete a space quota
set-space-quota Assign a quota to a space
unset-space-quota Unassign a quota from a space

Service Admin

Command Description
service-brokers List service brokers
create-service-broker Create a service broker
update-service-broker Update a service broker
delete-service-broker Delete a service broker
rename-service-broker Rename a service broker
purge-service-offering Recursively remove a service offering and child objects from Cloud Foundry database without making requests to a service broker
purge-service-instance Recursively remove a service instance and child objects from Cloud Foundry database without making requests to a service broker
service-access List service access settings
enable-service-access Enable access to a service offering or service plan for one or all orgs
disable-service-access Disable access to a service offering or service plan for one or all orgs

Security Group

Command Description
security-group Show a single security group
security-groups List all security groups
create-security-group Create a security group
update-security-group Update a security group
delete-security-group Deletes a security group
bind-security-group Bind a security group to a particular space, or all existing spaces of an org
unbind-security-group Unbind a security group from a space
bind-staging-security-group Bind a security group to the list of security groups to be used for staging applications globally
staging-security-groups List security groups globally configured for staging applications
unbind-staging-security-group Unbind a security group from the set of security groups for staging applications globally
bind-running-security-group Bind a security group to the list of security groups to be used for running applications
running-security-groups List security groups globally configured for running applications
unbind-running-security-group Unbind a security group from the set of security groups for running applications globally

Environment Variable Groups

Command Description
running-environment-variable-group Retrieve the contents of the running environment variable group
staging-environment-variable-group Retrieve the contents of the staging environment variable group
set-staging-environment-variable-group Pass parameters as JSON to create a staging environment variable group
set-running-environment-variable-group Pass parameters as JSON to create a running environment variable group

Isolation Segments

Command Description
isolation-segments List all isolation segments
create-isolation-segment Create an isolation segment
delete-isolation-segment Delete an isolation segment
enable-org-isolation Entitle an organization to an isolation segment
disable-org-isolation Revoke an organization’s entitlement to an isolation segment
set-org-default-isolation-segment Set the default isolation segment used for apps in spaces in an org
reset-org-default-isolation-segment Reset the default isolation segment used for apps in spaces of an org
set-space-isolation-segment Assign the isolation segment for a space
reset-space-isolation-segment Reset the space’s isolation segment to the org default

Feature Flags

Command Description
feature-flags Retrieve list of feature flags with status
feature-flag Retrieve an individual feature flag with status
enable-feature-flag Allow use of a feature
disable-feature-flag Prevent use of a feature


Command Description
labels List all labels (key-value pairs) for an API resource
set-label Set a label (key-value pairs) for an API resource
unset-label Unset a label (key-value pairs) for an API resource


Command Description
curl Executes a request to the targeted API endpoint
config Write default values to the config
oauth-token Display the OAuth token for the current session and refresh the token if necessary
ssh-code Get a one time password for ssh clients

Add/remove Plugin Repository

Command Description
add-plugin-repo Add a new plugin repository
remove-plugin-repo Remove a plugin repository
list-plugin-repos List all the added plugin repositories
repo-plugins List all available plugins in specified repository or in all added repositories

Add/remove Plugin

Command Description
plugins List commands of installed plugins
install-plugin Install CLI plugin
uninstall-plugin Uninstall CLI plugin

Environment Variables

Variable Description
CF_COLOR=false Do not colorize output
CF_DIAL_TIMEOUT=6 Max wait time to establish a connection, including name resolution, in seconds
CF_HOME=path/to/dir/ Override path to default config directory
CF_PLUGIN_HOME=path/to/dir/ Override path to default plugin config directory
CF_TRACE=true Print API request diagnostics to stdout
CF_TRACE=path/to/trace.log Append API request diagnostics to a log file Specify a proxy server to enable proxying for all requests Enable proxying for HTTP requests

Global Options

Option Description
–help, -h Show help
-v Print API request diagnostics to stdout

Experimental Commands

Command Description
revisions List revisions of an app
revision Show details for a specific app revision
rollback Rollback to the specified revision of an app