# Netlify CLI
> Deploy and manage Netlify sites from the terminal

## Summary
Deploy and manage Netlify sites from the terminal. Run a local dev server, deploy previews, manage serverless functions, and configure build settings without leaving the command line.

## Capabilities
- Deploy sites to Netlify with drag-and-drop or CI integration
- Run a local development server with Netlify Functions and Edge Functions
- Create deploy previews for testing before production
- Manage environment variables and build settings
- Stream function logs in real time
- Link local projects to existing Netlify sites

## When to Use
- Deploying static sites or Jamstack applications to Netlify
- Developing and testing Netlify Functions locally
- Need quick deploy previews for pull request reviews
- Managing Netlify site settings and environment variables

## When NOT to Use
- Deploying full backend services with persistent processes (use flyctl or Heroku)
- Managing infrastructure beyond Netlify's scope (use Terraform)
- Already committed to a different hosting platform

## Key Flags
- `deploy`: Deploy the site to Netlify
- `deploy --prod`: Deploy directly to the production URL
- `dev`: Start a local development server with Netlify features
- `link`: Link the current directory to a Netlify site
- `functions:serve`: Serve serverless functions locally for testing

## Usage Patterns
### Deploy a production build
```
netlify deploy --prod --dir=dist
```
Deploys the dist directory as the production version of the site

### Start local development
```
netlify dev
```
Starts a local server with Netlify Functions, redirects, and environment

### Create a deploy preview
```
netlify deploy --dir=build
```
Deploys to a unique preview URL for testing before going to production

## Input / Output
- **stdin**: Not typically used
- **stdout**: Deployment URLs, build logs, and site status

## Installation
- **npm**: `npm i -g netlify-cli`

## Related Tools
- [vercel](/tools/vercel) (alternative): Vercel is a competing platform with similar deployment workflow
- [wrangler](/tools/wrangler) (alternative): Wrangler deploys to Cloudflare Pages and Workers
- [hugo](/tools/hugo) (complementary): Hugo generates static sites commonly deployed to Netlify

---
Source: https://littlescripts.sh/tools/netlify-cli
