Try free

Last updated 13 October 2026

Add custom shell aliases for Claude Code

Shell shortcuts reduce repetitive typing

Repeatedly typing long commands in your terminal leads to fatigue and breaks your concentration. When you use Claude Code, you often need to include specific flags to continue a session or resume an old one. Typing these out every few minutes is a friction point that slows down your development cycle. Shell aliases solve this problem by allowing you to map long commands to short, memorable strings. This keeps your hands in a natural typing position and helps you stay focused on the logic of your code.

Setting up these shortcuts is a one-time task that pays dividends every day. You can customize your environment to match the way you think and work. Whether you prefer two-letter abbreviations or descriptive words, aliases make the tool feel like a native part of your operating system. By removing the need to remember complex syntax or flags, you lower the barrier to starting a new task. This is especially helpful for developers who manage multiple projects and need to switch contexts quickly without losing momentum.

Essential aliases for daily operations

The most common command you will use is the one that carries on the most recent session in your current folder. Instead of typing the full name of the tool and the continue flag, you can create a shortcut like cc. Open your shell configuration file, which is usually found in your home directory as .zshrc or .bashrc. Add a line that defines an alias where cc equals claude -c. This simple change allows you to jump back into your work with just two keystrokes whenever you open a new terminal window in your project directory.

You should also create a shortcut for the resume flag to help you manage older conversations. Mapping claude -r to a command like cr gives you a fast way to see a list of earlier sessions. This is useful when you need to refer back to a specific feature you worked on days ago or if you need to pick up a thread that you previously abandoned. Having these two basic shortcuts ready will save you thousands of keystrokes over a single month of development. It transforms the way you interact with the agent from a manual process into a fast and fluid habit.

Single prompt execution with shell functions

The print flag allows you to run a single prompt and get an answer without staying in the interactive interface. This is a great candidate for a shell function because functions can accept arguments. You can define a function in your shell profile that takes a string of text and passes it to claude -p. This allows you to ask a question or request a file summary directly from your main prompt. It is a massive time saver for small tasks that do not require a full conversation, such as checking a regex pattern or asking for a quick code review of a specific file.

You can even use this approach to pipe data from other terminal tools into the agent. If you have a build error or a long log file, you can pass that content into your custom function. The agent will process the input and print the result directly to your console. This integration makes the tool feel like a powerful extension of your existing shell utilities. By automating these small interactions, you reduce the cognitive load of switching between your code editor and the agent interface, keeping your focus entirely on the problem at hand.

Project specific startup commands and context

Context is vital when working on complex software projects. If you start a session in the wrong directory, the agent will not have access to your project files or your CLAUDE.md instructions. You can create aliases that combine a directory change with a session start. For example, an alias could move you to your backend repository and immediately run the command to start a new session. This ensures that you are always in the correct root directory and that the agent sees the relevant file tree from the very first prompt.

This approach is especially helpful when you work with monorepos or projects that have multiple subdirectories. You can have one alias for your API service and another for your frontend application. Each shortcut ensures that the agent loads the correct environment and respects the local CLAUDE.md file in that specific part of the tree. This eliminates the risk of the agent making changes in the wrong place or getting confused by files that are not relevant to your current task. It provides a clean and predictable starting point for every session.

Visual organization of multiple sessions

As you create more aliases for different projects, you might find it difficult to manage many open terminal tabs at once. This is a common problem for developers who handle multiple tasks simultaneously. A manual list of aliases can only take you so far when you need to see the status of several active sessions. This is where adhdTerminal becomes a useful addition to your workflow. It is a native app for macOS and Windows that runs many Claude Code sessions side by side on a single wall.

Each session in adhdTerminal is represented as a tile with its own color, number, and name. The app shows you at a glance whether a session is working, waiting for your input, or idle. This visual layout replaces the need to hunt through dozens of terminal windows. Since the tiles reopen in the same place after a restart and resume their sessions, your project organization remains persistent. It allows you to use your custom aliases to launch work and then manage the resulting sessions in a structured and visible environment.

Remote access and background task monitoring

Sometimes you need to step away from your desk while the agent is performing a long task like a comprehensive code review or a large refactor. Monitoring these tasks from a terminal is impossible once you leave your computer. However, adhdTerminal offers a free iPhone app that mirrors your desktop wall over an end to end encrypted link. This allows you to check the status of any tile on your wall from anywhere. You can see the last exchanges of a conversation and know exactly when the agent is finished or if it needs your permission to proceed.

The mobile app also allows you to interact with your sessions remotely. You can answer a prompt or send the next task to any active tile directly from your phone. This means the work you started with your shell aliases can continue even when you are not at your workstation. It provides a level of flexibility that standard terminal sessions cannot match. By combining your local shell shortcuts with this persistent visual wall, you create a development environment that stays organized and accessible across all your devices.

Integrating aliases with project instructions

Your shell aliases handle how you launch the tool, but the instructions inside your project determine how the agent behaves. Every project should have a CLAUDE.md file in the root directory to store coding standards and build commands. You can also place a CLAUDE.md file in subdirectories for more specific guidance. When you use an alias to start a session in a specific folder, the agent automatically reads these files to understand the context of your work. This combination of quick access and clear instructions creates a highly efficient workspace.

You can further extend this by using the project settings file found in the .claude directory. This file allows you to define permissions for tools and configure how the agent interacts with your system. If you find yourself typing the same internal slash commands frequently, you should look into creating custom commands as markdown files in the .claude/commands directory. This creates a layered system of efficiency where shell aliases get you into the session quickly, and internal configuration files automate the work once you are there.

Maintaining and updating your automation

Your development needs will change as your projects grow. It is important to periodically review your shell aliases and configuration files to ensure they still serve your workflow. If a project reaches a milestone or moves to a new repository, update your aliases to reflect the new paths. You should also regularly use the update command to ensure you are using the latest version of the tool. Running the doctor command is also a good habit if you notice any unusual behavior in your terminal environment.

By taking the time to refine your shortcuts and settings, you build a personalized development environment that works for you. The goal of using aliases and configuration files is to remove every unnecessary hurdle between your ideas and your code. When your tools are properly configured, you can move faster and with more confidence. Whether you are using a single terminal window or a visual wall of tiles, a well-organized set of shortcuts is the foundation of a productive coding routine.

Questions people ask

How do I make my shell aliases permanent across different terminal sessions?

You must add your alias definitions to your shell configuration file in your home directory. For most macOS users, this is .zshrc, while Linux users often use .bashrc. After saving the file, you need to run the source command on that file or restart your terminal for the changes to take effect.

Can I use shell aliases to run slash commands like /compact or /clear?

Shell aliases only work in your terminal before you start the agent session. To create shortcuts for internal slash commands, you should create markdown files in the .claude/commands directory of your project. These files allow you to define custom actions that the agent can execute while you are inside an active session.

What should I do if my alias is not recognized by the terminal?

First, verify that you have spelled the alias correctly in your configuration file and that there are no spaces around the equals sign. Use the command to check your shell environment or run the doctor command to ensure the tool is correctly installed in your path. If you recently added the alias, remember to reload your shell configuration so the terminal sees the new shortcut.

Read next

More on claude code basics·All posts