ibmcloud-target
Set IBM Cloud target context
TLDR
View the current target account and region
Set the target account
Switch to a specific region
Set the target resource group
Clear the targeted region
Clear the targeted resource group
SYNOPSIS
ibmcloud target [-g GROUP] [-o ORG] [-s SPACE] [-r REGION] [-u] [-v]
PARAMETERS
-g, --group GROUP
Sets the target resource group name (requires login)
-h, --help
Displays command help
-o, --org ORG
Sets the target Cloud Foundry organization name (requires login)
-r, --region REGION
Sets the target login region (e.g., "us-south")
-s, --space SPACE
Sets the target Cloud Foundry space name (requires login)
-u, --unset
Unsets the current target context
-v, --verbose
Enables verbose output
DESCRIPTION
The ibmcloud target command manages the current target context in the IBM Cloud CLI, which defines the active environment including login region, account, resource group, organization (org), and space. This is essential for directing CLI operations to specific IBM Cloud resources, particularly for Cloud Foundry (CF) apps and services.
Running ibmcloud target without arguments displays the current target details. Use options to set a new target: specify -r for region (e.g., us-south), -g for resource group, -o for CF organization, and -s for CF space. The -u flag unsets the target, reverting to no active context.
This command ensures commands like ibmcloud cf push or resource management target the correct scope. It requires prior authentication via ibmcloud login. Targets persist across sessions unless unset.
CAVEATS
Requires prior ibmcloud login; CF options (-o, -s, -g) only apply post-authentication and for CF-enabled accounts. Not all regions support all services.
EXAMPLES
ibmcloud target # Show current target
ibmcloud target -g mygroup -o myorg -s prod # Set CF target
ibmcloud target -r eu-gb -u # Unset after region change
TARGET PERSISTENCE
Targets are stored in ~/.bluemix/target.json (legacy) or CLI config; use ibmcloud config --unset target for cleanup.
HISTORY
Introduced in IBM Cloud CLI (formerly bx CLI from Bluemix era, rebranded ~2018). Evolved to support multi-account, resource groups post-2019 IBM Cloud updates.


