# 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!
