Replit's Shell tab is a full Linux terminal powered by Nix where you can run system commands, install packages, manage processes, and interact with Git. Open Shell from the Tools dock, run standard commands like ls, curl, wget, and htop, install system packages via replit.nix, and use kill 1 to restart the environment when processes get stuck. The Shell is separate from the Console, which only shows output from the Run button.
How to Run System Commands in Replit's Terminal
Replit is a browser-based IDE, but underneath it runs a full Linux environment with Nix package management. The Shell tab gives you command-line access to install system tools, manage files, run scripts, monitor processes, and interact with external services via curl or wget. This tutorial covers the most common system operations you can perform in Replit's Shell.
Prerequisites
- A Replit account (free Starter plan works)
- An existing Repl or the ability to create a new one
- Basic familiarity with terminal or command-line concepts
Step-by-step guide
Open the Shell from the Tools dock
Open the Shell from the Tools dock
In your Replit workspace, find the Tools dock on the left sidebar. Click the Shell icon to open an interactive Linux terminal. If you do not see it, use the search bar at the top and type Shell. The Shell pane opens inside your workspace with a blinking cursor ready for commands. You can resize it by dragging the pane border, float it into a separate window from the three-dot menu, or open multiple Shell instances by clicking the plus icon next to the tab.
Expected result: A Shell pane opens with a blinking cursor, ready to accept Linux commands.
Run basic file and system commands
Run basic file and system commands
The Shell supports standard Linux commands. Use ls to list files, pwd to print your current directory, mkdir to create directories, cp and mv to copy and move files, and rm to delete them. Use cat to view file contents and head or tail for partial views. The command history is available with the up arrow key, and tab completion works for file names and commands.
1# List all files including hidden ones2ls -la34# Show current directory5pwd67# Create a new directory8mkdir src/utils910# View a file's contents11cat .replit1213# Check disk usage14du -sh .1516# Show running processes17ps auxExpected result: Commands execute and display output directly in the Shell pane, just like any Linux terminal.
Install system packages with replit.nix
Install system packages with replit.nix
Replit uses Nix to manage system-level tools beyond npm or pip packages. To add tools like htop, curl, wget, ffmpeg, or ImageMagick, edit the replit.nix file. Search for available packages at search.nixos.org/packages to find the correct name. After editing replit.nix, type exit in Shell to restart the environment and load new packages. You can also add quick packages directly in the .replit file under [nix] packages.
1# replit.nix example2{ pkgs }: {3 deps = [4 pkgs.nodejs-20_x5 pkgs.htop6 pkgs.curl7 pkgs.wget8 pkgs.imagemagick9 ];10}1112# Alternative: add in .replit under [nix]13# [nix]14# packages = ["htop", "curl", "wget"]Expected result: After running exit in Shell, the new packages are installed and available as commands.
Use curl and wget for API calls and downloads
Use curl and wget for API calls and downloads
Curl and wget let you interact with external APIs and download files directly from Shell. Use curl to test API endpoints, send POST requests, and check response headers. Use wget to download files. Both tools are pre-installed in most Replit environments. These are useful for testing your app's API endpoints, downloading configuration files, or verifying external service connectivity.
1# GET request to an API2curl https://httpbin.org/get34# POST request with JSON body5curl -X POST https://httpbin.org/post \6 -H "Content-Type: application/json" \7 -d '{"name": "test", "value": 42}'89# Download a file10wget https://example.com/data.csv1112# Test your own app's endpoint13curl http://localhost:3000/api/health1415# Show response headers16curl -I https://example.comExpected result: API responses or downloaded files appear in Shell. You can verify your endpoints work correctly before deploying.
Manage processes and recover from stuck states
Manage processes and recover from stuck states
When a process hangs or your Repl becomes unresponsive, use Shell to diagnose and fix the problem. Run ps aux to see all running processes. Use kill followed by the process ID to stop a specific process. The most powerful recovery command is kill 1, which restarts the entire Repl environment including reloading Nix packages and environment variables. This is also required after adding new Secrets to make them available in Shell.
1# List all running processes2ps aux34# Kill a specific process by PID5kill 1234567# Force kill a stubborn process8kill -9 12345910# Restart the entire Repl environment11kill 11213# Check resource usage interactively14htopExpected result: Stuck processes are terminated and the Repl environment recovers. After kill 1, the environment restarts fresh with all current secrets and Nix packages.
Use Git from the command line
Use Git from the command line
The Shell includes git, gh (GitHub CLI), and glab (GitLab CLI) for version control operations. While Replit has a visual Git pane, Shell gives you full control for advanced operations like cherry-picking, rebasing, and managing multiple remotes. For private repositories, store your GitHub personal access token in Tools → Secrets as GIT_URL and use it for push operations. For teams managing complex Git workflows on Replit, RapidDev provides guidance on branching strategies and CI/CD integration.
1# Initialize a repository2git init34# Stage and commit changes5git add .6git commit -m "Initial commit"78# Check status and log9git status10git log --oneline -101112# Push to GitHub (using token from Secrets)13git remote add origin https://github.com/user/repo.git14git push -u origin mainExpected result: Git commands execute in Shell, allowing you to commit, push, pull, and manage your repository from the command line.
Complete working example
1# replit.nix — System-level package configuration2# This file controls what system tools are available in your Repl3# Search for packages at: https://search.nixos.org/packages4# After editing, run 'exit' in Shell to reload56{ pkgs }: {7 deps = [8 # Runtime9 pkgs.nodejs-20_x10 pkgs.python3111112 # System tools13 pkgs.htop # Interactive process viewer14 pkgs.curl # HTTP client15 pkgs.wget # File downloader16 pkgs.jq # JSON processor17 pkgs.tree # Directory visualizer1819 # Development tools20 pkgs.nodePackages.typescript-language-server21 pkgs.nodePackages.prettier2223 # Media processing (add only if needed)24 # pkgs.imagemagick25 # pkgs.ffmpeg26 ];27}Common mistakes when running system commands in Replit
Why it's a problem: Trying to use sudo for privileged operations, which is not available on Replit
How to avoid: Install system packages through replit.nix instead. Replit uses Nix for package management, not apt or sudo.
Why it's a problem: Expecting Shell changes (installed packages, environment variables) to persist without a restart
How to avoid: After editing replit.nix, run exit in Shell. After adding Secrets, run kill 1 to reload the environment.
Why it's a problem: Running npm install globally with -g flag, causing packages to disappear on restart
How to avoid: Install packages locally in your project or add tools to replit.nix for persistent system-level availability.
Why it's a problem: Storing passwords or tokens in Shell command history by typing them inline
How to avoid: Store credentials in Tools → Secrets and reference them as environment variables like $MY_TOKEN in Shell.
Best practices
- Use Shell for interactive commands and system operations; use Console only to monitor Run button output
- Always search for Nix package names at search.nixos.org/packages before adding them to replit.nix
- Run exit in Shell after editing replit.nix to reload the Nix environment with new packages
- Use kill 1 to restart the Repl environment after adding Secrets or when the workspace becomes unresponsive
- Monitor resources via the Resources panel (or htop in Shell) to avoid out-of-memory crashes
- Store GitHub tokens in Tools → Secrets, never in Shell history or code files
- Open multiple Shell instances for parallel tasks instead of running everything in one tab
- Use curl to test your API endpoints locally before deploying
Still stuck?
Copy one of these prompts to get a personalized, step-by-step explanation.
I need to install ffmpeg and imagemagick on Replit to process images in my Node.js project. How do I add system packages using replit.nix and verify they are available in Shell?
My Replit app is frozen and the Run button does nothing. Show me how to use Shell to find and kill the stuck process, then restart the environment cleanly. Also check if there is a Nix error by reading /run/replit/env/error.
Frequently asked questions
Shell is an interactive Linux terminal where you type commands, install packages, and manage files. Console is read-only and only shows output when you click the Run button. Client-side JavaScript logs appear in Preview DevTools, not in either Shell or Console.
No. Replit does not provide root or sudo access. Install system packages through replit.nix or the Dependencies GUI instead. Nix handles package management without requiring elevated privileges.
Add them to your replit.nix file under the deps array (e.g., pkgs.ffmpeg, pkgs.imagemagick). Search for the correct package name at search.nixos.org/packages, then run exit in Shell to reload.
kill 1 sends a signal to process ID 1, which is the init process in Replit's container. This restarts the entire environment, reloading Nix packages, environment variables, and clearing stuck processes. It does not delete your files.
You need to run exit in Shell after editing replit.nix to restart the environment. Also verify the package name at search.nixos.org/packages — wrong names cause a Nix build error.
No. Replit does not support Docker. The platform uses Nix for environment management. If you need specific tools, add them to replit.nix instead of trying to run containers.
Click the Resources panel icon (stacked computers) in the left sidebar to see real-time RAM and CPU usage. You can also run htop in Shell for a detailed interactive process viewer. The Starter plan has 2 GiB RAM, Core has 8 GiB.
In the workspace, yes — files persist across sessions. In deployments, no — the file system resets every time you publish. Store persistent data in Replit's PostgreSQL database or Object Storage.
Talk to an Expert
Our team has built 600+ apps. Get personalized help with your project.
Book a free consultation