Engineering Tools for AI

Programmation

Commandes terminal essentielles

Guide consultable des commandes terminal courantes pour modifier, exécuter, tester et déboguer un projet web.

33 commandes

Navigation

print working directory

pwd

pwd

Sens

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

Quand l'utiliser

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

Exemple

pwd

Exemple de demande

Check which folder the terminal is currently in.

Navigation

list files

ls

ls

Sens

Lists files and folders in the current directory.

Quand l'utiliser

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

Exemple

ls

Exemple de demande

List the files in the current project folder.

Navigation

change directory

cd

cd ~/projects/my-web-app

Sens

Moves the terminal to another folder.

Quand l'utiliser

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

Attention

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

Exemple

cd ~/projects/my-web-app

Exemple de demande

Move to the project folder before running commands.

Navigation

clear screen

clear

clear

Sens

Clears visible terminal output without changing files or command history.

Quand l'utiliser

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

Exemple

clear

Exemple de demande

Clear the terminal before rerunning the build.

Fichiers et dossiers

show file contents

cat

cat package.json

Sens

Prints the contents of a file to the terminal.

Quand l'utiliser

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

Attention

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

Exemple

cat package.json

Exemple de demande

Show the package.json scripts.

Fichiers et dossiers

show selected lines

sed

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

Sens

Can print a selected range of lines from a file.

Quand l'utiliser

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

Exemple

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

Exemple de demande

Show the first 120 lines of SiteHeader.tsx.

Fichiers et dossiers

make directory

mkdir

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

Sens

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

Quand l'utiliser

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

Exemple

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

Exemple de demande

Create the route folder for the terminal commands page.

Fichiers et dossiers

copy files

cp

cp .env.example .env.local

Sens

Copies a file or folder to another location.

Quand l'utiliser

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

Attention

If the destination file exists, cp can overwrite it.

Exemple

cp .env.example .env.local

Exemple de demande

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

Fichiers et dossiers

move or rename

mv

mv old-name.ts new-name.ts

Sens

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

Quand l'utiliser

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

Attention

Renaming route folders changes URLs.

Exemple

mv old-name.ts new-name.ts

Exemple de demande

Rename this file and update imports if needed.

Sécurité

remove files

rm

rm unused-file.ts

Sens

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

Quand l'utiliser

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

Attention

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

Exemple

rm unused-file.ts

Exemple de demande

Before deleting this file, explain what will be removed.

Recherche et inspection

ripgrep search

rg

rg -n "errorMessageGuide" src

Sens

Searches text quickly across files.

Quand l'utiliser

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

Exemple

rg -n "errorMessageGuide" src

Exemple de demande

Search where this component is imported.

Recherche et inspection

list tracked-looking files fast

rg --files

rg --files src/app

Sens

Lists file paths quickly, respecting common ignore rules.

Quand l'utiliser

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

Exemple

rg --files src/app

Exemple de demande

List reference page files under src/app.

Recherche et inspection

find paths

find

find src -name 'page.tsx'

Sens

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

Quand l'utiliser

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

Exemple

find src -name 'page.tsx'

Exemple de demande

Find every page.tsx route file.

Recherche et inspection

count lines or words

wc

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

Sens

Counts lines, words, or bytes.

Quand l'utiliser

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

Exemple

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

Exemple de demande

Count how many lines are in this data file.

Paquets

install dependencies

npm install

npm install

Sens

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

Quand l'utiliser

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

Attention

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

Exemple

npm install

Exemple de demande

Install dependencies only if node_modules is missing.

Serveur dev

start dev server

npm run dev

npm run dev

Sens

Runs the project's local development server script.

Quand l'utiliser

Use it to test pages in the browser while editing.

Attention

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

Exemple

npm run dev

Exemple de demande

Start the dev server and tell me the local URL.

Paquets

production build

npm run build

npm run build

Sens

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

Quand l'utiliser

Run it before deployment or after adding new pages.

Exemple

npm run build

Exemple de demande

Run the production build and summarize warnings or failures.

Paquets

lint check

npm run lint

npm run lint

Sens

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

Quand l'utiliser

Run it before build when you want quick feedback.

Exemple

npm run lint

Exemple de demande

Run lint and show only actionable errors.

Paquets

check Node version

node -v

node -v

Sens

Prints the installed Node.js version.

Quand l'utiliser

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

Exemple

node -v

Exemple de demande

Check the Node.js version before explaining this warning.

Paquets

run package command

npx

npx next info

Sens

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

Quand l'utiliser

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

Attention

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

Exemple

npx next info

Exemple de demande

Explain whether this npx command needs network access.

Git

check Git status

git status

git status --short

Sens

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

Quand l'utiliser

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

Exemple

git status --short

Exemple de demande

Check Git status and summarize the changed files.

Git

show code differences

git diff

git diff -- src/components/SiteHeader.tsx

Sens

Shows line-by-line differences in changed files.

Quand l'utiliser

Use it to review exactly what changed before committing.

Exemple

git diff -- src/components/SiteHeader.tsx

Exemple de demande

Review the diff for this task.

Git

view commit history

git log

git log --oneline -5

Sens

Shows commit history.

Quand l'utiliser

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

Exemple

git log --oneline -5

Exemple de demande

Show the five most recent commits.

Git

stage changes

git add

git add src/lib/terminal-commands.ts

Sens

Selects changes to include in the next commit.

Quand l'utiliser

Use explicit paths for focused commits.

Exemple

git add src/lib/terminal-commands.ts

Exemple de demande

Stage only files related to this terminal commands page.

Git

save commit

git commit

git commit -m "Add terminal command reference"

Sens

Records staged changes into Git history.

Quand l'utiliser

Use it after reviewing the staged changes.

Exemple

git commit -m "Add terminal command reference"

Exemple de demande

Commit the staged changes with a clear message.

Serveur dev

stop running command

Ctrl+C

Press Ctrl+C in the dev server terminal

Sens

Interrupts the currently running terminal command.

Quand l'utiliser

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

Attention

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

Exemple

Press Ctrl+C in the dev server terminal

Exemple de demande

Stop the running dev server.

Serveur dev

list open files and ports

lsof

lsof -i :3001

Sens

Can show which process is using a port.

Quand l'utiliser

Use it when a dev server fails with EADDRINUSE.

Exemple

lsof -i :3001

Exemple de demande

Find which process is using port 3001.

Serveur dev

list processes

ps

ps aux

Sens

Shows running processes.

Quand l'utiliser

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

Exemple

ps aux

Exemple de demande

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

Sécurité

stop process by PID

kill

kill 12345

Sens

Sends a signal to stop a process by process ID.

Quand l'utiliser

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

Attention

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

Exemple

kill 12345

Exemple de demande

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

Réseau

make HTTP request

curl

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

Sens

Sends HTTP requests from the terminal and prints the response.

Quand l'utiliser

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

Exemple

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

Exemple de demande

Use curl to check whether this page returns 200.

Réseau

check network reachability

ping

ping 172.30.1.55

Sens

Checks whether a host responds to basic network packets.

Quand l'utiliser

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

Exemple

ping 172.30.1.55

Exemple de demande

Check whether this device can reach the dev machine IP.

Recherche et inspection

locate command executable

which

which node

Sens

Shows which executable file will run for a command name.

Quand l'utiliser

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

Exemple

which node

Exemple de demande

Check which node executable is being used.

Sécurité

change file permissions

chmod

chmod +x script.sh

Sens

Changes read, write, or execute permissions on files.

Quand l'utiliser

Use it when a local script should be executable.

Attention

Avoid broad permission changes such as chmod -R 777.

Exemple

chmod +x script.sh

Exemple de demande

Explain the safest permission change for this script.