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.


These commands let you move around and explore your files.

pwd # print working directory (where you are)
ls # list files in current folder
ls -la # list all files including hidden ones
cd projects # change into the projects folder
cd .. # go up one level
cd ~ # go to your home directory

Tab 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 folder
touch index.html # create a new empty file
cp file.txt backup.txt # copy a file
mv old-name.txt new-name.txt # rename or move a file
rm file.txt # delete a file
rm -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 Node
npm install # install project dependencies
npm run dev # run the dev script from package.json
npx create-next-app # run a package without installing it globally

Starting a Next.js project from scratch

npx create-next-app@latest my-app
cd my-app
npm run dev

This 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

ShortcutAction
/ Browse previous commands
Ctrl+RSearch command history
Ctrl+CCancel the running command
Ctrl+LClear the terminal screen
Ctrl+AJump to start of line
Ctrl+EJump to end of line
Previous
VS Code tips