Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
Lua RTOS has an integrated shell that allows you to execute commands in a linux similar way. The shell is disabled by default, but you can enable it typing os.shell(true) in the prompt, or putting os.shell(true) in the system.lua file.
The shell command are organised into the following categories:
Clear the terminal screen.
luac source [destination]
luac is the Lua compiler. It translates programs written in the Lua programming language (source argument) into binary files ([destination] argument) that can be later loaded and executed.
The main advantages of precompiling chunks are: faster loading, protecting source code from accidental user changes, and off-line syntax checking.
Precompiling does not imply faster execution because in Lua chunks are always compiled into bytecodes before being executed. luac simply allows those bytecodes to be saved in a file for later execution.
destination argument is optional, and if it's not provided the compiled filename is the source filename postfixed with the "c" character.
-- Compile test.lua into test.luac file luac test.lua test.luac -- Compile test.lua into test.luac file luac test.lua
File system commands
Print the file on the standard output.
/ > cat system.lua -- system.lua -- -- This script is executed after a system boot or a system reset and is intended -- for setup the system. --------------------------------------------------- -- Main setups --------------------------------------------------- os.loglevel(os.LOG_INFO) -- Log level to info os.logcons(true) -- Enable/disable sys log messages to console os.shell(true) -- Enable/disable shell os.history(false) -- Enable/disable history / >
Change the working directory to directory.
/ > cd examples /examples >
cp source destination
Copy the source file to the destination file.
/ > cp autorun.lua autorun.old
Edit the filename.
Lists directory contents of files and directories that matches the pattern.
/ > ls *.lua f 0 autorun.lua f 2446 system.lua f 2445 config.lua f 252 test.lua f 280 test2.lua
Creates a new directory named directory in the current directory.
Print the contents of file one screen at a time.
mv source destination
Move (rename) the source file to the destination file.
Print name of current/working directory.
/examples > pwd /examples /examples >
Remove the files that match the pattern.
Prints information about the status of the network interfaces.
/ > netstat wf: mac address 24:0a:c4:01:96:ec ip address 192.168.1.46 / netmask 255.255.255.0 gw address 192.168.1.1 ip6 address fe80:0000:0000:0000:260a:c4ff:fe01:96ec en: mac address 00:00:00:00:00:00 ip address 0.0.0.0 netmask 0.0.0.0 gw address 0.0.0.0
Send ICMP ECHO_REQUEST to network hosts to test connectivity between Lua RTOS an the host.
/ > ping whitecatboard.org PING whitecatboard.org (188.8.131.52): 32 data bytes 60 bytes from 184.108.40.206: icmp_seq=1 time=35.515 ms 60 bytes from 220.127.116.11: icmp_seq=2 time=39.351 ms 60 bytes from 18.104.22.168: icmp_seq=3 time=35.153 ms 60 bytes from 22.214.171.124: icmp_seq=4 time=35.429 ms 60 bytes from 126.96.36.199: icmp_seq=5 time=35.362 ms 60 bytes from 188.8.131.52: icmp_seq=6 time=35.490 ms 60 bytes from 184.108.40.206: icmp_seq=7 time=35.216 ms 60 bytes from 220.127.116.11: icmp_seq=8 time=35.389 ms 60 bytes from 18.104.22.168: icmp_seq=9 time=35.739 ms 60 bytes from 22.214.171.124: icmp_seq=10 time=35.223 ms 10 packets transmitted, 10 packets received, 0.0% packet loss round-trip min/avg/max/stddev = 35.153/35.787/39.351/1.199 ms
Print the syslog contents on the standard output.
Note: dmesg is only available if the underlying storage for your root filesystem is not the SPI FLASH.
Changes the root password, used to establish a ssh connection to Lua RTOS.
Prints the Lua RTOS up time (the time that Lua RTOS is up since last reboot).
/ > uptime 23:42 up 0:04:14
Reboot the system.