Tools & Workflow
Terminal basics
The terminal lets you control your computer through text commands. Most development tools — including Git, Node.js, and npm — are used through the terminal.
Navigating the Filesystem
These commands let you move around and explore your files.
pwd # print working directory (where you are)ls # list files in current folderls -la # list all files including hidden onescd projects # change into the projects foldercd .. # go up one levelcd ~ # go to your home directoryTab Completion
Press Tab to auto-complete file and folder names. Press it twice to see all matching options. This saves time and avoids typos.
เคล็ดลับ Terminal
ถ้าพิมพ์ชื่อโฟลเดอร์ไม่ครบ แค่กด Tab แล้ว Terminal จะเติมให้อัตโนมัติ ถ้ามีหลายตัวเลือกให้กด Tab สองครั้งเพื่อดูทั้งหมด
Creating and Managing Files
mkdir my-project # create a new foldertouch index.html # create a new empty filecp file.txt backup.txt # copy a filemv old-name.txt new-name.txt # rename or move a filerm file.txt # delete a filerm -rf folder/ # delete a folder and its contentsระวัง rm -rf
คำสั่ง rm -rf ลบไฟล์และโฟลเดอร์โดยไม่ถามยืนยันและไม่มี Trash — ข้อมูลจะหายถาวร ตรวจสอบ path ให้ดีก่อนรันคำสั่งนี้เสมอ
Running Programs
Most tools you install are run as terminal commands.
node index.js # run a JavaScript file with Nodenpm install # install project dependenciesnpm run dev # run the dev script from package.jsonnpx create-next-app # run a package without installing it globallyStarting a Next.js project from scratch
npx create-next-app@latest my-appcd my-appnpm run devThis creates a new Next.js project in the my-app folder, installs all dependencies, and starts the dev server at http://localhost:3000.
Command History and Shortcuts
| Shortcut | Action |
|---|---|
↑ / ↓ | Browse previous commands |
Ctrl+R | Search command history |
Ctrl+C | Cancel the running command |
Ctrl+L | Clear the terminal screen |
Ctrl+A | Jump to start of line |
Ctrl+E | Jump to end of line |