Integrated Terminal

Access command-line tools without leaving your editor

Terminal Integration in Zed

One of Zed's most powerful features is its integrated terminal, which lets you run command-line operations without switching applications. This native terminal provides full functionality while maintaining the performance and consistency of the Zed experience.

The integrated terminal supports:

  • Full shell functionality (Bash, Zsh, Fish, etc.)
  • Multiple terminal instances
  • Command history and autocompletion
  • Rich text output with colors and formatting
  • Seamless project context integration
Zed Terminal

Opening the Terminal

There are several ways to access the terminal in Zed:

  1. Keyboard Shortcut

    Press Ctrl` (backtick) to toggle the terminal panel. This is the quickest way to show or hide the terminal.

  2. Command Palette

    Press ShiftP, type "Terminal," and select "Toggle Terminal" from the command palette.

  3. Menu Bar

    Click on "View" in the menu bar, then select "Terminal" to show the terminal panel.

By default, the terminal opens at the bottom of the editor window, but you can resize it by dragging the divider between the editor and terminal panels.

Terminal Basics

Working Directory

When you open a terminal in Zed, it automatically starts in your project's root directory. This means you can immediately run commands without having to navigate to your project folder.

Shell Selection

By default, Zed uses your system's default shell. You can see which shell is active in the terminal prompt. Common shells include:

  • Bash (default on many Linux distributions)
  • Zsh (default on macOS since Catalina)
  • Fish (a user-friendly alternative shell)
  • PowerShell or Command Prompt (on Windows)

Zed's terminal inherits your shell configuration files, such as .bashrc, .zshrc, or config.fish, ensuring consistency with your standalone terminal experience.

Multiple Terminal Instances

Zed allows you to create and manage multiple terminal instances for different tasks:

Creating New Terminals

  • Click the "+" button in the terminal panel header
  • Press ShiftP and select "New Terminal"
  • Use ShiftT as a shortcut
Multiple Terminal Instances

Switching Between Terminals

  • Click on terminal tabs in the terminal panel
  • Use Shift[ and Shift] to cycle between terminals

Use different terminals for different contexts: one for running a development server, another for running tests, and a third for git operations.

Closing Terminals

  • Click the "×" on a terminal tab
  • Type "exit" in the terminal
  • Use W when the terminal is focused

Terminal Features

Text Selection and Copying

Working with text in the terminal:

  • Click and drag to select text
  • Double-click to select a word
  • Triple-click to select a line
  • Press C to copy selected text
  • Press V to paste text at the cursor position

Scrolling and Search

  • Use the scrollbar or mousewheel to view terminal history
  • Press F to search within terminal output
  • Press K to clear the terminal

Command History

  • Press and to navigate through command history
  • Press CtrlR for reverse history search

Terminal Configuration

Terminal Settings

Customize your terminal experience through Zed's settings:

  1. Press , to open Settings
  2. Search for "terminal" to find relevant settings

Common terminal settings include:

  • Terminal Font: Set a custom font for the terminal
  • Terminal Font Size: Adjust text size independently from the editor
  • Terminal Shell: Specify a custom shell path
  • Terminal Colors: Customize the color scheme
  • Scrollback Lines: Set how many lines of history to keep

Example Terminal Configuration

json
{ "terminal_font_family": "JetBrains Mono", "terminal_font_size": 14, "terminal_shell": "/bin/zsh", "terminal_scrollback": 10000, "terminal_cursor_style": "block", "terminal_cursor_blink": true }

Working with the Terminal

Running Development Tasks

The terminal is perfect for running common development tasks:

  • Start development servers: npm run dev
  • Run tests: npm test or pytest
  • Build applications: npm run build or cargo build
  • Run database migrations: rails db:migrate

Keep a terminal instance open with your development server while you code. This way, you can see immediate feedback as you make changes.

File Operations

The terminal provides full access to file system operations:

  • Create files and directories: mkdir -p src/components
  • Copy or move files: cp -r old_dir/ new_dir/
  • Search file contents: grep -r "searchterm" .
  • Change file permissions: chmod +x ./scripts/deploy.sh

Terminal in Collaborative Sessions

When collaborating with other Zed users, the terminal can be shared:

Shared Terminal Sessions

  • All collaborators can see terminal output
  • Host can control whether collaborators can input commands
  • Great for debugging sessions and live demonstrations

Terminal sharing is particularly useful for teaching programming concepts or troubleshooting environment-specific issues with team members.

Terminal Permission Settings

As a host, you can control terminal access during collaboration:

  1. Open the Collaboration Panel
  2. Select a collaborator
  3. Toggle the "Terminal Access" permission

Advanced Terminal Usage

Environment Variables

Set project-specific environment variables:

bash
export API_KEY="your_secret_key" export NODE_ENV="development"

Running Background Processes

Run processes in the background with the & operator:

bash
npm run watch &

Use the fg command to bring background processes to the foreground, and jobs to list all background processes.

Interactive Programs

Zed's terminal fully supports interactive programs:

  • Command-line editors (vim, nano)
  • Interactive REPLs (Node.js, Python, Ruby)
  • Database clients (mysql, psql)
  • Interactive debugging tools

What's Next?

With a solid understanding of Zed's terminal capabilities, you're ready to learn about Git integration, which combines seamlessly with the terminal for a complete version control workflow.