# How to run legato terminal commands via a .c file?

**URL:** <https://forum.legato.io/t/how-to-run-legato-terminal-commands-via-a-c-file/2846>\
**Category:** Legato Linux distribution (Yocto project)\
**Created:** [December 8, 2017, 6:21am UTC](https://forum.legato.io/t/how-to-run-legato-terminal-commands-via-a-c-file/2846 "2017-12-08T06:21:37Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![codegit001](https://avatars.discourse-cdn.com/v4/letter/c/7c8e57/32.png) [@codegit001](https://forum.legato.io/u/codegit001)\
**Post date:** [December 8, 2017, 6:21am UTC](https://forum.legato.io/t/how-to-run-legato-terminal-commands-via-a-c-file/2846/1 "2017-12-08T06:21:37Z")

</div>

Using system() doesnot seem to work.

Eg:  
system(“gnss get posInfo”) fails with message:  
gnss: not found

---

<div class="post-metadata">

**Author:** ![lotam](https://avatars.discourse-cdn.com/v4/letter/l/958977/32.png) [@lotam](https://forum.legato.io/u/lotam)\
**Post date:** [December 8, 2017, 4:16pm UTC](https://forum.legato.io/t/how-to-run-legato-terminal-commands-via-a-c-file/2846/2 "2017-12-08T16:16:31Z")

</div>

I would suggest to use the API directly.

But to use system(), try run with full path, i.e.

> system(“/legato/systems/current/bin/gnss get posInfo”)

And reminded to gain access if your app is running inside sandbox.
