Using LINUX commands in App Inventor. Extension

27.- mkdir

Create directory.

mkdir /mnt/sdcard/my_new_directory
mkdir -p /mnt/sdcard/directory/subdirectory/subsubdirectory

1 Like

28.- mount

mount, shows where the devices are mounted.

To mount devices you need to be root #

29.- mv

mv, move a file or directory, also used to rename a file or directory.

mv /mnt/sdcard/numeros.txt /mnt/sdcard/new_numeros.txt

1 Like

30.- netstat

netstat, list out all the network (socket) connections.


curl opens up possibilities in REST API calls.


31.- ping

ping, to check the network connectivity between host and server/host.

ping -c 3 (sends 3 packets)
ping -c 3

32.- printf

printf prints a formatted string to the standard output.

printf “My name is “%s”.\nIt’s a pleasure to meet you.” “John”
printf “%d plus %5f %s %.*f.” 5 5.05 “equals” 3 10.05
printf ‘hello\nworld\n!’
Examples from:

33.- ps ::: pm

ps, list process.

ps --help
ps -A


pm, package manager

pm list packages
pm list packages -f
pm list packages -s
pm list features
pm list packages --show-versioncode

34.- rm ::: rmdir

rm, remove file.
rm -r, recursive, remove directory contents.
rmdir, remove directory.

35.- sed

sed, stream editor.

This is a very simple example, change the word five to FEVER in the file /mnt/sdcard/numeros.txt

sed ‘s/five/FEVER/’ /mnt/sdcard/los_numeros.txt


sed --help

1 Like

36.- service

service command starts, stops, list services.

service list
service --help

37.- sleep ::: sort

sleep 4

sort, sorts lines of text files. It supports sorting alphabetically, in reverse order, by number, by month and can also remove duplicates.

sort /mnt/sdcard/numeros.txt
sort /mnt/sdcard/numeros.txt > /mnt/scdard/sort_numeros.txt
sort -r /mnt/sdcard/numeros.txt (reverse)
sort -u /mnt/sdcard/numeros.txt (no duplicates)
sort -k 2 -t , /mnt/sdcard/numeros.txt

38.- split

split a file.

We have a file image.png with size 5K

split -b 1K /mnt/sdcard/image.png /mnt/sdcard/image_

image_aa (1K)
image_ab (1K)
image_ac (1K)
image_ad (1K)
image_ae (1K)

39.- stat

stat, displaying detailed information relating to a file.

stat /mnt/sdcard/imagen.jpg

40.- tar

tar, packages files, it can compress and decompress it.

tar -cf /mnt/sdcard/my_files.tar /mnt/sdcard
tar -czf /mnt/sdcard/archivos.tar.gz /mnt/sdcard (compress)
tar -cjf /mnt/sdcard/archivos.tar.bz2 /mnt/sdcard (compress)

tar -xf /mnt/sdcard/archivos.tar -C /mnt/sdcard/bk_dir/
tar -xzf /mnt/sdcard/archivos.tar.gz -C /mnt/sdcard/bk_dir/

1 Like

41.- tee ::: touch

tee, reads the standard input and writes it to both the standard output and one or more files.
ls -ali /mnt/sdcard/ | tee /mnt/sdcard/my_list.txt | cat

touch, change file timestamps or create empty file.

touch /mnt/sdcard/zero.txt
touch -am 2019-12-12T12:12:12 /mnt/sdcard/my_file.txt (user root)
stat /mnt/sdcard/my_file.txt


42.- toybox

toybox is a file that contains most of these LINUX commands.

For example, truncate is a symbolic link to the toybox file, such that when we run truncate we are executing a command that is “inside” toybox.

Using ls -ali /system/bin/ we get this list …

Note that most are symbolic links to toybox.

Toybox’s main goal is to make Android self-hosting by improving Android’s command line utilities so it can build an installable Android Open Source Project image entirely from source under a stock Android system. After a talk at the 2013 Embedded Linux Conference explaining this plan (outline, video), Google merged toybox into AOSP and began shipping toybox in Android Mashmallow. (

Help commands toybox:


toolbox is similar to toybox,

1 Like

43.- truncate

truncate, used to shrink or extend the size of file.

touch /mnt/sdcard/zero.txt ( 0 bytes)
ls -ali /mnt/sdcard/zero.txt

truncate -s 123K /mnt/sdcard/zero.txt (now 123K)(filled NULNUL)
ls -ali /mnt/sdcard/zero.txt

44.- uptime

uptime, how long your system has been running.

45.- uudecode ::: uuencode

base64 vs uuencode;