<p>Craft-Scripts will do this for you: <a href="https://github.com/nystudio107/craft-scripts#clear_cachessh" rel="nofollow noreferrer">https://github.com/nystudio107/craft-scripts#clear_cachessh</a></p>

<p>You can see what it does via the source: <a href="https://github.com/nystudio107/craft-scripts/blob/master/scripts/clear_caches.sh" rel="nofollow noreferrer">https://github.com/nystudio107/craft-scripts/blob/master/scripts/clear_caches.sh</a></p>

<p>As for <code>cache/clear</code> this clear's Yii2's cache... which Craft CMS uses for almost nothing. Template Caches are always in the db, compiled templates are always cached on disk as files, and so on.</p>

CC BY-SA 4.0
2018-08-12T11:54:10.400Z
Thanks for the clarification. Will check out craft-scripts :)
Bramus
CC BY-SA 4.0
2018-08-10T22:15:38.757Z
2018-08-10T22:15:38.757Z
andrew.welch
<p>I was looking for a way to clear the “template caches” and “compiled templates” from the CLI, as I want to automatically do this after every auto-deploy of the site I've created.</p>

<p>For this I was looking into the <code>craft</code> binary and its <code>cache/list</code> command. However, when running <code>./craft cache/list</code> it only returns me <code>cache (yii\caching\FileCache)</code>.</p>

<p>This felt kind of strange to me, as I was expecting a list similar to the one to be seen in the admin at the URL <code>/admin/utilities/clear-caches</code>:</p>

<p><a href="https://i.sstatic.net/9Za0X.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/9Za0X.png" alt="List of possible caches, as shown in the admin"></a></p>

<p>So hereby I'm wondering if it's possible to clear any of these caches show above from the CLI. Or is the <code>cache/clear</code> command for something else that I'm not aware of?</p>

<craft3><cache><cli>
Clear template cache from the CLI?
# Clear template cache from the CLI?

(Asked by: username_0 on 2018-08-10)

I was looking for a way to clear the “template caches” and “compiled templates” from the CLI, as I want to automatically do this after every auto-deploy of the site I've created.

For this I was looking into the `craft` binary and its `cache/list` command. However, when running `./craft cache/list` it only returns me `cache (yii\caching\FileCache)`.

This felt kind of strange to me, as I was expecting a list similar to the one to be seen in the admin at the URL `/admin/utilities/clear-caches`:

[![List of possible caches, as shown in the admin](https://i.sstatic.net/9Za0X.png)](https://i.sstatic.net/9Za0X.png)

So hereby I'm wondering if it's possible to clear any of these caches show above from the CLI. Or is the `cache/clear` command for something else that I'm not aware of?

**Tags:** craft3, cache, cli

---

## 1 answers

### Answer by username_1 on 2018-08-10. Score: 3 | Accepted answer

Craft-Scripts will do this for you: <https://github.com/nystudio107/craft-scripts#clear_cachessh>

You can see what it does via the source: <https://github.com/nystudio107/craft-scripts/blob/master/scripts/clear_caches.sh>

As for `cache/clear` this clear's Yii2's cache... which Craft CMS uses for almost nothing. Template Caches are always in the db, compiled templates are always cached on disk as files, and so on.

> **Comments:**
> **username_0**: Thanks for the clarification. Will check out craft-scripts :)  

---

