# Using console commands

## Working with CLI

We have our PHP compiled, Composer installed, Magento 2 installed.\
But how access them? Everything is scattered across the file system.

That is where CLI comes in handy. It provides aliases for PHP, Composer and Magento in your project.\
We can open it by running a command:

```bash
npm run cli # for NPM
yarn cli # for Yarn
```

Now we have access to PHP, Composer and Magento, we can install PHP dependencies, upgrade Magento and so on.

```bash
php -v
> PHP 7.4.13 (cli) ...

composer --version
> Composer version 1.10.19

# Can be used with alias
c --version
> Composer version 1.10.19

magento setup:upgrade
> Magento upgrade output ...

# Can be used with alias
m se:up
> Magento upgrade output ...
```

## Common Usage

Flushing Magento cache

```bash
magento cache:clean

# or with aliases and shortcuts
m c:c
```

Magento upgrade

```bash
magento setup:upgrade

# or with aliases and shortcuts
m se:up
```

Upgrading Composer dependencies

```bash
composer upgrade

# or with alias
c upgrade
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.create-magento-app.com/usage-guide/cli.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
