Development

Command-line interface

Document image


You can control Flipper Zero through the command-line interface (CLI) using your computer. The CLI is a text-based interface that allows you to read and emulate signals, run programs, manage files, and more on your Flipper Zero by running commands. In addition, the CLI offers a number of features, such as viewing the Flipper Zero logs, communicating with other Flipper Zero users via sub-1 GHz radio, and much more! On this page, you’ll learn how to access the Flipper Zero CLI, view available commands, view logs, and chat with other Flipper Zero owners via sub-1 GHz radio.



Accessing the Flipper Zero CLI

There are three methods to access the Flipper Zero CLI:

Method 1: Using Flipper Lab

Access the CLI via the Flipper Lab website using Google Chrome, Microsoft Edge, or other Chromium-based browsers that support the Web Serial API by doing the following:

1

Quit the qFlipper application if running.

2

Connect your Flipper Zero to your computer via a USB cable.

3

On your computer, run Google Chrome or another Chromium-based browser.

4

Go to lab.flipper.net -> CLI.

Document image


Method 2: Using the web serial terminal

Access the CLI via the web serial terminal using Google Chrome, Microsoft Edge, or other Chromium-based browsers that support the Web Serial API by doing the following:

1

Quit the qFlipper application if running.

2

Connect your Flipper Zero to your computer via a USB cable.

3

On your computer, run Google Chrome or another Chromium-based browser.

5

Set the Baud rate to 230400, then click Connect.

Document image

6

Select your Flipper Zero in the list, then click Connect.

Method 3: Using a serial terminal

Different operating systems have different procedures for accessing the Flipper Zero CLI via a serial terminal. Follow the instructions for your operating system below.

%mac%macOS
%linux%Linux
%windows%Windows

To access the Flipper Zero CLI on macOS via a serial terminal, you need to find the serial port your Flipper Zero is connected to by doing the following:

1

Connect your Flipper Zero to your computer.

2

On your computer, open Terminal and run the following command:

ls /dev/cu.*
3

Find the name of the connected Flipper Zero. It should be /dev/cu.usbmodemflip_NAME, where NAME is the unique name of your device.

Once you know the name of the connected Flipper Zero, you can access the CLI either with the screen terminal multiplexer or the minicom communication program:

Screen

1

Quit qFlipper if running.

2

Make sure that your Flipper Zero is connected to the computer.

3

In the Terminal, run the following command:

screen /dev/cu.usbmodemflip_NAME

Don’t forget to replace NAME with the name of your device you found previously.

To quit the screen, press control+A, then K, then Y.

Minicom

If you don’t have the minicom program on your computer, you can install it via Homebrew:

1

Install Homebrew if you haven’t already by running in the Terminal the following command:

/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
2

After installation, run the following command to install minicom:

brew install minicom

Once the minicom program is installed on your computer, you can finally access the CLI by doing the following:

1

Quit qFlipper if running.

2

Make sure that your Flipper Zero is connected to the computer.

3

In the Terminal, run the following command:

minicom -D /dev/cu.usbmodemflip_NAME

Don’t forget to replace NAME with the name of your device you found previously.

To quit minicom, press esc+Z, then X, then Return.



Available commands

To view the list of available commands in the CLI, run the ? or help command.

The Flipper Zero command-line interface
The Flipper Zero command-line interface


You can interact with the Flipper Zero CLI through the following commands:

Command

Description

!

Alias for the info device command.

?

Alias for the help command.

bt

Radio core (BLE) test app: intended for factory tests. It can be used to check the BLE HCI version. Learn more.

crypto

Crypto tool: used for enclave key provisioning and data encryption/decryption. Learn more.

date

Displays/sets the current date and time.

device_info

Alias for the info device command (obsolete).

factory_reset

Resets your device to the factory settings. Data on the microSD card will be saved.

free

Displays heap memory allocator information. It can be used for general application memory use profiling.

free_blocks

Displays heap memory allocator free blocks and their respective size. It can be used to estimate heap fragmentation.

gpio

Allows to directly control GPIO pins: set mode, read/write state. Learn more.

help

Displays the list of available commands.

i2c

I2C bus scan tool: can be used to search for a device on the bus.

ikey

Reads, emulates, and writes iButton keys. Learn more.

info

Displays detailed information about the device and power system. Learn more.

input

Input subsystem command line tool: displays input and allows to inject input events into. Learn more.

ir

Reads and sends infrared signals. Learn more.

js

Runs a JavaScript file and sends console output to the CLI. Learn more.

led

Notification service test app: allows to directly control LEDs and LCD backlight. Learn more.

loader

Application / Script loader: can enumerate compiled-in apps, can open internal or external (fap) app. Learn more.

log

System log viewer: allows to see device or app logs. Learn more.

nfc

NFC factory test app: controls field when the device is in Debug mode.

onewire

1-Wire bus scan app. It works on the same pins as iButton, but only scans for 1-Wire devices. Learn more.

power

Turns off and reboots the device, as well as enables the power supply to GPIO pins. Learn more.

rfid

Reads and emulates data from low-frequency RFID cards. Learn more.

start_rpc_session

Activates the remote procedure call (RPC) session. Switches the CLI into protobuf mode. Normally, you don’t need to do that.

storage

Provides commands for interaction with the file system of the device. Learn more.

subghz

Sub-GHz test app: mostly used for factory testing, but also contains various supplementary tools. Learn more.

sysctl

System Control: configures various system settings. Learn more.

top

Lists running threads and information about them in real time. Similar to the top command on Linux. Press Ctrl+C to quit.

update

Firmware updater command-line tool: updates and backs up the device, and restores the internal storage. Learn more.

uptime

Displays the time since the last reboot of the device.

vibro

Activates and deactivates the vibration motor. Learn more.



Reading Flipper Zero logs via the CLI

You can read Flipper Zero logs via the CLI by doing the following:

1

Connect your Flipper Zero to your computer via a USB-C cable.

3

Set the log level you need (the log info level is set by default) and start logging.

To do that, run one of the following commands:

  • log: logs non-critical information, including warn logs.
  • log error: logs only critical errors and other important messages.
  • log warn: logs non-critical errors and warnings, including error logs.
  • log info: logs non-critical information, including warn logs.
  • log default: the default system log level (equivalent to info logs).
  • log debug: logs debug information, including info logs (will impact system performance).
  • log trace: logs system traces, including debug logs (will impact system performance).

You can access this list in the CLI by running the log ? command.

4

Interact with your Flipper Zero to view the logs.

NFC logs in the Flipper Zero CLI
NFC logs in the Flipper Zero CLI


To stop the logging process, press Ctrl+C.



Chatting with other Flipper Zero users

In the CLI, you can chat with other Flipper Zero users via the sub-1 GHz radio. To do that, all devices have to communicate at the same frequency.

To chat, all participants have to do the following:

1

Connect your Flipper Zero to your computer via a USB-C cable.

3

Run the command that specifies the frequency and antenna type:

subghz chat <frequency in Hz> <device:0/1>

Where:

  • <frequency in Hz> must be in the 299999755-348000000, 386999938-464000000, 778999847-928000000 Hz range. Some frequencies might be unavailable in your region. Learn more.
  • <device:0/1> must specify if the internal antenna (0) or external antenna (1) is used for communication if connected.

For example:

subghz chat 868150000 0
4

Enter your message and press Return.

Chat with other Flipper Zero users via the CLI
Chat with other Flipper Zero users via the CLI


To quit the chat, press Ctrl+C.



Learning more about the CLI commands

bt



<cmd>

Comment

bt

hci_info

Displays Bluetooth Host Controller Interface (HCI) information.



crypto

This command allows you to encrypt and decrypt plain text with the help of the cryptographic keys in the secure enclave and initialization vector.



<cmd>

<arg>

Comment

crypto

encrypt

<key_slot:int> <iv:hex>

Encrypts plain text with AES256CBC and encodes to hex using a key from the secure enclave and initialization vector.

crypto

decrypt

<key_slot:int><iv:hex>

Decrypts encoded with AES256CBC data hex text into plain text using the key from the secure enclave and initialization vector.

crypto

has_key

<key_slot:int>

Checks if the secure enclave has a key in the specific slot. Slots range from 1 to 100.

crypto

store_key

<key_slot:int> <key_type:str> <key_size:int> <key_data:hex>

NON-REVERSIBLE OPERATION! Adds a key to the secure enclave. The added key can’t be removed.

Where:

  • <key_slot:int>: secure enclave slot number that contains a cryptographic key. By default, slots 1 through 11 have cryptographic keys used for encryption
  • <iv:hex>: a 16-byte initialization vector in hexadecimal generated by the user
  • <key_type:str>: master, simple, or encrypted
  • <key_size:int>: 128 or 256 bites
  • <key_data:hex>: the key data in hexadecimal


gpio



<cmd>

<arg>

Comment

gpio

mode

<pin_name> <0/1>

Sets the entered GPIO pin to input (0) or output (1) mode.

gpio

set

<pin_name> <0/1>

Sets the GPIO pin’s value.

gpio

read

<pin_name>

Reads the GPIO pin’s value.

Where:

  • <pin_name> : PA7, PA6, PA4, PB3, PB2, PC3, PC1, PC0


ikey



<cmd>

<args>

Comment

ikey

read



Reads iButton keys.

ikey

emulate

<key_type> <key_data>

Emulates the entered data.

ikey

write Dallas

<key_data>

Writes 8-byte hex-formatted data to Dallas iButton keys.

Where <key_type> and <key_data>:

  • Dallas, 8 bytes long
  • Cyfral, 2 bytes long
  • Metakom, 4 bytes long


info



<args>

Commands

info

device

Displays information about the device.

info

power

Displays information about the power system.

info

power_debug

Displays detailed information about the power system.



input



<cmd>

<args>

Comments

input

dump



Displays the pressed buttons.

input

send

<key> <type>

Emulates a press of a button.

Where:

  • <key>: up, down, left, right, back, ok
  • <type>: press, release, short, long

To emulate a short press of a button, run the following commands in order:

  1. input send <key> press
  2. input send <key> short
  3. input send <key> release

To emulate a long press of a button, run the following commands in order:

  1. input send <key> press
  2. input send <key> long
  3. input send <key> release

Otherwise, the input will be discarded.



ir



<cmd>

<args>

Comment

ir

rx



Reads and decodes data from IR (infrared) remote controls.

ir

rx raw



Reads data from IR remote controls in RAW format.

ir

tx

<protocol> <address> <command>

Sends the entered IR command.

ir

tx raw

F:<frequency> DC:<duty_cycle> <samples>

Sends RAW IR data. Up to 512 samples of data.

ir

decode

<input_file> <output_file>

Decodes the file with RAW data.

ir

universal list

<remote_name>

Displays the list of commands of the entered remote.

ir

universal

<remote_name> <signal_name>

Sends the command from the entered remote.

Where:

  • <protocol>: NEC, NECext, NEC42, NEC42ext, Samsung32, RC6, RC5, RC5X, SIRC, SIRC15, SIRC20, Kaseikyo, RCA
  • <address> and <command> must be in hex format
  • <frequency>: 10000-56000
  • <duty_cycle>: 0-100
  • <remote_name>: tv, audio, ac, projector


js



<args>

Comment

js

<path>

Runs the selected JavaScript file and sends console output to the CLI.



led



<args>

Comment

led

<r/g/b> <0-255>

Sets the LED’s color. Each color value must be entered separately.

led

<bl> <0-255>

Enables the display’s backlight to be always on.

Where <0-255> is the light value.



loader



<cmd>

<args>

Comment

loader

list



Lists available applications.

loader

open

<Application Name:string>

Runs the entered application.

loader

info



Displays the loader’s state.

loader

close



Closes the running application.

loader

signal

<signal:number> <arg:hex>

Sends a signal with an optional argument. 



log



<level>

Comment

log



Starts logging with the current log level.

log

error

Logs only critical errors and other important messages.

log

warn

Logs non-critical errors and warnings, including error logs.

log

info

Logs non-critical information, including warn logs.

log

default

The default system log level (equivalent to info logs).

log

debug

Logs debug information, including info logs (will impact system performance).

log

trace

Logs system traces, including debug logs (will impact system performance).



nfc

By default, there are no commands available. To enable the nfc command, you need to enable Debug mode on your Flipper Zero by running the sysctl debug 1 command in the CLI.



<cmd>

Comment

nfc

field

Enables the high-frequency NFC field.



onewire



<cmd>

Comment

onewire

search

Searches for 1-Wire devices.



power



<cmd>

<arg>

Comment

power

off



Powers off the device.

power

reboot



Reboots the device.

power

reboot2dfu



Reboots the device to DFU mode.

power

5v

<1/0>

Enables (1) or disables (0) 5 V power supply to GPIO pin 1.

power

3v3

<1/0>

Enables (1) or disables (0) 3.3 V power supply to GPIO pin 9. Available in Debug mode.



rfid



<cmd>

<arg>

Comment

rfid

read



Reads RFID card’s data in ASK and PSK modes.

rfid

write

<key_type><key_data>

Writes the entered data.

rfid

emulate

<key_type><key_data>

Emulates the entered data.

rfid

raw_read

<ask/psk><filename>

Reads and saves card’s data in RAW format in a file.

rfid

raw_emulate

<filename>

Emulates the saved RAW data from a file. Useful for debugging protocols.

rfid

raw_analyze

<filename>

Outputs RAW data from a file to the CLI and tries to decode it. Useful for protocol development.

Where <key_type> and <key_data>:

  • EM4100, 5 bytes long
  • EM4100/32, 5 bytes long
  • EM4100/16, 5 bytes long
  • Electra, 8 bytes long
  • H10301, 3 bytes long
  • Idteck, 8 bytes long
  • Indala26, 4 bytes long
  • IoProxXSF, 4 bytes long
  • AWID, 9 bytes long
  • FDX-A, 5 bytes long
  • FDX-B, 11 bytes long
  • HIDProx, 6 bytes long
  • HIDExt, 12 bytes long
  • Pyramid, 4 bytes long
  • Viking, 4 bytes long
  • Jablotron, 5 bytes long
  • Paradox, 6 bytes long
  • PAC/Stanley, 4 bytes long
  • Keri, 4 bytes long
  • Gallagher, 8 bytes long
  • Nexwatch, 8 bytes long
  • Radio Key, 6 bytes long


storage

The path must start with /int or /ext.



<cmd>

<path>

<args>

Comment

storage

info

</ext>



Gets general info about the file system.

storage

format

</ext>



Formats the file system on the microSD card.

storage

list

</ext/path/to/dir>



Lists files and directories.

storage

tree

</ext/path/to/dir>



Lists all files and directories.

storage

remove

</ext/path/to/dir>



Deletes the file or directory. The directory must be empty.

storage

read

</ext/path/to/file>



Reads text from the file and prints the file size and content to the CLI.

storage

read_chunks

</ext/path/to/file>

<1-512>

Reads data from file in blocks and prints the file size and content to the CLI, <args> should contain how many bytes you want to read in one block.

storage

write

</ext/path/to/file>

<text>

Reads text from the CLI and adds it to a file. Stops by pressing Ctrl+C.

storage

write_chunk

</ext/path/to/file>

<1-512>

Reads data from the CLI and adds it to the file, <args> should contain how many bytes you want to write.

storage

copy

</ext/path/to/file>

</ext/path/to/file>

Copies the file to a new file, <args> must contain a new path.

storage

rename

</ext/path/to/file>

</ext/path/to/file>

Renames a file or directory, <args> must contain a new path.

storage

mkdir

</ext/path/to/directory>



Creates a new directory.

storage

md5

</ext/path/to/file>



Displays the MD5 hash of the file.

storage

stat

</ext/path/to/file>



Displays info about the file or directory.

storage

timestamp

</ext/path/to/file>



Displays the last modification timestamp.

storage

extract

</ext/path/to/archive>

</ext/path/to/directory>

Extracts a .tar archive file to a directory.



subghz



<cmd>

<arg>

Comment

subghz

chat

<frequency:in Hz> <device: 0/1>

Enables chatting with other Flipper Zero users.

subghz

tx

<3-byte Key: in hex> <frequency: in Hz> <te: us> <repeat: count> <device: 0/1>

Transmits a key.

subghz

rx

<frequency:in Hz> <device: 0/1>

Enables receiving of a signal.

subghz

rx_raw

<frequency:in Hz>

Enables receiving of a signal in RAW format.

subghz

decode_raw

<file_name: path_RAW_file>

Decodes a file with RAW data and displays the results.

subghz

tx_from_file

<file_name: path_file> <repeat: count> <device: 0/1>

Transmits data from a file.

The following commands can only be used in Debug mode:



<cmd>

<arg>

Comment

subghz

tx_carrier

<frequency:in Hz>

Transmits carrier frequency.

subghz

rx_carrier

<frequency:in Hz>

Receives carrier frequency.

subghz

encrypt_keeloq

<path_decrypted_file> <path_encrypted_file> <IV:16 bytes in hex>

Encrypts Keeloq manufacture keys.

subghz

encrypt_raw

<path_decrypted_file> <path_encrypted_file> <IV:16 bytes in hex>

Encrypts RAW data.

Where:

  • <frequency:in Hz>: is one of the values in the 299999755-348000000, 386999938-464000000, 778999847-928000000 Hz range. Some frequencies might be unavailable in your region. Learn more.
  • <device: 0/1>: 0 is the built-in sub-1 GHz antenna with the CC1101 transceiver, 1 is the external sub-1 GHz antenna with the CC1101 transceiver.
  • <te: us>: quantization interval in milliseconds.
  • <IV:16 bytes inhex>: a 16-byte initialization vector in hexadecimal generated by the user.
    


sysctl



<cmd>

<arg>

Comment

sysctl

debug

<0/1>

Enables (1) or disables (0) system debug.

sysctl

heap_track

<none/main>

Enables (main) or disables (none) heap allocation tracking mode.



update



<cmd>

<arg>

Comment

update

install

</ext/path/to/update.fuf>

Verifies and installs an update package.

update

backup

</ext/path/to/backup.tar>

Creates an internal storage backup.

update

restore

 </ext/path/to/backup.tar>

Restores from an internal storage backup.



vibro



<arg>

Comment

vibro

<1/0>

Activates (1) or deactivates (0) the vibration motor.