1.- base64 encode/decode.
base64 /mnt/sdcard/AppInventor/assets/logo1.png > /mnt/sdcard/logo1.txt
base64 -d /mnt/sdcard/logo1.txt > /mnt/sdcard/logo2.png
base64 /mnt/sdcard/AppInventor/assets/logo1.png
https://linuxhint.com/bash_base64_encode_decode/
shell_base64.aia (9.9 KB)
3 Likes
2.- basename .
basename /mnt/sdcard/AppInventor/assets/logo1.png
return
logo1.png
2 Likes
3.- bunzip2 ::: bzcat ::: bzip2
zip/unzip files
2 Likes
4.- cal
calendar.
cal --help
cal 5 2020
Tutorial on using cal, a UNIX and Linux command for displaying a calendar in the console. Examples of displaying a single month, multiple months, showing week numbers, Julian dates and arbitrary dates passed as arguments.
1 Like
5.- cat
Create single or multiple files, view contain of file, concatenate files.
https://www.tecmint.com/13-basic-cat-command-examples-in-linux/
cat --help
cat > /mnt/sdcard/new_file
cat /mnt/sdcard/read_this.txt
cat /proc/cpuinfo
cat /proc/meminfo
1 Like
6.- cksum
This command computes a Cyclic Redundancy Check (CRC) checksum of the input file.
cksum --help
cksum /mnt/sdcard/AppInventor/assets/numeros.txt
return
2727242570 159 /mnt/sdcard/AppInventor/assets/numeros.txt
1 Like
TIMAI2
April 6, 2020, 7:08pm
9
A couple of possibly useful links:
7.- cp
Copy files from SOURCE to DEST.
cp --help
cp -v /mnt/sdcard/AppInventor/assets/numeros.txt /mnt/sdcard/numers.txt
1 Like
8.- curl
This is a great command to work with the Internet, you will be able to download files , upload them as an FTP client, read Query HTTP Headers , POST sending,…
…but with this 7.58 (Android) version, only these protocols work: file https http
curl --version
curl --help
curl -I https://community.appinventor.mit.edu/
curl -o /mnt/sdcard/my_logo.png http://domain.com/image.png
Read this:
https://www.tecmint.com/linux-curl-command-examples/
5 Likes
9.- cut
Interesting command to get parts of a file.
We have the file numbers.txt with words in Spanish, English and French. We are interested in obtaining the numbers in English.
We cut by the delimiter “,” and take field 2
cut --help
cut -d “,” -f 2 /mnt/sdcard/AppInventor/assets/numeros.txt
A Computer Science portal for geeks. It contains well written, well thought and well explained computer science and programming articles, quizzes and practice/competitive programming/company interview Questions.
shell_cut.aia (10.0 KB)
1 Like
10.- date
date --help
date
date ‘+Today is %Y-%m-%d Hour is: %H-%M-%S’
date >> /mnt/sdcard/animales.txt Change file to actual date.
date -r /mnt/sdcard/animales.txt +%Y%m%d%H%M%S.%N
To change the date you need to be root.
1 Like
TIMAI2
April 6, 2020, 8:57pm
14
Then there are the two mighty rabbit holes of bash: awk & sed
11.- dd
With this command you can copy files :
dd if=/mnt/sdcard/numeros.txt of=/mnt/sdcard/The_numbers.txt
With dd command you can build an image of SdCard , but CAUTION with this command.
1 Like
TIMAI2
April 6, 2020, 9:01pm
16
I would suggest to users that they stick with cp (copy) and mv (move).
Also be wary of commands rm & rmdir (you may need to be rooted to wipe your whole device, but better safe than sorry) - only use these if you really know what you are doing.
12.- dirname
Show directory portion of path
dirname /mnt/sdcard/AppInventor/assets/numeros.txt
return
/mnt/sdcard/AppInventor/assets
TIMAI2
April 6, 2020, 9:03pm
18
Does the extension have access to files in assets (once compiled) ?
I think not. I think it would be interesting to add to this extension, a block to extract the asset file and copy it to the SdCard.
1 Like
TIMAI2
April 6, 2020, 9:15pm
20
That is exactly what I was thinking about. This is really good
1 Like
13.- df ::: du
df , information of device name, total blocks, total disk space, used disk space, available disk space and mount points on a file system.
df -h
du , check the information, size of files and directories .
du --help
du - h /mnt/sdcard/AppInventor/assets/logo1.png
du -h /mnt/sdcard/AppInventor/assets/
du -a /mnt/sdcard/AppInventor/assets/