> For the complete documentation index, see [llms.txt](https://wlanpi.gitbook.io/cookbook/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://wlanpi.gitbook.io/cookbook/6.-wi-fi-channel-tool-wifichannel.md).

# 6. Lab: Wi-Fi Channel Tool (wifichannel)

Bonus Lab, more of a warm up Lab

WLAN Pi comes with a small CLI tool called `wifichannel`

This tool began as a simple conversion utility, for switching between channel numbers and centre frequencies.

#### Requirements:

* WLAN Pi Go (powered and connected via USB-C)
* SSH capabilites to the WLAN Pi Go (10.42.0.1)

### Channel maths

Query `wifichannel` with the command

```
wifichannel 7
```

The output gives you information about channel 7

{% tabs %}
{% tab title="Is 2.4 GHz channel 6 recommended?" %}

```
wifichannel 6
```

{% endtab %}

{% tab title="Output" %}
` Band: 2.4 GHz Channel: 6 Center freq: 2437 MHz`` `` `**`Recommended: Yes`**
{% endtab %}
{% endtabs %}

{% tabs %}
{% tab title="Is 6 GHz channel 17 a Preferred Scanning Channel (PSC)?" %}

```
wifichannel 17
```

{% endtab %}

{% tab title="Output" %}
` Band: 6 GHz Channel: 17 Center freq: 6035 MHz`` `` `**`PSC: No`**` `` ``Lower 6 GHz `
{% endtab %}
{% endtabs %}

{% tabs %}
{% tab title="What is the centre frequency of channel 60?" %}

```
wifichannel 60
```

{% endtab %}

{% tab title="Output" %}
` Band: 5 GHz Channel: 60`` `` `**`Center freq: 5300`**` `` ``MHz U-NII-2A `
{% endtab %}
{% endtabs %}

{% tabs %}
{% tab title="What channel uses center frequency 6055 MHz?" %}

```
wifichannel 6055
```

{% endtab %}

{% tab title="Output" %}
` Band: 6 GHz`` `` `**`Channel: 21`**` `` ``PSC: Yes Lower 6 GHz `
{% endtab %}
{% endtabs %}

### List all channels

#### Display all 2.4 GHz channels:

```
wifichannel -2
```

#### Display all 5 GHz channels:

```
wifichannel -5
```

#### How would you display all 6 GHz channels?

{% tabs %}
{% tab title="Hint" %}
This command will help you if you are ever in doubts:

```
wifichannel -h
```

{% endtab %}

{% tab title="Answer" %}

```
wifichannel -6
```

{% endtab %}
{% endtabs %}

{% hint style="info" %}
Note the Lower 6 GHz and Upper 6 GHz channels.

In the FCC regulatory domain, we can use the entire band including the lower and upper 6 GHz channels.

In the ETSI and Ofcom regulatory domains, they can only use the Lower 6 GHz channels.
{% endhint %}

### Filter output with Linux filters (grep)

You can filter the output of most command line utilities to make the output more efficient.

#### Example

How many channels in the 2.4 GHz band are 'recommended'?

First, run the command to display all 2.4 GHz channels:

```
wifichannel -2
```

You could count the lines manually, but there is no need. Computers can already do that, really fast.

Using a Linux utility called `grep` we can filter the output to only include lines that match an expression (a particular string or pattern):

```
wifichannel -2 | grep "Yes"
```

{% hint style="info" %}
Be precise with your search terms (strings), capitalisation matters.
{% endhint %}

{% tabs %}
{% tab title="How many channels in the 2.4 GHz band are " %}
Finally, we can simply count the number of lines returned by the command using word count, that command looks like this:

```
wifichannel -2 | grep "Yes" | wc -l
```

***

{% hint style="info" %}
The `wc` command has nothing to do with restrooms 😉\
It stands for "word count" and the `"l"` argument stands signifies lines.
{% endhint %}
{% endtab %}

{% tab title="Answer" %}
`3`

***

{% hint style="info" %}
You already knew that... right.

but... this filtering allows you to quickly get an answer from the output of command line tools.
{% endhint %}
{% endtab %}
{% endtabs %}

### Install wifichannel to your laptop

If you would like, you can install wifichannel on your laptop and use it even more often. [Here are the instructions](https://github.com/jiribrejcha/wifichannel).


---

# 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 by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://wlanpi.gitbook.io/cookbook/6.-wi-fi-channel-tool-wifichannel.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
