What Are Slash Commands in GitHub Copilot CLI?
If you have been exploring GitHub Copilot CLI and want to get more out of every session, slash commands are one of the first concepts worth mastering. These are built-in controls that you access directly from the command line, acting as your personal control surface within the Copilot CLI environment. Rather than navigating menus or leaving the terminal entirely, slash commands let you guide Copilot's behavior, inspect changes, manage context, switch models, check token usage, and resume past sessions — all without breaking your workflow.
This guide is part of the ongoing GitHub Copilot CLI for Beginners series, which covers everything you need to start working confidently with Copilot in the terminal. In previous installments, we walked through how to get started and when to use interactive versus non-interactive modes. Now it's time to go deeper and explore how slash commands give you fine-grained control over your Copilot CLI experience.
Why Slash Commands Matter for Developers
Speed and precision are everything when you are working in the terminal. Slash commands eliminate the need to leave your workflow to adjust settings, look up context, or manage your session. Whether you are a solo developer running quick scripts or part of a larger engineering team navigating complex repositories, slash commands reduce friction and keep you focused on the task at hand.
More importantly, slash commands give you direct access to features that would otherwise require multiple steps. Switching AI models, reviewing what context Copilot currently has, clearing that context, or checking how many tokens you have consumed in a session — these are all actions that become effortless once you know the right command. Think of slash commands as keyboard shortcuts for your AI-assisted terminal experience.
Common Slash Commands and What They Do
GitHub Copilot CLI comes with a set of commonly used slash commands designed to make your sessions more manageable and productive. Here is a breakdown of the most important ones and what each one enables you to do.
/help
When you are just getting started or forget what a specific command does, /help is your first stop. Typing this command displays a list of all available slash commands along with brief descriptions of what they do. It is the built-in reference guide you can access at any moment without ever leaving the terminal.
/model
One of the most practical slash commands available is /model. This command allows you to switch between different AI models supported by GitHub Copilot CLI. If you want more creative output, faster responses, or a model optimized for a specific coding task, you can make that change on the fly. This flexibility means you are not locked into a single model for the duration of your session and can experiment to find what works best for the problem you are solving.
/tokens
Keeping an eye on your token usage is important, especially if you are working within usage limits or trying to manage costs. The /tokens command gives you a quick snapshot of how many tokens have been used in your current session. This is a small but powerful bit of visibility that helps you plan longer interactions and avoid unexpected interruptions mid-task.
/clear
Context management is a critical part of working effectively with any AI tool. The /clear command resets the current conversation context, giving Copilot a clean slate. This is especially useful when you shift from one task to another and want to make sure Copilot is not carrying over unrelated context that could affect its suggestions. It is like starting a fresh conversation without needing to open a new terminal window.
/resume
On the other end of the spectrum, sometimes you want to pick up exactly where you left off. The /resume command allows you to reload a previous session, restoring the context from an earlier interaction. This is particularly handy when you were working through a complex debugging problem and had to step away, or when you want to continue iterating on something from a previous day's work.
/exit
When you are done with your Copilot CLI session, the /exit command closes things down cleanly. While pressing Ctrl+C works too, using /exit ensures a graceful termination of the session.
How to Use Slash Commands Effectively
Using slash commands effectively is less about memorizing a long list and more about understanding when each one becomes useful. Here are some practical tips to build good habits around slash commands:
- Start every new task with
/clearif you are switching context. This prevents Copilot from pulling in irrelevant history and ensures more accurate, focused responses. - Use
/modelwhen you notice that the current model's responses are not quite matching your needs. Experimenting with different models is free and takes only a second. - Check
/tokensperiodically during long sessions to stay aware of your usage, especially if you are working on an extended debugging task or generating large amounts of code. - Make
/resumepart of your daily startup habit if you regularly pick up ongoing projects. It saves time re-establishing context that Copilot already had. - Type
/helpwhenever you are unsure — it is always current, always available, and always free to use.
Slash Commands in Interactive vs. Non-Interactive Mode
It is worth noting that slash commands are primarily designed for use in interactive mode, where you are engaged in a back-and-forth session with Copilot CLI. In non-interactive mode, where commands are passed in a single line and Copilot returns a single response, slash commands have limited applicability. If you are still getting comfortable with the difference between these two modes, revisiting that earlier installment of this series will give you the context you need to decide which environment to use for a given task.
Getting Started with Slash Commands Today
The best way to get comfortable with slash commands is simply to use them. Open a GitHub Copilot CLI session, type /help, and start exploring. Each command is designed to be intuitive, and the more you use them, the more naturally they will fit into your terminal workflow.
GitHub Copilot CLI is built to meet developers where they already are — in the terminal — and slash commands are one of the clearest expressions of that philosophy. They reduce the distance between your intention and the action, keeping you in flow and in control. Whether you are managing a single script or navigating a large codebase, mastering these commands is a small investment that pays dividends every time you sit down to code.
Stay tuned for the next installment in the GitHub Copilot CLI for Beginners series, where we will continue exploring features that help you work smarter directly from the command line.
