Terminal
You might say
AI gave me a command to run, but I don't know what it will do. Is it safe to run?
Run text commands in a specific folder on your computer or serverA terminal gives you a prompt where commands can start tools, install packages, inspect files, and run a project. The current directory changes what a command affects. Read the command and confirm the path before running anything that changes or deletes files.
When to use it
- Start a development server
- Install project dependencies
- Run build and test commands
- Inspect files, processes, and logs
When NOT to use it
- Paste a command you do not understand with elevated permission
- Run project commands from an unrelated directory
- Share terminal output that contains secrets
- Use a destructive command with an unverified path or wildcard
Anatomy
$ npm run dev
✓ Ready in 1.2s → http://localhost:3000
Starting with $ or %; the preceding path represents the current working directory
The first word specifies an external program or shell built-in function, such as npm, cd, ls, git
Supplementary information after the command, such as run dev specifies the script to be executed
Results, warnings, and errors returned by commands; first look for clues that lead to action
Variants
cd & ls
cd my-first-page ls
Go into the project directory and list the files in it
npm run
npm run dev
Execute startup or build scripts declared in package.json
Ctrl+C
Ctrl + C
Stop a command or development service running in the foreground
clear
clear
Clear the display when there is too much content on the screen
Typical use cases
Run a project
$ npm run dev
> my-first-page@0.1.0 dev
> vite
✓ Ready in 1.2s
→ Local: http://localhost:3000
The development service runs in this process; the local address will stop responding after aborting the process
Install packages
Failed to compile
Error: Cannot find module 'react'
at build (vite.config.js:12)
at processTicksAndRejections (node:internal)
↑ The error message and call stack must be judged together with the execution command
Build and test
~/Desktop $ ls
Documents Downloads my-first-page
~/Desktop $ cd my-first-page
~/Desktop/my-first-page $ ls
index.html package.json README.md
Read logs
✓ Ready — http://localhost:3000
^C
~/Desktop/my-first-page $ The service has stopped and the terminal returns the prompt
Ctrl + C: Abort the command running in the foreground
Further reading