Engineering Tools for AI

プログラミング

主要ターミナルコマンド

Webプロジェクトの編集、実行、テスト、デバッグでよく使うターミナルコマンドの検索ガイドです。

33

移動

print working directory

pwd

pwd

意味

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

使う場面

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

pwd

依頼例

Check which folder the terminal is currently in.

移動

list files

ls

ls

意味

Lists files and folders in the current directory.

使う場面

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

ls

依頼例

List the files in the current project folder.

移動

change directory

cd

cd ~/projects/my-web-app

意味

Moves the terminal to another folder.

使う場面

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

注意

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

cd ~/projects/my-web-app

依頼例

Move to the project folder before running commands.

移動

clear screen

clear

clear

意味

Clears visible terminal output without changing files or command history.

使う場面

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

clear

依頼例

Clear the terminal before rerunning the build.

ファイルとフォルダ

show file contents

cat

cat package.json

意味

Prints the contents of a file to the terminal.

使う場面

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

注意

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

cat package.json

依頼例

Show the package.json scripts.

ファイルとフォルダ

show selected lines

sed

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

意味

Can print a selected range of lines from a file.

使う場面

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

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

依頼例

Show the first 120 lines of SiteHeader.tsx.

ファイルとフォルダ

make directory

mkdir

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

意味

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

使う場面

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

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

依頼例

Create the route folder for the terminal commands page.

ファイルとフォルダ

copy files

cp

cp .env.example .env.local

意味

Copies a file or folder to another location.

使う場面

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

注意

If the destination file exists, cp can overwrite it.

cp .env.example .env.local

依頼例

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

ファイルとフォルダ

move or rename

mv

mv old-name.ts new-name.ts

意味

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

使う場面

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

注意

Renaming route folders changes URLs.

mv old-name.ts new-name.ts

依頼例

Rename this file and update imports if needed.

安全操作

remove files

rm

rm unused-file.ts

意味

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

使う場面

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

注意

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

rm unused-file.ts

依頼例

Before deleting this file, explain what will be removed.

検索と確認

ripgrep search

rg

rg -n "errorMessageGuide" src

意味

Searches text quickly across files.

使う場面

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

rg -n "errorMessageGuide" src

依頼例

Search where this component is imported.

検索と確認

list tracked-looking files fast

rg --files

rg --files src/app

意味

Lists file paths quickly, respecting common ignore rules.

使う場面

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

rg --files src/app

依頼例

List reference page files under src/app.

検索と確認

find paths

find

find src -name 'page.tsx'

意味

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

使う場面

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

find src -name 'page.tsx'

依頼例

Find every page.tsx route file.

検索と確認

count lines or words

wc

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

意味

Counts lines, words, or bytes.

使う場面

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

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

依頼例

Count how many lines are in this data file.

パッケージ

install dependencies

npm install

npm install

意味

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

使う場面

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

注意

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

npm install

依頼例

Install dependencies only if node_modules is missing.

開発サーバー

start dev server

npm run dev

npm run dev

意味

Runs the project's local development server script.

使う場面

Use it to test pages in the browser while editing.

注意

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

npm run dev

依頼例

Start the dev server and tell me the local URL.

パッケージ

production build

npm run build

npm run build

意味

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

使う場面

Run it before deployment or after adding new pages.

npm run build

依頼例

Run the production build and summarize warnings or failures.

パッケージ

lint check

npm run lint

npm run lint

意味

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

使う場面

Run it before build when you want quick feedback.

npm run lint

依頼例

Run lint and show only actionable errors.

パッケージ

check Node version

node -v

node -v

意味

Prints the installed Node.js version.

使う場面

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

node -v

依頼例

Check the Node.js version before explaining this warning.

パッケージ

run package command

npx

npx next info

意味

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

使う場面

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

注意

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

npx next info

依頼例

Explain whether this npx command needs network access.

Git

check Git status

git status

git status --short

意味

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

使う場面

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

git status --short

依頼例

Check Git status and summarize the changed files.

Git

show code differences

git diff

git diff -- src/components/SiteHeader.tsx

意味

Shows line-by-line differences in changed files.

使う場面

Use it to review exactly what changed before committing.

git diff -- src/components/SiteHeader.tsx

依頼例

Review the diff for this task.

Git

view commit history

git log

git log --oneline -5

意味

Shows commit history.

使う場面

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

git log --oneline -5

依頼例

Show the five most recent commits.

Git

stage changes

git add

git add src/lib/terminal-commands.ts

意味

Selects changes to include in the next commit.

使う場面

Use explicit paths for focused commits.

git add src/lib/terminal-commands.ts

依頼例

Stage only files related to this terminal commands page.

Git

save commit

git commit

git commit -m "Add terminal command reference"

意味

Records staged changes into Git history.

使う場面

Use it after reviewing the staged changes.

git commit -m "Add terminal command reference"

依頼例

Commit the staged changes with a clear message.

開発サーバー

stop running command

Ctrl+C

Press Ctrl+C in the dev server terminal

意味

Interrupts the currently running terminal command.

使う場面

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

注意

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

Press Ctrl+C in the dev server terminal

依頼例

Stop the running dev server.

開発サーバー

list open files and ports

lsof

lsof -i :3001

意味

Can show which process is using a port.

使う場面

Use it when a dev server fails with EADDRINUSE.

lsof -i :3001

依頼例

Find which process is using port 3001.

開発サーバー

list processes

ps

ps aux

意味

Shows running processes.

使う場面

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

ps aux

依頼例

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

安全操作

stop process by PID

kill

kill 12345

意味

Sends a signal to stop a process by process ID.

使う場面

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

注意

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

kill 12345

依頼例

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

ネットワーク

make HTTP request

curl

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

意味

Sends HTTP requests from the terminal and prints the response.

使う場面

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

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

依頼例

Use curl to check whether this page returns 200.

ネットワーク

check network reachability

ping

ping 172.30.1.55

意味

Checks whether a host responds to basic network packets.

使う場面

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

ping 172.30.1.55

依頼例

Check whether this device can reach the dev machine IP.

検索と確認

locate command executable

which

which node

意味

Shows which executable file will run for a command name.

使う場面

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

which node

依頼例

Check which node executable is being used.

安全操作

change file permissions

chmod

chmod +x script.sh

意味

Changes read, write, or execute permissions on files.

使う場面

Use it when a local script should be executable.

注意

Avoid broad permission changes such as chmod -R 777.

chmod +x script.sh

依頼例

Explain the safest permission change for this script.