> ## Documentation Index
> Fetch the complete documentation index at: https://docs.tensorpool.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Shell Configuration

> Understanding shells and how to configure environment variables

Your shell is the command-line interface that interprets and executes your commands. Different shells have different configuration files where you can set persistent environment variables like your TensorPool API key.

## What Are Shells?

A shell is a program that provides a text-based interface to your operating system. The most common shells are:

* **[Zsh](https://en.wikipedia.org/wiki/Z_shell)** (Z Shell) - The default on macOS since Catalina (10.15)
* **[Bash](https://en.wikipedia.org/wiki/Bash_\(Unix_shell\))** (Bourne Again Shell) - The default on most Linux distributions and older macOS versions
* **[Fish](https://en.wikipedia.org/wiki/Fish_\(Unix_shell\))** (Friendly Interactive Shell) - A modern shell with user-friendly features
* **[Sh](https://en.wikipedia.org/wiki/Bourne_shell)** (Bourne Shell) - The original Unix shell, basic and minimal

## Determine Your Current Shell

Run this command to see which shell you're using:

```bash theme={null}
echo $SHELL
```

The output will show the path to your shell:

* `/bin/bash` - You're using Bash
* `/bin/zsh` - You're using Zsh
* `/usr/bin/fish` or `/bin/fish` - You're using Fish
* `/bin/sh` - You're using Sh

<Note>
  The `$SHELL` variable shows your default shell. To see which shell is currently running, use: `ps -p $$`
</Note>

## Shell Configuration Files

Each shell has specific configuration files where you can set persistent environment variables.

<Note>
  You'll notice many configuration files end with "rc" (like `.bashrc`, `.zshrc`). The "rc" stands for "run commands" - these files contain commands that run automatically when you start a new shell session. This is where you can set environment variables, aliases, and other shell preferences that persist across sessions.
</Note>

### Bash

**Configuration file:** `~/.bashrc` (Linux) or `~/.bash_profile` (macOS)

```bash theme={null}
# Add to ~/.bashrc or ~/.bash_profile
export TENSORPOOL_KEY="your_api_key_here"
```

**Apply changes:**

```bash theme={null}
source ~/.bashrc
# or on macOS
source ~/.bash_profile
```

### Zsh

**Configuration file:** `~/.zshrc`

```bash theme={null}
# Add to ~/.zshrc
export TENSORPOOL_KEY="your_api_key_here"
```

**Apply changes:**

```bash theme={null}
source ~/.zshrc
```

### Fish

**Configuration file:** `~/.config/fish/config.fish`

Fish uses a different syntax for setting environment variables:

```bash theme={null}
# Add to ~/.config/fish/config.fish
set -gx TENSORPOOL_KEY "your_api_key_here"
```

**Apply changes:**

```bash theme={null}
source ~/.config/fish/config.fish
```

## Where Are Configuration Files Located?

The `~` symbol represents your home directory. The actual path depends on your username:

* **Linux/macOS:** `/home/username/` or `/Users/username/`
* **Windows (WSL):** `/home/username/`

Configuration files starting with a dot (`.`) are hidden by default. To see them:

```bash theme={null}
# List all files including hidden ones
ls -la ~

# Or specifically look for shell config files
ls -la ~/.bashrc ~/.zshrc ~/.config/fish/config.fish
```

## Quick Reference

| Shell | Check Command | Config File                      | Export Syntax         |
| ----- | ------------- | -------------------------------- | --------------------- |
| Bash  | `echo $SHELL` | `~/.bashrc` or `~/.bash_profile` | `export VAR="value"`  |
| Zsh   | `echo $SHELL` | `~/.zshrc`                       | `export VAR="value"`  |
| Fish  | `echo $SHELL` | `~/.config/fish/config.fish`     | `set -gx VAR "value"` |

## Switching Shells

If you want to change your default shell:

```bash theme={null}
# List available shells
cat /etc/shells

# Change to zsh
chsh -s /bin/zsh

# Change to bash
chsh -s /bin/bash

# Change to fish (if installed)
chsh -s /usr/bin/fish
```

<Warning>
  After changing shells, you'll need to log out and log back in for the change to take effect.
</Warning>

## Troubleshooting

### Environment Variable Not Persisting

If your environment variable disappears when you open a new terminal:

1. Verify you added it to the correct config file for your shell
2. Make sure you saved the file after editing
3. Close and reopen your terminal (or run `source` command)

### Can't Find Config File

If your config file doesn't exist, create it:

```bash theme={null}
# For bash
touch ~/.bashrc

# For zsh
touch ~/.zshrc

# For fish
mkdir -p ~/.config/fish && touch ~/.config/fish/config.fish
```

### Changes Not Taking Effect

After editing your config file, you must either:

1. Run `source ~/.zshrc` (or your specific config file)
2. Close and reopen your terminal
