# Send cm commands from code

**URL:** https://mangoh.discourse.group/t/send-cm-commands-from-code/9883
**Category:** Uncategorized
**Created:** [March 19, 2022, 6:30pm UTC](https://mangoh.discourse.group/t/send-cm-commands-from-code/9883 "2022-03-19T18:30:32Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![gianmariaiaculo](https://avatars.discourse-cdn.com/v4/letter/g/e19adc/32.png) [@gianmariaiaculo](https://mangoh.discourse.group/u/gianmariaiaculo)
#### Post date: [March 19, 2022, 6:30pm UTC](https://mangoh.discourse.group/t/send-cm-commands-from-code/9883/1 "2022-03-19T18:30:32Z")

</div>

Hello There,  
is it possible to send cm commands using code as we do on normal terminal ?  
Im interested in manipulate radio state (cm radio on/off) , power and apns.  
My app is not sandboxed naturally.  
Thanks in advance.

Gianmaria

---

<div class="post-metadata">

### Author: ![jyijyi](https://sea2.discourse-cdn.com/flex016/user_avatar/mangoh.discourse.group/jyijyi/32/997_2.png) [@jyijyi](https://mangoh.discourse.group/u/jyijyi)
#### Post date: [March 20, 2022, 4:03am UTC](https://mangoh.discourse.group/t/send-cm-commands-from-code/9883/2 "2022-03-20T04:03:13Z")

</div>

You can try system() with cm command, and then save the output to a text file.  
Be careful that you need to use full path when calling from system() API:

> **[Using legato cli from bash script](https://forum.sierrawireless.com/t/using-legato-cli-from-bash-script/16099)**
>
> hi! i am trying to use cm command from bash script and gets errors line 24: cm: not found how can i call cm commands from the bash? thanks

Or you can port the cm code to your app

> <https://github.com/legatoproject/legato-af/blob/master/apps/tools/cm/cm_mrc.c>
