# Free Up Space on Ubuntu

\ <br>

### 1. Clean the APT Cache (and do it regularly)

<br>

> Check how big your apt cache is

```bash
sudo du -sh /var/cache/apt/archives
```

<br>

> Clean the apt cache

```bash
sudo apt-get clean
```

\ <br>

### 2. Remove Old Kernels (if no longer required)

<br>

```bash
sudo apt-get autoremove --purge
```

\ <br>

### 3. Get rid of packages (if no longer required)

<br>

```bash
sudo apt-get autoremove
```

\ <br>

### 4. Clear systemd journal logs

<br>

> Check the log size

```bash
journalctl --disk-usage
```

<br>

> Clear the logs that are older than a certain days (3days in this example!!)

```bash
sudo journalctl --vacuum-time=3d
```

\ <br>

### 5. Clean the thumbnail cache

* Ubuntu automatically creates a thumbnail, for viewing in the file manager.
* It stores those thumbnails in a hidden directory in your user account at the location \~/.cache/thumbnails.

<br>

> Check the size of thumbnail

```bash
du -sh ~/.cache/thumbnails
```

<br>

> Clear the thumbnail cache (every few months or so!)

```bash
rm -rf ~/.cache/thumbnails/*
```


---

# 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://chloe-codes1.gitbook.io/til/linux/ubuntu/free_up_space_on_ubuntu.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.
