This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English version of the page.

Note: This page has been translated by MathWorks. Click here to see
To view all translated materials including this page, select Country from the country navigator on the bottom of this page.

system

Run command in Linux shell on NVIDIA hardware

Syntax

system(hwObj,command)
system(hwObj,command,sudo)

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.

Use the jetson or the drive function to create this connection.

Linux command, specified as string.

Example: 'ls -al'

sudo command, specified as string.

Example: 'sudo'

Data Types: char

Introduced in R2018b