Engineering Tools for AI

Programmierung

Wichtige Terminalbefehle

Ein durchsuchbarer Leitfaden zu häufigen Terminalbefehlen beim Bearbeiten, Testen, Debuggen und Ausführen eines Webprojekts.

33 Treffer

Navigation

print working directory

pwd

pwd

Bedeutung

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

Einsatz

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

Beispiel

pwd

Anfragebeispiel

Check which folder the terminal is currently in.

Navigation

list files

ls

ls

Bedeutung

Lists files and folders in the current directory.

Einsatz

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

Beispiel

ls

Anfragebeispiel

List the files in the current project folder.

Navigation

change directory

cd

cd ~/projects/my-web-app

Bedeutung

Moves the terminal to another folder.

Einsatz

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

Vorsicht

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

Beispiel

cd ~/projects/my-web-app

Anfragebeispiel

Move to the project folder before running commands.

Navigation

clear screen

clear

clear

Bedeutung

Clears visible terminal output without changing files or command history.

Einsatz

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

Beispiel

clear

Anfragebeispiel

Clear the terminal before rerunning the build.

Dateien und Ordner

show file contents

cat

cat package.json

Bedeutung

Prints the contents of a file to the terminal.

Einsatz

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

Vorsicht

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

Beispiel

cat package.json

Anfragebeispiel

Show the package.json scripts.

Dateien und Ordner

show selected lines

sed

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

Bedeutung

Can print a selected range of lines from a file.

Einsatz

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

Beispiel

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

Anfragebeispiel

Show the first 120 lines of SiteHeader.tsx.

Dateien und Ordner

make directory

mkdir

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

Bedeutung

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

Einsatz

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

Beispiel

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

Anfragebeispiel

Create the route folder for the terminal commands page.

Dateien und Ordner

copy files

cp

cp .env.example .env.local

Bedeutung

Copies a file or folder to another location.

Einsatz

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

Vorsicht

If the destination file exists, cp can overwrite it.

Beispiel

cp .env.example .env.local

Anfragebeispiel

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

Dateien und Ordner

move or rename

mv

mv old-name.ts new-name.ts

Bedeutung

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

Einsatz

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

Vorsicht

Renaming route folders changes URLs.

Beispiel

mv old-name.ts new-name.ts

Anfragebeispiel

Rename this file and update imports if needed.

Sicherheit

remove files

rm

rm unused-file.ts

Bedeutung

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

Einsatz

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

Vorsicht

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

Beispiel

rm unused-file.ts

Anfragebeispiel

Before deleting this file, explain what will be removed.

Suchen und prüfen

ripgrep search

rg

rg -n "errorMessageGuide" src

Bedeutung

Searches text quickly across files.

Einsatz

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

Beispiel

rg -n "errorMessageGuide" src

Anfragebeispiel

Search where this component is imported.

Suchen und prüfen

list tracked-looking files fast

rg --files

rg --files src/app

Bedeutung

Lists file paths quickly, respecting common ignore rules.

Einsatz

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

Beispiel

rg --files src/app

Anfragebeispiel

List reference page files under src/app.

Suchen und prüfen

find paths

find

find src -name 'page.tsx'

Bedeutung

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

Einsatz

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

Beispiel

find src -name 'page.tsx'

Anfragebeispiel

Find every page.tsx route file.

Suchen und prüfen

count lines or words

wc

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

Bedeutung

Counts lines, words, or bytes.

Einsatz

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

Beispiel

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

Anfragebeispiel

Count how many lines are in this data file.

Pakete

install dependencies

npm install

npm install

Bedeutung

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

Einsatz

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

Vorsicht

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

Beispiel

npm install

Anfragebeispiel

Install dependencies only if node_modules is missing.

Dev-Server

start dev server

npm run dev

npm run dev

Bedeutung

Runs the project's local development server script.

Einsatz

Use it to test pages in the browser while editing.

Vorsicht

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

Beispiel

npm run dev

Anfragebeispiel

Start the dev server and tell me the local URL.

Pakete

production build

npm run build

npm run build

Bedeutung

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

Einsatz

Run it before deployment or after adding new pages.

Beispiel

npm run build

Anfragebeispiel

Run the production build and summarize warnings or failures.

Pakete

lint check

npm run lint

npm run lint

Bedeutung

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

Einsatz

Run it before build when you want quick feedback.

Beispiel

npm run lint

Anfragebeispiel

Run lint and show only actionable errors.

Pakete

check Node version

node -v

node -v

Bedeutung

Prints the installed Node.js version.

Einsatz

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

Beispiel

node -v

Anfragebeispiel

Check the Node.js version before explaining this warning.

Pakete

run package command

npx

npx next info

Bedeutung

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

Einsatz

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

Vorsicht

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

Beispiel

npx next info

Anfragebeispiel

Explain whether this npx command needs network access.

Git

check Git status

git status

git status --short

Bedeutung

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

Einsatz

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

Beispiel

git status --short

Anfragebeispiel

Check Git status and summarize the changed files.

Git

show code differences

git diff

git diff -- src/components/SiteHeader.tsx

Bedeutung

Shows line-by-line differences in changed files.

Einsatz

Use it to review exactly what changed before committing.

Beispiel

git diff -- src/components/SiteHeader.tsx

Anfragebeispiel

Review the diff for this task.

Git

view commit history

git log

git log --oneline -5

Bedeutung

Shows commit history.

Einsatz

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

Beispiel

git log --oneline -5

Anfragebeispiel

Show the five most recent commits.

Git

stage changes

git add

git add src/lib/terminal-commands.ts

Bedeutung

Selects changes to include in the next commit.

Einsatz

Use explicit paths for focused commits.

Beispiel

git add src/lib/terminal-commands.ts

Anfragebeispiel

Stage only files related to this terminal commands page.

Git

save commit

git commit

git commit -m "Add terminal command reference"

Bedeutung

Records staged changes into Git history.

Einsatz

Use it after reviewing the staged changes.

Beispiel

git commit -m "Add terminal command reference"

Anfragebeispiel

Commit the staged changes with a clear message.

Dev-Server

stop running command

Ctrl+C

Press Ctrl+C in the dev server terminal

Bedeutung

Interrupts the currently running terminal command.

Einsatz

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

Vorsicht

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

Beispiel

Press Ctrl+C in the dev server terminal

Anfragebeispiel

Stop the running dev server.

Dev-Server

list open files and ports

lsof

lsof -i :3001

Bedeutung

Can show which process is using a port.

Einsatz

Use it when a dev server fails with EADDRINUSE.

Beispiel

lsof -i :3001

Anfragebeispiel

Find which process is using port 3001.

Dev-Server

list processes

ps

ps aux

Bedeutung

Shows running processes.

Einsatz

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

Beispiel

ps aux

Anfragebeispiel

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

Sicherheit

stop process by PID

kill

kill 12345

Bedeutung

Sends a signal to stop a process by process ID.

Einsatz

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

Vorsicht

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

Beispiel

kill 12345

Anfragebeispiel

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

Netzwerk

make HTTP request

curl

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

Bedeutung

Sends HTTP requests from the terminal and prints the response.

Einsatz

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

Beispiel

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

Anfragebeispiel

Use curl to check whether this page returns 200.

Netzwerk

check network reachability

ping

ping 172.30.1.55

Bedeutung

Checks whether a host responds to basic network packets.

Einsatz

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

Beispiel

ping 172.30.1.55

Anfragebeispiel

Check whether this device can reach the dev machine IP.

Suchen und prüfen

locate command executable

which

which node

Bedeutung

Shows which executable file will run for a command name.

Einsatz

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

Beispiel

which node

Anfragebeispiel

Check which node executable is being used.

Sicherheit

change file permissions

chmod

chmod +x script.sh

Bedeutung

Changes read, write, or execute permissions on files.

Einsatz

Use it when a local script should be executable.

Vorsicht

Avoid broad permission changes such as chmod -R 777.

Beispiel

chmod +x script.sh

Anfragebeispiel

Explain the safest permission change for this script.