Script Commands for Linux Devices

Use the options and examples below to help you create your own powerful script commands.

All Linux supported scripts can be run on Linux devices. You can also use the options and examples below to help you create your own powerful script commands.

Note: Use the commands and scripts as supported for the Linux distribution on the device. For details, read Sending Scripts to Devices.

Legend

Format Meaning
text Enter the command exactly as shown.
text Replace with the requested information.
[text] Square brackets indicate optional information for the command.
text|text Choose one of the options separated by the vertical pipe.

Commands

Command Syntax
cd

Changes the current directory.

cd [directory]

Example To change to the Chocolate directory:

cd Chocolate
copy or cp

Copies one or more files to another location.

copy source destination

Example To copy all files with the extension .txt from the /etc/passwd directory to the /etc/group directory on the device:

cp /etc/passwd/*.txt /etc/group
connect

Prompts the SOTI MobiControl Device Agent to try to connect to the deployment server.

./mobicontrol -connect
del

Deletes a file or folder.

del filename

Example To delete a file named skittles.jpg:

del sittles.jpg

Example To delete all files with the extension .jpg in the current directory:

del *.tmp

Example To delete a file named skittles.jpg, forcefully:

del -f skittles.jpg

Example To delete a folder named Wrigley:

del Wrigley/
disconnect

Prompts the SOTI MobiControl Device Agent to disconnect from the deployment server.

Note: You can only apply this when you enable the Manual connection setting.
./mobicontrol -disconnect
halt

Shuts down the device.

sudo halt
man

Displays the manual for a command.

man command

Example To learn more about the chmod command:

man chmod
mkdir or md

Creates a new directory.

mkdir [drive:] path

Example To create a directory named "test" from the current directory:

mkdir test

Example To create test/test1/test2/test3 recursively:

mkdir -p /test1/test2/test3
or
md /test/test1/test2/test3
move

Moves a file from specified source location to specified destination location.

Note: You can rename the file at the same time by specifying a name for the destination filename.
move [sourceFilePath] filename destinationFilePath [filename]

Example To move the file test.txt:

move test.txt /home/sample

Example To move and rename a file at the same time:

move /home/test.txt /newfolder/test1.cmd

Example To move a folder to the root folder:

move /home/Mars /
reboot

Reboots the device.

sudo reboot
reset

Performs a soft or hard reset of the device.

reset [/S] [/delay sec]

Where:

  • /S is the default option and soft resets the device. This option also terminates any desktop remote control sessions.
  • /delay specifies that the reset should delay by the value in seconds. If /delay parameter is not defined, the default value is 5 seconds.

Example To soft reset a device after a 30 second delay:

reset /S /delay 30
rm

Deletes a file or folder.

rm filename

Example To delete a file named skittles.jpg:

rm skittles.jpg

Example To delete all files with the extension .jpg in the current directory:

rm *.tmp

Example To delete a file named skittles.jpg, forcefully:

rm -f skittles.jpg

Example To delete a folder named Wrigley:

rm Wrigley/
rmdir or rd

Deletes a directory.

rmdir [/S] path

Where /S removes any subdirectories

This command requires the /S option on Android Plus and Linux devices and deletes the specified item, whether a directory or a file.

Example To remove an empty directory named "test" from the current directory:

rmdir test
Example To remove a directory named "test" and all of its contents from the current directory:
rmdir /S test

Example To remove a location:

rmdir /sdcard/Download/test
setdate

Sets the date and time.

setdate date [time]

Where date is in the following format: mm-dd-yyy and time is in the following format: HH:MM:SS

Example To set the date and time of the device

setdate 08–20–2016 13:32:00
shell

Launches the Linux shell.

shell
turnoff

Reboots the device. You can specify a delay (in milliseconds) before the device reboots.

turnoff [time]

Example To turn off the device in 3.5 seconds:

turnoff 3500
writeprivateprofstring

Saves or deletes specified settings on a device.

See The writeprivateprofstring and writesecuresetting Commands for more information.