Skip to content

CF CLI Commands Reference

Authentication

bash cf login -a <API> # Login with password cf login -a <API> --sso # Login with SSO cf logout # Logout cf auth <USERNAME> <PASSWORD> # Authenticate cf target # Show current target cf target -o ORG -s SPACE # Switch org/space

Organizations and Spaces

```bash

Organizations

cf orgs # List organizations cf create-org # Create org cf delete-org # Delete org cf org # Show org details

Spaces

cf spaces # List spaces in current org cf create-space # Create space cf delete-space # Delete space cf space # Show space details ```

Applications

```bash

Push and manage

cf push # Deploy app cf push -i 3 # Deploy with 3 instances cf push -m 1G # Deploy with 1GB memory cf push --health-check-type http # With health checks

cf apps # List apps cf app # Show app details cf start # Start app cf stop # Stop app cf restart # Restart app cf restage # Restage app cf delete # Delete app

Scaling

cf scale -i 5 # Set to 5 instances cf scale -m 2G # Set to 2GB memory cf scale -i 3 -m 512M # Both instance and memory

Environment

cf env # Show environment cf set-env KEY VALUE # Set variable cf unset-env KEY # Unset variable cf logs # Stream logs cf logs --recent # Show recent logs cf events # Show events cf stats # Show resource usage ```

Routes and Domains

```bash

Routes

cf routes # List all routes cf app-routes # Routes for app cf create-route --hostname # Create route cf map-route --hostname # Map to app cf unmap-route --hostname # Unmap from app cf delete-route --hostname # Delete route

Domains

cf domains # List domains cf create-domain # Create domain cf delete-domain # Delete domain ```

Services and Bindings

```bash

Services

cf marketplace # Show available services cf services # List service instances cf create-service # Create service cf update-service -p # Change plan cf delete-service # Delete service cf service # Show service details

Bindings

cf bind-service # Bind service to app cf unbind-service # Unbind service cf bind-route-service --hostname # Route service

Service keys

cf create-service-key # Create key cf service-key # Show key cf delete-service-key # Delete key ```

Users and Roles

```bash

Users

cf create-user # Create user cf delete-user # Delete user cf passwd # Change password

Organization roles

cf org-users # Show org users cf set-org-role # Assign org role cf unset-org-role # Remove org role

Space roles

cf space-users # Show space users cf set-space-role # Assign role cf unset-space-role # Remove role ```

Quotas and Limits

```bash

Organization quotas

cf quotas # List quotas cf create-quota ... # Create quota cf set-quota # Apply quota cf quota # Show quota details

Space quotas

cf space-quotas # List space quotas cf create-space-quota # Create space quota cf set-space-quota # Apply space quota ```

Buildpacks

bash cf buildpacks # List buildpacks cf create-buildpack <NAME> <FILE> <POSITION> # Create cf delete-buildpack <NAME> # Delete cf update-buildpack <NAME> <FILE> # Update

Security Groups

bash cf security-groups # List groups cf create-security-group <GROUP> <RULES> # Create cf delete-security-group <GROUP> # Delete cf bind-security-group <GROUP> <ORG> <SPACE> # Bind cf unbind-security-group <GROUP> <ORG> <SPACE> # Unbind

Advanced

```bash

Manifest

cf push -f manifest.yml # Deploy with manifest

SSH into app

cf ssh # SSH into instance 0 cf ssh -i 2 # SSH into instance 2

SSH key management

cf enable-ssh # Enable SSH cf disable-ssh # Disable SSH

One-off tasks

cf run-task "" # Run command in app cf tasks # List running tasks ```


For manifest syntax, see Manifest Reference.