Main Content

Run Linux Commands on BeagleBone Black Hardware

Use the system function to run Linux® commands on the BeagleBone® Black hardware. Pass commands, such as 'ls -al', as the second argument. The function returns standard output from the Linux command line.

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

total 36
drwx------  4 root   root  4096 Apr 23 23:12 .
drwxr-xr-x 22 root   root  4096 Apr 23 20:20 ..
-rw-------  1 root   root    99 Apr 23 23:34 .bash_history
-rw-r--r--  1 root   root   570 Jan 31  2010 .bashrc
drwxr-xr-x  2 root   root  4096 Apr 23 22:54 .c9
drwxr-xr-x  3 root   root  4096 Apr 23 21:02 .gem
-rw-------  1 debian admin  119 Apr 23 20:58 .npmrc
-rw-r--r--  1 root   root   140 Nov 19  2007 .profile
-rw-------  1 root   root  1911 Apr 23 20:43 .viminfo

Use the openShell function to open an SSH PuTTY terminal that is connected to the Linux command-line interface on the BeagleBone Black hardware. Log in as the root user. By default, the root user login does not require a password.

bbb = beaglebone()
openShell(bbb)

It is a good security practice to set the root user password. Use the PuTTY terminal to run the passwd command.

passwd

Follow the prompts and change your password.

After changing the password, clear the bbb object and any objects that you created using bbb. Then, use beaglebone to create a new connection based on the new password.

clear bbb
bbb = beaglebone('172.28.201.137', 'bbb','newpassword')

For more information, see Linux.