Main Content

system

Run command in Linux shell on BeagleBone Black hardware

Add-On Required: This feature requires the MATLAB Support Package for BeagleBone Black Hardware add-on.

Description

system(bbb,command) runs a command in the Linux® command shell on BeagleBone® Black hardware. This function does not allow you to run interactive commands.

example

system(bbb,command,sudo) runs a command with superuser privileges.

example

Examples

collapse all

You can run a command that lists the contents of a folder.

system(bbb,'ls -al')
ans =

total 100
drwxr-xr-x 10 bbb   bbb    4096 Nov 22 14:18 .
drwxr-xr-x  3 root root  4096 Sep 25 16:22 ..
-rw-------  1 bbb   bbb   21712 Nov 13 17:40 .bash_history
-rw-r--r--  1 bbb   bbb     220 Sep 25 16:22 .bash_logout
-rw-r--r--  1 bbb   bbb    3243 Sep 25 16:22 .bashrc
drwxr-xr-x  4 bbb   bbb    4096 Oct  1 18:17 .cache
drwxr-xr-x  6 bbb   bbb    4096 Oct  2 12:01 .config
drwx------  3 bbb   bbb    4096 Oct  1 18:17 .dbus
drwxr-xr-x  2 bbb   bbb    4096 Nov 13 17:30 Desktop
-rw-r--r--  1 bbb   bbb      35 Nov 13 17:41 .dmrc
drwx------  2 bbb   bbb    4096 Oct  1 18:17 .gvfs
drwxr-xr-x  3 bbb   bbb    4096 Oct  2 14:46 MATLAB® 
-rw-r--r--  1 bbb   bbb    5781 Feb  3  2013 ocr_bbb.png
-rw-r--r--  1 bbb   bbb     675 Sep 25 16:22 .profile
drwxrwxr-x  2 bbb   bbb    4096 Mar 10  2013 python_games
drwxr-xr-x  8 bbb   bbb    4096 Oct  2 12:41 wiringPi
-rw-------  1 bbb   bbb      66 Nov 13 17:41 .Xauthority
-rw-------  1 bbb   bbb     261 Nov 13 17:41 .xsession-errors
-rw-------  1 bbb   bbb     449 Nov 13 17:40 .xsession-errors.old

You can run a command with superuser privileges.

system(bbb,'cp /etc/network/interfaces int.copy','sudo')

Input Arguments

collapse all

BeagleBone Black connection created using beaglebone, specified as an object.

Linux command, specified as character vector.

Example: 'ls -al'

sudo command, specified as character vector.

Example: 'sudo'

Data Types: char

Version History

Introduced in R2015a