How to use the command mmcli (with examples)

How to use the command mmcli (with examples)

The mmcli command is used to control and monitor the ModemManager on a Linux system. ModemManager is a service that abstracts modem hardware, making it easier to control and monitor modems through a high-level API. The mmcli command provides a command-line interface to interact with ModemManager.

Use case 1: List available modems

Code:

mmcli --list-modems

Motivation: The mmcli –list-modems command is used to list all the modems available on the system. This is useful when you need to check if a modem is connected and available for use.

Explanation:

  • mmcli is the command to interact with ModemManager.
  • --list-modems is the argument that instructs mmcli to list all the modems available on the system.

Example output:

Found 1 modems:
    /org/freedesktop/ModemManager1/Modem/0 [Sierra Wireless Inc.] MBIM [1199:68c0]

Use case 2: Print information about a modem

Code:

mmcli --modem=modem

Motivation: The mmcli –modem=modem command is used to print detailed information about a specific modem. This can be useful to get information about the modem’s capabilities, signal strength, and other parameters.

Explanation:

  • mmcli is the command to interact with ModemManager.
  • --modem=modem is the argument that specifies the modem for which information should be printed. Replace modem with the modem ID obtained from the --list-modems command.

Example output:

  -------------------------
  General  |       dbus path: /org/freedesktop/ModemManager1/Modem/0
           |       device id: 4G System PnP Device
  -------------------------
  Hardware |      manufacturer: Sierra Wireless Inc.
           |             model: MBIM [1199:68c0]
           | firmware revision: SWI9X50C_01.14.02.00 <uuid>
...

Use case 3: Enable a modem

Code:

mmcli --modem=modem --enable

Motivation: The mmcli –modem=modem –enable command is used to enable a specific modem. This can be useful when a modem is disabled and needs to be enabled before it can be used.

Explanation:

  • mmcli is the command to interact with ModemManager.
  • --modem=modem is the argument that specifies the modem to be enabled. Replace modem with the modem ID obtained from the --list-modems command.
  • --enable is the argument that instructs mmcli to enable the specified modem.

Use case 4: List SMS messages available on the modem

Code:

sudo mmcli --modem=modem --messaging-list-sms

Motivation: The sudo mmcli –modem=modem –messaging-list-sms command is used to list all the SMS messages available on a specific modem. This can be useful when you need to check the messages stored on the modem.

Explanation:

  • sudo is used to run the mmcli command with root privileges, as accessing SMS messages may require elevated permissions.
  • mmcli is the command to interact with ModemManager.
  • --modem=modem is the argument that specifies the modem for which SMS messages should be listed. Replace modem with the modem ID obtained from the --list-modems command.
  • --messaging-list-sms is the argument that instructs mmcli to list the SMS messages.

Example output:

--------------------------------------
  |       index: 16
  |      storage: sim
  |   folder id: 0
  |     message: Your package has been delivered.
  |   alphabetical
  |      length: 50
  |     encoding: GSM 7-bit default alphabet (0x00)

Use case 5: Delete a message from the modem, specifying its path

Code:

sudo mmcli --modem=modem --messaging-delete-sms=path/to/message_file

Motivation: The sudo mmcli –modem=modem –messaging-delete-sms=path/to/message_file command is used to delete a specific SMS message from the modem. This can be useful to remove unnecessary messages or free up storage space on the modem.

Explanation:

  • sudo is used to run the mmcli command with root privileges, as deleting SMS messages may require elevated permissions.
  • mmcli is the command to interact with ModemManager.
  • --modem=modem is the argument that specifies the modem from which the SMS message should be deleted. Replace modem with the modem ID obtained from the --list-modems command.
  • --messaging-delete-sms=path/to/message_file is the argument that instructs mmcli to delete the SMS message located at the specified path.

Conclusion:

The mmcli command provides a convenient way to control and monitor modems through ModemManager. It allows users to list available modems, print detailed information about a modem, enable/disable modems, list SMS messages, and delete specific messages. By using the examples provided, users can effectively manage their modems and interact with SMS messages on their Linux systems.

Related Posts

How to use the command ngs (with examples)

How to use the command ngs (with examples)

The command ngs is a scripting language created specifically for Ops.

Read More
How to use the command "cat" (with examples)

How to use the command "cat" (with examples)

The “cat” command in Unix is used to print and concatenate files.

Read More
The Power of zstdless (with examples)

The Power of zstdless (with examples)

Introduction In this article, we will explore the various use cases of the zstdless command, which is used to open and interactively read zstd compressed files.

Read More