Betaflight CLI Explained

by Oscar

What is Betaflight CLI? CLI stands for command line interface, a configuration mode that gives users direct access to all the settings and parameters within the flight control firmware. CLI is a powerful tool, but can be daunting for less technical users. In this guide I will explain why and how to use CLI in Betaflight.

Some of the links on this page are affiliate links. I receive a commission (at no extra cost to you) if you make a purchase after clicking on one of these affiliate links. This helps support the free content for the community on this website. Please read our Affiliate Link Policy for more information.

Why do we use CLI?

CLI was introduced back in the days in Baseflight and it continues to exist in Betaflight, iNav, Emuflight etc.

Due to the vast amount of settings in the flight control software, it would be impossible to list all of them in the GUI (graphical user interface) without making the configurator look too confusing and difficult to use. Most of these settings are rarely changed so it makes sense to “hide it in command lines”.

Another advantage of CLI is how easy it is to list all the settings and make backups in text file, which we will explain how to do in this tutorial.

How to use Betaflight CLI?

The CLI tab is available in Betaflight Configurator (where to download), you will have access to it once you’ve connected the flight controller to the configurator.

You can type in commands in the text input field at the very bottom of the screen, and press the “Enter” key on your keyboard to execute it.

Typically, a command in CLI looks like this:

[command] [setting] = [value]

For example, to set expo for roll to zero:

set roll_expo = 0

Once you have changed a setting, you also have to enter the command “save” in order to save the changes, and after that the FC will reboot. If you exit CLI without doing so your changes will be lost.

To exit the CLI without changing settings, simply enter the command “exit” and press enter, or click on another tab, or click on the top right “disconnect” button.

Syntax

The syntax in Betaflight CLI is very simple and beginner friendly.

Case Sensitivity

You can type commands in the CLI in any case you want. Everything is case-insensitive so all of the below will work:

set serialrx_inverted = on SET SERIALRX_INVERTED = ON seT serialRX_inverTED = oN

Space

It doesn’t matter if you put a space either side of the “=” or if you put multiple spaces, he CLI is able to figure out what the command is, what the setting name is, and what the value is regardless of spaces. All of the following will work:

set serialrx_inverted = on set serialrx_inverted=on set serialrx_inverted =on set serialrx_inverted = on

How to check settings in CLI?

The most used commands in Betaflight CLI are probably “dump” and “diff”.

When entering “dump“, it will simply display all the settings in Betaflight on the screen. As you can probably imagine, it’s a huge list (around 800 lines) and it can take a while to go through.

That’s why we often use the command “diff” instead.

If you only want to check the settings that are different from the default, you can enter “diff“. The returned list is much shorter, and easier to manage if you only want to check the settings that are changed by the user.

See this article for more info about the “diff” command.

The command “get” is another one I use all the time. Simply type “get”, followed by a space, and a few letters of the setting you want to check/change, CLI will return all the settings that begin with those letters. It’s very useful as you don’t have to memorize all the names. For example:

get serialrx

This will return both “serialrx_inverted” and “serialrx_duplex” which I use often.

Backup and Restore of Betaflight Settings using CLI

It’s good practice to make a backup of your Betaflight CLI settings before you make changes, so you can revert back if something goes wrong.

To backup, enter “diff all”, and copy the text to a text file.

To restore, simply copy and paste the text file in the CLI, and hit enter. Don’t forget to enter “save” before closing CLI.

Tips and Tricks

Press Tab to Complete a Command

You can start typing the beginning of a CLI command and then press the TAB key to complete it. If there are multiple options, the CLI will show you all possibilities. It’s convenient especially for long commands.

Don’t forget to SAVE!

Always enter the command “save” before exiting CLI if you want to save the changes.

Task Command

The tasks command shows CPU load of different processes running on the flight controller. This is great for troubleshooting if your FC is experiencing CPU load issues.

Commands are always changing – get help!

Note that the different firmware (Cleanflight, BetaFlight, Emuflight and iNav) might have different sets of commands and command names, and it’s also likely to change form version to version.

When in doubt, you can always check the available commands using help in CLI.

Other Useful Betaflight CLI Commands

There a lot of commands but some aren’t very useful. Here are the ones that I use a lot and I think you should know about :) Let me know which commands i should add to the list.

Command Description
defaults reset controller to defaults and reboot
dump print configurable settings in a paste-able form
diff dump only the settings that are different from the defaults. Includes only the current PID profile.
diff all dump only the settings that are different from the defaults. Includes ALL PID profiles.
exit exit without saving
get get the value of the specified variable
help lists all commands
save save settings and reboot
set set the the given value to the variable. (name=value or blank or * for list)
status show system status
version show version
bl or dfu enter the DFU mode without pushing the button. Reboots the FC board in bootloader mode.
bind_rx activate bind mode on SPI receivers for FC with integrated RX for BF 4.1 and newer
bind_rx_spi same as above but for BF 4.0
frsky_bind same as above (BF 3.X)

Edit History

  • May 2018 – Guide created
  • Feb 2019 – Updated guide, added “Syntax”
  • May 2021 – Added “tips and tricks”

Leave a Comment

By using this form, you agree with the storage and handling of your data by this website. Note that all comments are held for moderation before appearing.

10 comments

Oskar 5th July 2021 - 1:46 pm

Hi,
good information to start.
Is there also a possibility to do some “IF / THAN” ?

Thx
Oskar

Reply
chris 5th June 2021 - 10:03 am

super informative, thankyou

Reply
astemer 25th July 2020 - 8:35 pm

hello.. i got a lizard95 from eachine ( dsmx reciever) but i cant bind it… it has no binding button and i couldnt bind it from CLI…

thanks in advance

Reply
Francisco 9th April 2020 - 5:30 am

Hi,
I have a tinyhawk 2, I crash and a change the Aio flight controller, I did the bind with the RTF transmitter it binded ok, but some how I push reset settings no Betaflight, now my flight controller si dead. Is there something I can do to recover my flight controller. Right now When I plug the battery I only get a led light sequence 5 blue, 4 green and 1 red then the sequece repeats one more time and then dies.

Hope you can help.

Francisco

Reply
Carl Krokstedt 28th March 2020 - 2:20 pm

Hi There,

This may be silly question but I am trying to activate serialrx_inversion = ON but I cant seem to find the correct command. I’ve done “get serialrx_inverted” to see what its set to but now I need to change and I cant lol. Any smart people out here with the correct command? Thanks in advance :)

Reply
Harry Latorre 19th March 2020 - 7:58 pm

Hi I’m building switches for my geprc KHX5 5″ quad and the “Arm” switch says in bright red “Arming Disabled”. How do I enable this arming mode to get it back to yellow or normal?

Reply
Oscar 30th April 2020 - 4:55 pm Reply
paul 26th February 2020 - 2:36 pm

download impulse Rc app it installs dfu to your board.

Reply
Walter Hivoina 23rd October 2019 - 7:55 pm

Hello . If it’s anything like Mamba F22 mini. But more important you have upgraded to latest BetaFlight. Just enter expert mode, by the little tab. connect into the Firmware flasher, you should see the option for DFU mode right around the enable full chip erase area. When your ready to return to COM channel. whichever yours may be. Just exit out . you may need to close and restart BetaFlight depending on your computer’s O.S. or condition/Age. Happy Flashing. And Please Remember to Flash Responsibly.

Reply
Alex 21st February 2019 - 12:14 pm

Hi Oscar,

do you know the Cli command to put the FC-Mamba f405 mini into DFU mode?
I tried “bl” and “DFU”, but it does not work.

Thanks in advance.

Reply