Cloud Foundry CLI Reference Guide

Page last updated:

This topic is a reference guide for Cloud Foundry Command Line Interface (cf CLI) commands.

Overview

The sections in this topic include all the commands you can run in the cf CLI. For information about the options you can use with each command, see the corresponding page in the Cloud Foundry CLI Reference Guide from Cloud Foundry.

Name

cf - A command line tool to interact with Pivotal Platform

Usage

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

Version

6.46.1+4934877ec.2019-08-23

Getting Started

This table describes the cf CLI commands that provide basic information about the cf CLI, log you in or out of Pivotal Platform, interact with the API, and authenticate non-interactively.

Command Description
help Show help.
version Show the version.
login Log in to Pivotal Platform.
logout Log out of Pivotal Platform.
passwd Change your user password.
target Set or view the targeted org or space.
api Set or view the target API URL.
auth Authenticate non-interactively.

Apps

This table describes the cf CLI commands that allow you to view and manage apps in your Pivotal Platform foundation.

Command Description
apps List all apps in the target space.
app Display health and status for an app.
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.
start Start an app.
stop Stop an app.
restart Stop all instances of the app, then restart them. This causes app downtime.
restage Recreate the app’s executable artifact using the latest pushed app files and the latest environment, including variables, service bindings, buildpack, stack, etcetera. This causes app downtime.
restart-app-instance Stop, then restart an app instance.
run-task Run a one-off task on an app.
tasks List all tasks of an app.
terminate-task Stop a running task of an app.
events Show recent app events.
files Show a list of files in a directory or the contents of a specific file of an app running on the DEA back end.
logs Tail or show recent logs for an app.
env Show all environment variables for an app.
set-env Set an environment variable for an app.
unset-env Remove an environment 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.
copy-source Copy the source code of an app to another existing app, then restart that app.
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 the type of health check performed on an app.
enable-ssh Enable SSH for an app.
disable-ssh Disable SSH for an app.
ssh-enabled Show whether SSH is enabled on an app container instance.
ssh SSH into an app container instance.

Services

This table describes the cf CLI commands that allow you to view and manage service instances in your Pivotal Platform foundation.

Command Description
marketplace List all available offerings in the marketplace.
services List all service instances in the target space.
service Show service instance information.
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 a key for a service instance.
service-keys List all keys for a service instance.
service-key Show service key information.
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 Pivotal Platform apps.
update-user-provided-service Update a user-provided service instance.
share-service Share a service instance with another space.
unshare-service Unshare a shared service instance from a space.

Orgs

This table describes the cf CLI commands that allow you to view and manage orgs in your Pivotal Platform foundation.

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

Spaces

This table describes the cf CLI commands that allow you to view and manage spaces in your Pivotal Platform foundation.

Command Description
spaces List all spaces in an org.
space Show space information.
create-space Create a space.
delete-space Delete a space.
rename-space Rename a space.
allow-space-ssh Enable SSH access for a space.
disallow-space-ssh Disable SSH access for a space.
space-ssh-allowed Show whether SSH access is enabled in a space.

Domains

This table describes the cf CLI commands that allow you to view and manage domains in your Pivotal Platform foundation.

Command Description
domains List all domains in the target org.
create-domain Create a domain in an org for later use.
delete-domain Delete a domain.
create-shared-domain Create a domain that can be used by all orgs. Only admin users can run this command.
delete-shared-domain Delete a shared domain.
router-groups List all router groups.

Routes

This table describes the cf CLI commands that allow you to view and manage routes in your Pivotal Platform foundation.

Command Description
routes List all routes in the current space or org.
create-route Create a URL route in a space for later use.
check-route Check whether a route currently exists.
map-route Add a URL route to an app.
unmap-route Remove a URL route from an app.
delete-route Delete a route.
delete-orphaned-routes Delete all orphaned routes in the currently targeted space, such as those that are not mapped to an app.

Network Traffic Policies

This table describes the cf CLI commands that allow you to view and manage network traffic policies in your Pivotal Platform foundation.

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

Buildpacks

This table describes the cf CLI commands that allow you to view and manage buildpacks in your Pivotal Platform foundation.

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

User Admin

This table describes the cf CLI commands that allow you to view and manage users in your Pivotal Platform foundation.

Command Description
create-user Create a new user.
delete-user Delete a user.
org-users List all 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 List all 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

This table describes the cf CLI commands that allow you to view and manage orgs in your Pivotal Platform foundation.

Command Description
quotas List all available usage quotas.
quota Show quota information.
set-quota Assign a quota to an org.
create-quota Define a new resource quota.
delete-quota Delete a resource quota.
update-quota Update an existing resource quota.
share-private-domain Share a private domain with an org.
unshare-private-domain Unshare a private domain with an org.

Space Admin

This table describes the cf CLI commands that allow you to view and manage spaces in your Pivotal Platform foundation.

Command Description
space-quotas List all available space resource quotas.
space-quota Show space resource quota information.
create-space-quota Define a new space resource quota.
update-space-quota Update an existing space resource quota.
delete-space-quota Delete a space resource quota definition and unassign the space resource quota from all spaces.
set-space-quota Assign a space resource quota definition to a space.
unset-space-quota Unassign a space resource quota from a space.

Service Admin

This table describes the cf CLI commands that allow you to view and manage services in your Pivotal Platform foundation.

Command Description
service-auth-tokens List all service authentication tokens.
create-service-auth-token Create a service authentication token.
update-service-auth-token Update a service authentication token.
delete-service-auth-token Delete a service authentication token.
service-brokers List all 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.
migrate-service-instances Migrate service instances from one service plan to another.
purge-service-offering Recursively remove a service and child objects from the Pivotal Platform database without making requests to a service broker.
purge-service-instance Recursively remove a service instance and child objects from Pivotal Platform database without making requests to a service broker.
service-access List all service access settings.
enable-service-access Enable access to a service or service plan for one or all orgs.
disable-service-access Disable access to a service or service plan for one or all orgs.

Security Group

This table describes the cf CLI commands that allow you to view and manage security groups in your Pivotal Platform foundation.

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 apps.
staging-security-groups List all security groups in the staging set for apps.
unbind-staging-security-group Unbind a security group from the set of security groups for staging apps.
bind-running-security-group Bind a security group to the list of security groups to be used for running apps.
running-security-groups List all security groups in the set of security groups for running apps.
unbind-running-security-group Unbind a security group from the set of security groups for running apps.

Environment Variable Groups

This table describes the cf CLI commands that allow you to view and manage environment variable groups in your Pivotal Platform foundation.

Command Description
running-environment-variable-group List all contents of the running environment variable group.
staging-environment-variable-group List all 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

This table describes the cf CLI commands that allow you to view and manage isolation segments in your Pivotal Platform foundation.

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 Enable an org to use an isolation segment.
disable-org-isolation Disable an org from using 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

This table describes the cf CLI commands that allow you to view and manage feature flags in your Pivotal Platform foundation.

Command Description
feature-flags List all feature flags with their statuses.
feature-flag Show an individual feature flag with its status.
enable-feature-flag Enable the use of a feature flag.
disable-feature-flag Disable the use of a feature flag.

Advanced

This table describes the cf CLI commands that allow you to perform advanced tasks in your Pivotal Platform foundation.

Command Description
curl Execute a request to the targeted API endpoint.
config Write default values to the configuration.
oauth-token Retrieve and display the OAuth token for the current session.
ssh-code Get a one-time password for SSH clients.

Add or Remove Plugin Repository

This table describes the cf CLI commands that allow you to add or remove plugin repositories in your Pivotal Platform foundation.

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

Add or Remove Plugin

This table describes the cf CLI commands that allow you to add or remove plugins in your Pivotal Platform foundation.

Command Description
plugins List all commands of installed plugins.
install-plugin Install a plugin.
uninstall-plugin Uninstall a plugin.

Environment Variables

This table describes the cf CLI environment variables that you can set for your Pivotal Platform foundation.

Variable Description
CF_COLOR=false Do not colorize output.
CF_DIAL_TIMEOUT=5 Maximum wait time to establish a connection, including name resolution, in seconds.
CF_HOME=path/to/dir/ Override the path to the default config directory.
CF_PLUGIN_HOME=path/to/dir/ Override the path to the 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.
all_proxy=proxy.example.com:8080 Specify a proxy server to enable proxying for all requests.
https_proxy=proxy.example.com:8080 Enable proxying for HTTP requests.

Global Options

This table describes the global options for cf CLI commands.

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

Apps (Beta)

This table describes the cf CLI commands that are currently in beta.

Command Description
v3-apps List all apps in the target space.
v3-create-app Create a V3 app.
v3-push Push a new app or sync changes to an existing app.
v3-scale Change or view the instance count, disk space limit, and memory limit for an app.
v3-delete Delete a V3 app.
v3-start Start an app.
v3-stop Stop an app.
v3-restart Stop all instances of the app, then restart them. This causes downtime.
v3-stage Create a new droplet for an app.
v3-restart-app-instance Stop, then restart an app instance.
v3-apply-manifest Apply manifest properties to an app.
v3-droplets List all droplets of an app.
v3-set-droplet Set the droplet used to run an app.
v3-env List all environment variables for an app.
v3-set-env Set an environment variable for an app.
v3-unset-env Remove an environment variable from an app.
v3-get-health-check Show the type of health check performed on an app.
v3-set-health-check Change the type of health check performed on an app’s process.
v3-packages List all packages of an app.
v3-create-package Upload a V3 package.
v3-ssh SSH into an app container instance.