I Got Tired of Passing --profile on Every OCI CLI Command The article describes the problem of managing multiple Oracle Cloud Infrastructure (OCI) tenancies via the CLI, which requires passing both `--compartment-id` and `--profile` flags on every command. The author created a tool called `ocswitch` that simplifies this by using separate config files per tenancy (e.g., `~/.oci/config_prod`) and persisting the active profile across terminal sessions via a state file (`~/.oci/active_profile`). The tool also includes tab completion and an `ocid` function to display the current tenancy and user details for confirmation. This is a problem you only run into if you work for Oracle directly or you work at a Cloud/DevOps MSP managing OCI for multiple clients. Most people will never touch it. If you are reading this, you are probably not most people. The OCI CLI already demands a --compartment-id on almost every command. Compartment IDs are long, they are not memorable, and you need a different one depending on what you are looking at. That was already a nightmare before you add multiple tenancies to the picture. Once you are juggling prod, staging, dev, and a handful of client accounts, passing --profile on top of --compartment-id on every single command becomes the kind of friction that breaks you. So I wrote ocswitch . What the OCI CLI Actually Gives You The OCI CLI reads config from ~/.oci/config by default. You can point it at a different file with OCI CONFIG FILE , and select a named profile within that file with OCI CLI PROFILE . That is the full surface area you have to work with. The multi-profile story in the official tooling is basically: put multiple PROFILE NAME sections in one config file and pass --profile PROFILE NAME every time. If you forget the flag, you hit whichever profile is in DEFAULT . This works but it is tedious, and it is session-scoped - export the env var in one terminal, open another, you are back to default. ocswitch fixes the persistence problem by writing the active profile to ~/.oci/active profile and restoring it at shell startup. How It Works Profiles are separate config files in ~/.oci/ : ~/.oci/config prod ~/.oci/config staging ~/.oci/config dev One file per tenancy, named config