﻿---
title: config context remove cli command
description: Remove a context from the config file 
url: https://www.elastic.co/elastic/docs-builder/docs/4118/reference/elastic-cli/cli/config/context/remove
applies_to:
  - Elastic Cloud Serverless: Preview
  - Elastic Stack: Preview
---

# config context remove cli command
```bash
elastic config context remove <name> [options]
```

Remove a context from the config file

## Arguments

<definitions>
  <definition term="<name> string required">
    context name
  </definition>
</definitions>


## Options

<definitions>
  <definition term="--force">
    allow removing the current context
  </definition>
</definitions>


## config Options

<definitions>
  <definition term="--config-file string">
    path to the config file to edit (defaults to ~/.elasticrc.yml)
  </definition>
  <definition term="--dry-run">
    validate all inputs and exit without performing any action (preview changes without applying them)
  </definition>
</definitions>


## Global Options

<definitions>
  <definition term="--json">
    output as JSON
  </definition>
</definitions>