Main Content

system

Run commands in a Linux shell on the NVIDIA hardware

Add-On Required: This feature requires the MATLAB Coder Support Package for NVIDIA Jetson and NVIDIA DRIVE Platforms add-on.

Description

example

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

example

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

Examples

collapse all

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

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

    'total 168
     drwxr-xr-x 19 ubuntu ubuntu  4096 Aug  9 16:02 .
     drwxr-xr-x  5 root   root    4096 Feb  3  2018 ..
     -rw-------  1 ubuntu ubuntu   263 Aug 13 22:33 .bash_history
     -rw-r--r--  1 ubuntu ubuntu   220 May  3  2016 .bash_logout
     -rw-r--r--  1 ubuntu ubuntu  3771 May  3  2016 .bashrc
     drwx------ 12 ubuntu ubuntu  4096 Aug  9 14:14 .cache
     drwx------ 14 ubuntu ubuntu  4096 Aug  9 14:14 .config
     drwxr-xr-x  2 ubuntu ubuntu  4096 Aug  9 14:13 Desktop
     -rw-r--r--  1 ubuntu ubuntu    25 Aug  9 14:13 .dmrc
     drwxr-xr-x  2 ubuntu ubuntu  4096 May  6  2016 Documents
     drwxr-xr-x  2 ubuntu ubuntu  4096 May  6  2016 Downloads
     drwx------  2 ubuntu ubuntu  4096 Aug  9 14:14 .gconf
     drwx------  3 ubuntu ubuntu  4096 Aug  9 14:13 .gnupg
     drwxrwxr-x  3 ubuntu ubuntu  4096 Aug  9 14:25 gpucoderTX2
     -rw-------  1 ubuntu ubuntu   346 Aug  9 14:13 .ICEauthority
     -rwxr-xr-x  1 ubuntu ubuntu 10238 Feb  3  2018 jetson_clocks.sh
     drwx------  3 ubuntu ubuntu  4096 May  6  2016 .local
     drwxr-xr-x  3 root   root    4096 Aug  9 14:06 MATLAB
     drwxr-xr-x  2 ubuntu ubuntu  4096 May  6  2016 Music
     drwx------  3 ubuntu ubuntu  4096 Aug  9 14:13 .nv
     drwxr-xr-x  2 ubuntu ubuntu  4096 May  6  2016 Pictures
     -rw-r--r--  1 ubuntu ubuntu   675 May  3  2016 .profile
     drwxr-xr-x  2 ubuntu ubuntu  4096 May  6  2016 Public
     drwxrwxr-x  3 ubuntu ubuntu  4096 Aug  9 16:31 remoteBuildDir
     -rw-r--r--  1 ubuntu ubuntu     0 May  6  2016 .sudo_as_admin_successful
     -rwxr-xr-x  1 ubuntu ubuntu 39049 Feb  3  2018 tegrastats
     drwxr-xr-x  2 ubuntu ubuntu  4096 May  6  2016 Templates
     drwxr-xr-x  2 ubuntu ubuntu  4096 May  6  2016 Videos
     -rw-r--r--  1 ubuntu ubuntu  2850 Feb  3  2018 weston.ini
     -rw-------  1 ubuntu ubuntu    57 Aug  9 14:13 .Xauthority
     -rw-------  1 ubuntu ubuntu   186 Aug  9 14:13 .xsession-errors
     -rw-------  1 ubuntu ubuntu  1178 May  6  2016 .xsession-errors.old
     '

You can run a command with superuser privileges.

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

Input Arguments

collapse all

Connection to a specific NVIDIA hardware board, specified as a jetson or drive object.

Linux command, specified as character vector.

Example: 'ls -al'

If the optional input, 'sudo', is specified as the third argument, the command is executed as super user.

Example: 'sudo'

Version History

Introduced in R2018b