Helpful Terminal Commands

A quick reference for common commands you might encounter while working with AI coding tools, Git, Node.js, Docker, and modern development workflows.

File System Navigation & Manipulation

pwd
Print Working Directory - Shows the full path of the current folder.
ls
List - Shows files and folders in the current directory.
ls -a
Lists *all* files, including hidden ones (like `.env`, `.git`).
ls -l
Lists files in long format (permissions, owner, size, date).
cd <directory_name>
Change Directory - Moves into the specified folder.
cd ..
Moves one level up (to the parent folder).
cd ~
Moves to your home directory.
mkdir <directory_name>
Make Directory - Creates a new empty folder.
touch <file_name>
Creates a new empty file or updates modification time.
cat <file_name>
Concatenate - Displays the entire content of a file.
tree -I 'node_modules|dist|.git|build' -a
Shows directory structure as a tree, ignoring common folders and showing hidden files. (*Note: `tree` might need to be installed*).

Git Version Control

git status
Shows the current state of your repository (changes, branch). Run this often!
git branch
Lists local branches and highlights the current one.
git checkout <branch_name>
Switches your working directory to the specified branch.
git checkout -b <new_branch_name>
Creates a *new* branch and switches to it.
git add <file_name>
Adds specific file changes to the staging area (prepares for commit).
git add .
Adds *all* modified/new files in the current directory to staging.
git commit -m "Your message"
Records staged changes to project history with a descriptive message.
git push origin <branch_name>
Uploads committed local changes to the remote repository (e.g., GitHub).
git pull origin <branch_name>
Downloads remote changes for the branch and merges them locally.

Node.js / Project Management (NPM)

npm install
Installs all project dependencies listed in `package.json`.
npm run dev
Runs the "dev" script from `package.json` (usually starts the development server).
npm run build
Runs the "build" script from `package.json` (usually creates a production version).
npm run dev -- --host
(Vite specific) Runs dev server accessible on your local network (uses your IP).

Networking / Utilities

curl <URL>
Client URL - Transfers data from/to a server. Useful for testing APIs or downloading.

Example: curl https://api.github.com/users/octocat

grep "pattern" <file>
Global Regular Expression Print - Searches for lines containing text pattern within a file.

Example: grep "error" server.log

PostgreSQL (psql) via Docker

docker exec -it local-postgres psql -U postgres
Connect to the PostgreSQL server running in your Docker container (named 'local-postgres') as the 'postgres' user. You will be prompted for the password you set when running the container.
\l
List all databases in the PostgreSQL server. (Run inside psql)
\c <database_name>
Connect to a specific database. (Run inside psql)

Example: \c myapp_db

\dt
List all tables in the currently connected database. (Run inside psql)
\d <table_name>
Describe a table (show its columns and types). (Run inside psql)

Example: \d users

SELECT * FROM <table_name>;
Retrieve all rows and columns from a table. Remember the semicolon! (Run inside psql)

Example: SELECT * FROM products;

CREATE DATABASE <new_db_name>;
Create a new database. (Run inside psql)

Example: CREATE DATABASE my_new_application_db;

\q
Quit psql and return to your regular terminal. (Run inside psql)

Prisma ORM / Database GUI

npx prisma studio
Opens Prisma Studio in your web browser, a GUI tool to view and manage data in your database. Useful for inspecting data during development.

Example: Run this command in the root directory of your project where your Prisma schema is located.

Requirements for `npx prisma studio`
To use `npx prisma studio`, ensure the following are set up in your project:
        • **Node.js & npm/npx:** Must be installed on your system.
        • **Prisma CLI:** Your project needs the Prisma CLI. If not already installed, add it as a dev dependency: `npm install prisma --save-dev`
        • **Prisma Schema (`schema.prisma`):** This file must exist (usually in a `prisma` directory) and be correctly configured with your database connection URL.
        • **Database Server Running:** The database (e.g., PostgreSQL, MySQL, SQLite) defined in your schema must be running and accessible.
        • **Prisma Client Generated:** After any changes to your `schema.prisma`, run `npx prisma generate` to update the Prisma Client.

Claude Code CLI

claude
Start an interactive Claude Code session in your terminal.
claude "your prompt here"
Send a one-off prompt to Claude Code without entering interactive mode.
/help
Show available commands and usage information inside a Claude Code session.
/clear
Clear the conversation history and start fresh.
/commit
Let Claude Code generate a commit message and create a git commit for your staged changes.
/review-pr
Have Claude Code review a pull request and provide feedback.
claude --model sonnet
Start Claude Code with a specific model (sonnet, opus, haiku).
cat file.txt | claude "summarise this"
Pipe content into Claude Code for analysis or transformation.

Cursor-Specific

Cmd+L / Ctrl+L
Open the Cursor Chat panel to ask questions about your code.
Cmd+I / Ctrl+I
Open Cursor Composer for multi-file edits and code generation.
Cmd+K / Ctrl+K
Inline code editing — select code and describe changes you want.
.cursorrules
A configuration file in your project root that defines coding rules and preferences for Cursor's AI to follow.
.cursorignore
A file (like .gitignore) that tells Cursor which files/folders the AI should ignore.

Docker Compose

docker compose up
Start all services defined in your docker-compose.yml file.
docker compose up -d
Start services in detached (background) mode.
docker compose down
Stop and remove all containers, networks, and volumes defined in docker-compose.yml.
docker compose ps
List all running containers managed by Docker Compose.
docker compose logs -f
Follow (stream) logs from all Compose services in real-time.
docker compose build
Build or rebuild Docker images for services defined in docker-compose.yml.

Vercel CLI

npm install -g vercel
Install the Vercel CLI globally.
vercel
Deploy the current project to a preview URL on Vercel.
vercel --prod
Deploy directly to production.
vercel dev
Run the Vercel development server locally (simulates serverless functions).
vercel env pull
Download environment variables from your Vercel project to a local .env file.
vercel logs <deployment-url>
View runtime logs for a specific deployment.

Supabase CLI

npm install -g supabase
Install the Supabase CLI globally.
supabase init
Initialise a new Supabase project in the current directory.
supabase start
Start a local Supabase stack (Postgres, Auth, Storage, etc.) using Docker.
supabase stop
Stop the local Supabase stack.
supabase db push
Push local database migrations to a linked remote Supabase project.
supabase functions serve
Serve Supabase Edge Functions locally for development and testing.
supabase db reset
Reset the local database to a clean state by re-running all migrations.