If you’ve ever built an Angular app manually, you know the struggle: endless setup, file wiring, and repetitive boilerplate. That’s where Angular CLI Commands step in. They automate the heavy lifting — creating projects, generating components, testing, and even deployment — so you can focus on building features instead of wrestling with configs.
In this guide, we’ll explore 15 essential Angular CLI Commands that every developer should know in 2025. Whether you’re just starting with Angular or upgrading to Angular 17, these commands will save you time, reduce errors, and keep your workflow consistent.

Here’s how I use them — no fluff, just the stuff that works
Installing Angular CLI
To start using Angular CLI anywhere on your system, install it globally:
npm install -g @angular/cliVerify the installation with:
ng version
💡 Pro Tip: Keep it updated! Angular CLI releases new features regularly. Check the Angular CLI GitHub releases page or simply run:
ng update @angular/cli @angular/coreCreating Your First Angular Project
Spinning up a brand-new Angular app is as easy as:
ng new task-tracker
cd task-tracker
ng serveVisit http://localhost:4200 and boom — your app is running with live reload enabled.
No manual builds, no browser refreshes. Just write, save, and see changes instantly.
What’s Inside the Project?
Running ng new builds out a full workspace:
src/– your actual appprojects/– optional, if you’re juggling multiple apps/libsangular.json– config central; controls build and serve behavior
You don’t have to touch angular.json often, but it’s good to know where the knobs and switches live.
Understanding the Project Structure
When you generate a project with ng new, Angular CLI builds a standard workspace:
- src/ – main application code
- projects/ – for multiple apps or libraries
- angular.json – your configuration hub
- package.json – dependency manager
- tsconfig.json – TypeScript configuration
This structure ensures consistency across Angular projects — whether it’s your first app or your fiftieth.For modern reactivity approaches, check out Angular Signals: 9 Powerful Reasons They’re Revolutionizing Reactive Programming.
The Angular CLI Command Format
Most Angular CLI Commands follow a consistent pattern:
ng [command] [name] --[options]
Examples:
ng g c dashboard --skip-tests
ng build --configuration production
Options can be:
- Short (
-t) - Long (
--skip-tests) - Boolean flags (
--enable-xyzor--no-enable-xyz)
Knowing this format makes commands easier to remember (and saves you from constant Googling).
Generate Components, Services, and More
One of the most powerful Angular CLI features is scaffolding:
ng generate component login-form
# shorthand
ng g c login-form
Other useful generators:
ng g service auth
ng g guard auth
ng g directive highlight
ng g pipe capitalize
💡 Pro Tip: Add --flat to avoid creating a new folder, or --module app to auto-import in a specific module.
Running and Serving Your App
To run your project locally:
ng serve
# or shorthand
ng s
By default, it runs on port 4200, but you can change it:
ng serve --port 4500
Now you can run multiple Angular apps simultaneously without conflicts.
Building for Production
Ready to ship your app? Run:
ng build --configuration production
This optimizes your code by minifying, tree-shaking, and bundling assets. The output lives inside the dist/ folder, ready to be deployed.
💡 Pro Tip: Use custom configurations in angular.json for staging or testing environments.
Adding Dependencies with ng add
Instead of manually editing configs, let CLI handle it:
ng add @angular/material
This installs Angular Material and updates your project automatically. No more fiddling with package.json or angular.json.
Keeping Your Project Updated with ng update
Stay current with Angular’s ecosystem:
ng update
It suggests updates and even applies migrations. This keeps your project secure, optimized, and aligned with Angular’s best practices.
Running Tests with ng test
Unit tests are first-class citizens in Angular:
ng test
# shorthand
ng t
This launches Karma, runs your tests, and gives real-time feedback.
Linting Code with ng lint
Catch bugs before they reach production:
ng lint
It runs your linting configuration (usually ESLint) and ensures your code follows best practices.
Exploring ng e2e for End-to-End Testing
For full workflow tests:
ng e2e
This runs your app in a browser and tests real user scenarios using Protractor or Cypress (depending on setup).
Using ng generate for Advanced Scaffolding
ng generate goes beyond components and services. You can scaffold:
- Modules:
ng g module feature - Routing:
ng g module app-routing --flat --module=app - Interfaces:
ng g interface user
This keeps your project structure clean and consistent.
Deploying Apps with Angular CLI
Deployment is easier than ever:
ng deploy
This command integrates with platforms like Firebase Hosting, Netlify, and GitHub Pages — no manual setup required.
The 7 Commands I Use All the Time
While Angular CLI has dozens of commands, these 7 Angular CLI Commands are burned into my muscle memory because I use them almost daily:
| Command | Description |
|---|---|
ng add | Creates a new Angular project |
ng build | Compiles your app for production (alias: ng b). |
ng serve | Serves your app locally and watches for file changes (alias: ng s). |
ng lint | Checks your code for issues using linting tools. |
ng generate | Scaffolds new components, services, routes, and more (alias: ng g). |
ng test | Runs unit tests (alias: ng t). |
ng update | Updates Angular CLI and project dependencies |
💡 Pro Tip: If you’re new to Angular CLI Commands, start with these seven. They cover 90% of common tasks, and once they’re second nature, you’ll feel a huge boost in speed and confidence.
Bonus Pro Tips to Master Angular CLI
- Use
ng helpto list all available commands. - Alias frequently used commands (
ng s -oopens the app in a browser automatically. - Combine flags for maximum efficiency (
ng build --prod --aot). - Automate repetitive tasks with custom schematics.
To sum it up, the Angular CLI Commands aren’t just shortcuts — they’re the backbone of modern Angular development. From spinning up projects in seconds to deploying apps with a single command, the CLI is designed to maximize productivity and maintain consistency.
If you’ve been doing things manually, now’s the time to switch. And for cleaner Angular code, pair these with smart practices like the Async Pipe in Angular.
And there you have it — 15 Angular CLI Commands every developer should master in 2025, plus my personal 7 go-to favorites. Start with the basics, build confidence, and then explore the advanced commands as you grow.
Happy coding, and may the CLI always be on your side! ⚡
Leave a Reply