Master the command line with this comprehensive cheat sheet for web developers
Initialize a new Git repository
$ git initClone a repository
$ git clone https://github.com/user/repo.gitCheck the status of your repository
$ git statusStage changes for commit
$ git add . (all files) or git add filename.jsCommit staged changes
$ git commit -m "Your commit message"Push commits to remote repository
$ git push origin mainPull latest changes from remote
$ git pull origin mainList, create, or delete branches
$ git branch (list) | git branch feature-name (create) | git branch -d branch-name (delete)Switch branches or restore files
$ git checkout branch-name or git checkout -b new-branchMerge branches
$ git merge feature-branchReapply commits on top of another base
$ git rebase mainView commit history
$ git log --oneline --graph --allShow changes between commits, branches, etc.
$ git diff or git diff branch1..branch2Temporarily save changes
$ git stash (save) | git stash pop (restore)Undo commits or unstage files
$ git reset HEAD~1 (soft) | git reset --hard HEAD~1 (hard)Manage remote repositories
$ git remote -v (list) | git remote add origin urlInitialize a new Node.js project
$ npm init or npm init -y (skip prompts)Install dependencies
$ npm install (all) | npm install package-name | npm install -D package-name (dev)Remove a package
$ npm uninstall package-nameUpdate packages
$ npm update or npm update package-nameRun a script defined in package.json
$ npm run dev | npm run build | npm run testList installed packages
$ npm list or npm list --depth=0Check for outdated packages
$ npm outdatedCheck for security vulnerabilities
$ npm audit | npm audit fixExecute packages without installing globally
$ npx create-next-app@latest | npx tsc --initInstall dependencies (faster than npm)
$ pnpm install or pnpm iAdd a package
$ pnpm add package-name | pnpm add -D package-nameRemove a package
$ pnpm remove package-nameUpdate packages
$ pnpm update or pnpm upRun package scripts
$ pnpm dev | pnpm buildInitialize a new project
$ yarn init or yarn init -yInstall dependencies
$ yarn install or yarnAdd a package
$ yarn add package-name | yarn add -D package-nameRemove a package
$ yarn remove package-nameUpgrade packages
$ yarn upgrade or yarn upgrade package-nameBuild an image from a Dockerfile
$ docker build -t image-name .Run a container from an image
$ docker run -d -p 3000:3000 image-nameList running containers
$ docker ps or docker ps -a (all)Stop a running container
$ docker stop container-idRemove a container
$ docker rm container-idList Docker images
$ docker imagesRemove an image
$ docker rmi image-idStart services defined in docker-compose.yml
$ docker-compose up -dStop and remove containers
$ docker-compose downView container logs
$ docker logs container-id or docker logs -f container-idExecute a command in a running container
$ docker exec -it container-id bashDeploy to Vercel
$ vercel or vercel --prodRun development server with Vercel environment
$ vercel devManage environment variables
$ vercel env ls | vercel env addView deployment logs
$ vercel logsList directory contents
$ ls or ls -la (detailed)Change directory
$ cd folder-name | cd .. (up one level) | cd ~ (home)Print working directory
$ pwdCreate a new directory
$ mkdir folder-nameCreate a new file
$ touch filename.jsRemove files or directories
$ rm file.js | rm -rf folder (recursive)Copy files or directories
$ cp source.js dest.js | cp -r folder1 folder2Move or rename files
$ mv old.js new.jsDisplay file contents
$ cat file.jsSearch for patterns in files
$ grep "search term" file.js | grep -r "term" .Find files and directories
$ find . -name "*.js"Change file permissions
$ chmod +x script.sh | chmod 755 fileTransfer data from or to a server
$ curl https://api.example.comCreate a new Next.js application
$ npx create-next-app@latest my-appStart development server
$ npm run devBuild for production
$ npm run buildStart production server
$ npm run startCreate a new Vite project
$ npm create vite@latest my-appStart development server
$ npm run devBuild for production
$ npm run buildPreview production build
$ npm run previewInitialize TypeScript configuration
$ npx tsc --initCompile TypeScript files
$ npx tsc or npx tsc --watchType-check without emitting files
$ npx tsc --noEmitInitialize Prisma in your project
$ npx prisma initCreate and apply migrations
$ npx prisma migrate dev --name initGenerate Prisma Client
$ npx prisma generateOpen Prisma Studio (database GUI)
$ npx prisma studioPush schema changes to database
$ npx prisma db pushSeed your database
$ npx prisma db seedInitialize ESLint configuration
$ npx eslint --initLint all files
$ npx eslint . or npx eslint src/Fix auto-fixable issues
$ npx eslint . --fixRun Playwright tests
$ npx playwright testRun tests in UI mode
$ npx playwright test --uiGenerate test code by recording
$ npx playwright codegen https://example.comShow test report
$ npx playwright show-report