Skip to main content
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 (Z Shell) - The default on macOS since Catalina (10.15)
  • Bash (Bourne Again Shell) - The default on most Linux distributions and older macOS versions
  • Fish (Friendly Interactive Shell) - A modern shell with user-friendly features
  • Sh (Bourne Shell) - The original Unix shell, basic and minimal

Determine Your Current Shell

Run this command to see which shell you’re using:
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
The $SHELL variable shows your default shell. To see which shell is currently running, use: ps -p $$

Shell Configuration Files

Each shell has specific configuration files where you can set persistent environment variables.
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.

Bash

Configuration file: ~/.bashrc (Linux) or ~/.bash_profile (macOS)
# Add to ~/.bashrc or ~/.bash_profile
export TENSORPOOL_API_KEY="your_api_key_here"
Apply changes:
source ~/.bashrc
# or on macOS
source ~/.bash_profile

Zsh

Configuration file: ~/.zshrc
# Add to ~/.zshrc
export TENSORPOOL_API_KEY="your_api_key_here"
Apply changes:
source ~/.zshrc

Fish

Configuration file: ~/.config/fish/config.fish Fish uses a different syntax for setting environment variables:
# Add to ~/.config/fish/config.fish
set -gx TENSORPOOL_API_KEY "your_api_key_here"
Apply changes:
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:
# 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

ShellCheck CommandConfig FileExport Syntax
Bashecho $SHELL~/.bashrc or ~/.bash_profileexport VAR="value"
Zshecho $SHELL~/.zshrcexport VAR="value"
Fishecho $SHELL~/.config/fish/config.fishset -gx VAR "value"

Switching Shells

If you want to change your default shell:
# 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
After changing shells, you’ll need to log out and log back in for the change to take effect.

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:
# 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