Engineering Tools for AI

Programming

Essential Terminal Commands

A searchable guide to the terminal commands most often used while editing, testing, debugging, and running a web project.

33 matching commands

Navigation

print working directory

pwd

pwd

Meaning

Prints the absolute path of the folder where the terminal is currently working.

When to use it

Run it before commands that depend on being inside the project folder.

Example

pwd

Request example

Check which folder the terminal is currently in.

Navigation

list files

ls

ls

Meaning

Lists files and folders in the current directory.

When to use it

Use it to confirm expected files such as package.json, src, or next.config.mjs are present.

Example

ls

Request example

List the files in the current project folder.

Navigation

change directory

cd

cd ~/projects/my-web-app

Meaning

Moves the terminal to another folder.

When to use it

Use it before running project-specific commands such as npm run build.

Caution

A command can fail if you are in the wrong folder, even when the command itself is correct.

Example

cd ~/projects/my-web-app

Request example

Move to the project folder before running commands.

Navigation

clear screen

clear

clear

Meaning

Clears visible terminal output without changing files or command history.

When to use it

Use it before rerunning a command when the old output is visually noisy.

Example

clear

Request example

Clear the terminal before rerunning the build.

Files and folders

show file contents

cat

cat package.json

Meaning

Prints the contents of a file to the terminal.

When to use it

Use it for short files such as package.json, config files, or small text files.

Caution

For very large files, prefer sed, rg, or a pager instead of printing everything.

Example

cat package.json

Request example

Show the package.json scripts.

Files and folders

show selected lines

sed

sed -n '1,120p' src/components/SiteHeader.tsx

Meaning

Can print a selected range of lines from a file.

When to use it

Use it to inspect one section of a source file without opening the whole file.

Example

sed -n '1,120p' src/components/SiteHeader.tsx

Request example

Show the first 120 lines of SiteHeader.tsx.

Files and folders

make directory

mkdir

mkdir -p src/app/[locale]/reference/terminal-commands

Meaning

Creates a new folder. The -p option also creates missing parent folders and avoids failing if the folder already exists.

When to use it

Use it before adding a new page folder or asset folder.

Example

mkdir -p src/app/[locale]/reference/terminal-commands

Request example

Create the route folder for the terminal commands page.

Files and folders

copy files

cp

cp .env.example .env.local

Meaning

Copies a file or folder to another location.

When to use it

Use it to create local config from an example file or duplicate a template.

Caution

If the destination file exists, cp can overwrite it.

Example

cp .env.example .env.local

Request example

Copy the example env file only if it will not overwrite local settings.

Files and folders

move or rename

mv

mv old-name.ts new-name.ts

Meaning

Moves a file or folder, or renames it when the destination is in the same folder.

When to use it

Use it when changing a filename, route folder name, or moving assets.

Caution

Renaming route folders changes URLs.

Example

mv old-name.ts new-name.ts

Request example

Rename this file and update imports if needed.

Safety

remove files

rm

rm unused-file.ts

Meaning

Deletes files. With -r it can delete folders recursively.

When to use it

Use it only when a file is intentionally removed from the project.

Caution

rm is destructive. Check the path carefully before running it.

Example

rm unused-file.ts

Request example

Before deleting this file, explain what will be removed.

Search and inspect

ripgrep search

rg

rg -n "errorMessageGuide" src

Meaning

Searches text quickly across files.

When to use it

Use it to find imports, components, slugs, CSS classes, or old names before editing.

Example

rg -n "errorMessageGuide" src

Request example

Search where this component is imported.

Search and inspect

list tracked-looking files fast

rg --files

rg --files src/app

Meaning

Lists file paths quickly, respecting common ignore rules.

When to use it

Use it to find page files, components, and libraries without scanning build output.

Example

rg --files src/app

Request example

List reference page files under src/app.

Search and inspect

find paths

find

find src -name 'page.tsx'

Meaning

Searches the filesystem by path, name, or other file properties.

When to use it

Use it when searching by filename pattern rather than text content.

Example

find src -name 'page.tsx'

Request example

Find every page.tsx route file.

Search and inspect

count lines or words

wc

wc -l src/lib/terminal-commands.ts

Meaning

Counts lines, words, or bytes.

When to use it

Use it to estimate file size or count search results when combined with other commands.

Example

wc -l src/lib/terminal-commands.ts

Request example

Count how many lines are in this data file.

Packages

install dependencies

npm install

npm install

Meaning

Installs packages listed in package.json and package-lock.json.

When to use it

Use it after cloning a project or when dependencies are missing.

Caution

It can change package-lock.json if dependency versions resolve differently.

Example

npm install

Request example

Install dependencies only if node_modules is missing.

Dev server

start dev server

npm run dev

npm run dev

Meaning

Runs the project's local development server script.

When to use it

Use it to test pages in the browser while editing.

Caution

A running dev server keeps the terminal session busy until stopped.

Example

npm run dev

Request example

Start the dev server and tell me the local URL.

Packages

production build

npm run build

npm run build

Meaning

Runs the production build script and catches many compile, route, and type problems.

When to use it

Run it before deployment or after adding new pages.

Example

npm run build

Request example

Run the production build and summarize warnings or failures.

Packages

lint check

npm run lint

npm run lint

Meaning

Runs the project's lint script to catch style and static code issues.

When to use it

Run it before build when you want quick feedback.

Example

npm run lint

Request example

Run lint and show only actionable errors.

Packages

check Node version

node -v

node -v

Meaning

Prints the installed Node.js version.

When to use it

Use it when a project or dependency requires a specific Node version.

Example

node -v

Request example

Check the Node.js version before explaining this warning.

Packages

run package command

npx

npx next info

Meaning

Runs a command from an installed or temporarily downloaded npm package.

When to use it

Use it for one-off tooling commands when no package script exists.

Caution

npx can download packages from the network if they are not installed.

Example

npx next info

Request example

Explain whether this npx command needs network access.

Git

check Git status

git status

git status --short

Meaning

Shows the current branch and changed, staged, or untracked files.

When to use it

Run it before edits, commits, pulls, or branch switches.

Example

git status --short

Request example

Check Git status and summarize the changed files.

Git

show code differences

git diff

git diff -- src/components/SiteHeader.tsx

Meaning

Shows line-by-line differences in changed files.

When to use it

Use it to review exactly what changed before committing.

Example

git diff -- src/components/SiteHeader.tsx

Request example

Review the diff for this task.

Git

view commit history

git log

git log --oneline -5

Meaning

Shows commit history.

When to use it

Use it to see recent work or find a commit to inspect.

Example

git log --oneline -5

Request example

Show the five most recent commits.

Git

stage changes

git add

git add src/lib/terminal-commands.ts

Meaning

Selects changes to include in the next commit.

When to use it

Use explicit paths for focused commits.

Example

git add src/lib/terminal-commands.ts

Request example

Stage only files related to this terminal commands page.

Git

save commit

git commit

git commit -m "Add terminal command reference"

Meaning

Records staged changes into Git history.

When to use it

Use it after reviewing the staged changes.

Example

git commit -m "Add terminal command reference"

Request example

Commit the staged changes with a clear message.

Dev server

stop running command

Ctrl+C

Press Ctrl+C in the dev server terminal

Meaning

Interrupts the currently running terminal command.

When to use it

Use it to stop a local dev server before closing the terminal or changing ports.

Caution

Use it in the terminal session where the command is running.

Example

Press Ctrl+C in the dev server terminal

Request example

Stop the running dev server.

Dev server

list open files and ports

lsof

lsof -i :3001

Meaning

Can show which process is using a port.

When to use it

Use it when a dev server fails with EADDRINUSE.

Example

lsof -i :3001

Request example

Find which process is using port 3001.

Dev server

list processes

ps

ps aux

Meaning

Shows running processes.

When to use it

Use it to inspect running development tools, servers, or background processes.

Example

ps aux

Request example

Check whether a Next.js dev server is still running.

Safety

stop process by PID

kill

kill 12345

Meaning

Sends a signal to stop a process by process ID.

When to use it

Use it when a server keeps running after normal interruption is not available.

Caution

Check the PID carefully so you do not stop the wrong process.

Example

kill 12345

Request example

Before killing a process, show me what the PID belongs to.

Network

make HTTP request

curl

curl -I http://localhost:3001/ko

Meaning

Sends HTTP requests from the terminal and prints the response.

When to use it

Use it to check whether a local or deployed URL returns 200, 404, 500, or redirects.

Example

curl -I http://localhost:3001/ko

Request example

Use curl to check whether this page returns 200.

Network

check network reachability

ping

ping 172.30.1.55

Meaning

Checks whether a host responds to basic network packets.

When to use it

Use it as a rough network reachability check, not as a web app health check.

Example

ping 172.30.1.55

Request example

Check whether this device can reach the dev machine IP.

Search and inspect

locate command executable

which

which node

Meaning

Shows which executable file will run for a command name.

When to use it

Use it when different Node, npm, or tool versions may exist on the machine.

Example

which node

Request example

Check which node executable is being used.

Safety

change file permissions

chmod

chmod +x script.sh

Meaning

Changes read, write, or execute permissions on files.

When to use it

Use it when a local script should be executable.

Caution

Avoid broad permission changes such as chmod -R 777.

Example

chmod +x script.sh

Request example

Explain the safest permission change for this script.