> For the complete documentation index, see [llms.txt](https://education.raspberrypiaustralia.online/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://education.raspberrypiaustralia.online/configuration-raspi-config/raspi-config-tool-from-the-command-line.md).

# raspi-config tool from the command line

## <mark style="color:blue;">Using raspi-config from the Command Line</mark>

<mark style="color:yellow;">`raspi-config`</mark> is a powerful configuration tool for Raspberry Pi that allows you to easily customize various settings. While it provides an interactive menu-driven interface, it can also be used non-interactively from the command line. This tutorial will guide you through using `raspi-config` from the CLI.

### <mark style="color:blue;">Basic Syntax</mark>

To use `raspi-config` from the command line, you need to use the following syntax:

```bash
sudo raspi-config nonint <command> <arguments>
```

Note that you need to use `sudo` because modifying system settings requires root privileges.

### <mark style="color:blue;">Examples</mark>

Here are some examples of commonly used <mark style="color:yellow;">`raspi-config`</mark> commands from the CLI:

#### <mark style="color:green;">Change the Hostname</mark>

To set the hostname of your Raspberry Pi, use the following command:

```bash
sudo raspi-config nonint do_hostname <hostname>
```

Replace `<hostname>` with the desired hostname for your Raspberry Pi.

Example:

```bash
sudo raspi-config nonint do_hostname mypi
```

#### <mark style="color:green;">Enable/Disable SSH</mark>

To enable or disable SSH access on your Raspberry Pi, use the following command:

```bash
sudo raspi-config nonint do_ssh <0/1>
```

* Use `0` to enable SSH
* Use `1` to disable SSH

Example:

```bash
sudo raspi-config nonint do_ssh 0
```

#### <mark style="color:green;">Change the Time Zone</mark>

To set the time zone on your Raspberry Pi, use the following command:

```
sudo raspi-config nonint do_change_timezone <timezone>
```

Replace `<timezone>` with the desired time zone.

Example:

```
sudo raspi-config nonint do_change_timezone America/New_York
```

#### <mark style="color:green;">Change the Locale</mark>

To set the locale on your Raspberry Pi, use the following command:

```bash
Copy codesudo raspi-config nonint do_change_locale <locale>
```

Replace `<locale>` with the desired locale.

Example:

```bash
sudo raspi-config nonint do_change_locale en_US.UTF-8
```

#### <mark style="color:green;">Enable/Disable VNC</mark>

To enable or disable the VNC server on your Raspberry Pi, use the following command:

```bash
sudo raspi-config nonint do_vnc <0/1>
```

* Use `0` to enable VNC
* Use `1` to disable VNC

Example:

```
sudo raspi-config nonint do_vnc 0
```

#### <mark style="color:green;">Expand Filesystem</mark>

To expand the filesystem to fill the entire SD card, use the following command:

```
sudo raspi-config nonint do_expand_rootfs
```

Note that this command will immediately start the partition expansion process without any confirmation.

### <mark style="color:blue;">Conclusion</mark>

Using <mark style="color:yellow;">`raspi-config`</mark> from the command line provides a convenient way to automate the configuration of your Raspberry Pi. By using the <mark style="color:yellow;">`nonint`</mark> option and the appropriate commands, you can easily modify various settings without the need for an interactive menu.

Remember to always use `sudo` when running `raspi-config` commands, as they require root privileges to modify system settings.

For a complete list of available commands and their usage, you can refer to the `raspi-config` documentation or run `raspi-config` with the `--help` option.

I hope this tutorial helps you effectively use `raspi-config` from the command line on your Raspberry Pi!


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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://education.raspberrypiaustralia.online/configuration-raspi-config/raspi-config-tool-from-the-command-line.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.
