Commands

Alphabetical list of colorOS shell commands. Those commands available only to a System user are denoted with an asterisk (*).

ATTACH – Select a new current directory
CLEAR – Clear the display
CREATE { FILE | DIRECTORY } – Create a new text file or directory
CREATE USER – *Create a new login user
DELETE { FILE | DIRECTORY } – Delete a existing text file or directory
GET { URL | FILE } – Get the contents of a remote URL or file
LOGIN – Login to a username
LOGOUT – Logout from the current username
MESSAGE { CONNECT | DISCONNECT | STATUS } – Manage connection to the message bus
MESSAGE SEND – Send a message on the message bus
PING – Test connection to a remote computer
PRINT – Print a shell variable
REBOOT – *Reboot the computer
RUN – Run a command file
SET – *Set a system property
SHOW – Show part of the system
SHUTDOWN – *Shut down the computer


${variable} = {value} (dollar sign character)

Sets the specified shell variable to the specified value. If the value contains spaces, enclose it in double quotes (“). You can print a shell variable simply by specifying its name.

OK, $welcome = "Hello, World!"
OK, print $welcome
Hello, World!

!{variable} (exclamation mark character)

Delete an existing shell variable.

` (back-tick character)

Use surrounding back-tick characters to substitute the output of a command. Can be used to assign the output of a command to a variable.

OK, $now = `show time`
OK, print $now
Nov 10 13:40:42.13

ATTACH {directory}

Select a new current (default) directory. A System user can ATTACH to any directory, while a non-System user can only ATTACH to their login directory, and any subdirectories beneath their login directory.

CLEAR

Clear the user’s display. Clears either the connected HDMI display (if using the console), or an ANSI network terminal.

CREATE [FILE | DIRECTORY] {name}

Create a new text file or directory. If only a name and no directory path is specified, it is created within the current directory. Use the WHERE command to display the current directory.

If creating a text file, the user is prompted to enter lines of text. Type the EOF (^D) character to end input, e.g.:

OK, create file test.txt
> This is a test text file
> being created on colorOS
> ^D

Created file /MFD/SYSTEM/test.txt (50 B)

DELETE [FILE | DIRECTORY] {name}

Delete an existing text file or directory. If only a name and no directory path is specified, it is deleted within the current directory. Use the WHERE command to display the current directory.

GET { URL | FILE } {remote-path} [{filename}]

Get the contents of an HTTP/HTTPS URL, or file, from another computer, specified by the remote-path. If a filename is provided, write the contents to that file, otherwise display the contents to the user.

OK, get url https://www.google.com/search?q=raspberry+pi raspberry_pi_search.html
Output File : raspberry_pi_search.html
Bytes Received: 113852

LOGOUT

Log out of a username if currently logged in. Resets the current directory, and deletes any shell variables.

LOGIN

If logins are configured, the user is required to provide a username and password before executing any commands. The username and password can be created by a System user. Logging in as a non-System user prevents certain privileged commands (such as SHUTDOWN and REBOOT), and restricts access to only the user’s User File Directory (UFD).

OK, login

Username: dfilip
Password: ********

*** colorOS version 1.0.0 ***

OK,

MESSAGE [ CONNECT | DISCONNECT | STATUS ]

Manage connection to the message bus (MQTT Message Broker).

OK, message status
Message Bus is Connected (INF_MSG_BUS_CON)

OK, message disconnect
Message Bus is Disconnected (INF_MSG_BUS_CON)

OK, message connect
Re-Connecting to the Message Bus ... (INF_MSG_RECONCT)
Message Bus is Connected (INF_MSG_BUS_CON)

MESSAGE SEND {topic} {message}

Send a message on the message bus (if connected to an MQTT Message Broker) on the specified topic. If the message contains one or more spaces, enclose the message in double quotes (“).

OK, message send Weather/Current "TEMP 22.3 C 72.2 F 41.1 RH 29.32 IN"
Message Sent (INF_MSG_SENT)

PRINT {what}

PRINT ${variable}

Display the value of the specified variable.

PRINT RANDOM {max}

Display a decimal number between zero (0) and the maximum value specified. Particularly useful for assigning a random number to a shell variable.

OK, print random 100
54

OK, $random = `print random 100`
OK, print $random
75

REMOTE {node} {command}

Send a command to a remote colorOS node in the same cluster. Use the SHOW CLUSTER command to display a list of cluster nodes. If the command contains spaces, enclose the command in double quotes (“).

RUN {filename}

Run the specified command file. A command file is just a text file that contains sequential colorOS shell commands. A text file can be created with the CREATE FILE command. Note that the alias @{filename} can also be used to run a command file.

OK, create file time-n-name.cmd
> $now = `show time`
> $name = `print property computername`
> print $now
> print $name
> ^D

Created file /MFD/SYSTEM/time-n-name.cmd (80 B)

OK, run time-n-name.cmd
Nov 10 13:19:44.53
coloros.colornetlabs.com

OK, @time-n-name.cmd
Nov 10 13:26:46.99
coloros.colornetlabs.com

SET {property} {value}

SHOW {what}

Display information about part of the system, such as the hardware (SHOW COMPUTER), or the cluster (SHOW CLUSTER), or running tasks (SHOW TASK), or the printable character set (SHOW CHARACTERS).

SHOW CHARACTERS

Display a reference table of all printable characters, from space to tilde, along with their hexadecimal values. Useful for determining escape characters in URLs, etc.

OK, show characters

20:' '  21:'!'  22:'"'  23:'#'  24:'$'  25:'%'  26:'&'  27:'''  
28:'('  29:')'  2A:'*'  2B:'+'  2C:','  2D:'-'  2E:'.'  2F:'/'  
30:'0'  31:'1'  32:'2'  33:'3'  34:'4'  35:'5'  36:'6'  37:'7'  
38:'8'  39:'9'  3A:':'  3B:';'  3C:'<'  3D:'='  3E:'>'  3F:'?'  
40:'@'  41:'A'  42:'B'  43:'C'  44:'D'  45:'E'  46:'F'  47:'G'  
48:'H'  49:'I'  4A:'J'  4B:'K'  4C:'L'  4D:'M'  4E:'N'  4F:'O'  
50:'P'  51:'Q'  52:'R'  53:'S'  54:'T'  55:'U'  56:'V'  57:'W'  
58:'X'  59:'Y'  5A:'Z'  5B:'['  5C:'\'  5D:']'  5E:'^'  5F:'_'  
60:'`'  61:'a'  62:'b'  63:'c'  64:'d'  65:'e'  66:'f'  67:'g'  
68:'h'  69:'i'  6A:'j'  6B:'k'  6C:'l'  6D:'m'  6E:'n'  6F:'o'  
70:'p'  71:'q'  72:'r'  73:'s'  74:'t'  75:'u'  76:'v'  77:'w'  
78:'x'  79:'y'  7A:'z'  7B:'{'  7C:'|'  7D:'}'  7E:'~'  

SHOW CLUSTER

Show all nodes in the cluster, including each cluster node name, IP address, and running services. An age is also displayed, which is the number of seconds since the last message was received from the cluster node. If the age is >60, the cluster node might not be running, or might be experiencing network problems.

If logged into a System account, also displays the authorization key, which rotates every minute. The authorization key is used to authenticate intra-node cluster operations.

OK, show cluster

Cluster Status @ Nov 10 10:24:02.11

Node Name        IPV4 Address     Services Provided                  Age
aramis           10.0.1.71        cluster,echo,telnet,web             40  CC39F0C
athos            10.0.1.15        cluster,echo,telnet,web             40 DBEF4748
coloros          10.0.1.28        cluster,echo,telnet,web             40 77A3CAC7
porthos          10.0.1.87        cluster,echo,telnet,web             40 578668AA

SHOW COMPUTER [ALL | DEVICES | NETWORK | TASKS]

Show information about the computer, including kernel information, the Raspberry Pi model, total memory, available memory, and how long the computer has been running.

Optionally, also include a list of registered DEVICES, or NETWORK parameters, or a list of TASKS, or ALL of those options.

OK, show computer all

Operating System : colorOS version 1.0.0
Computer Name    : coloros.colornetlabs.com
Kernel Built     : Oct 24 2024 17:53:48
Computer Model   : Raspberry Pi 3 Model B
Memory (RAM MB)  : 1024
Available Memory : 923 MB
Uptime (seconds) : 1172 (0 day 0 hour 19 min 32 sec)

Devices:

Block Device     : emmc1
Block Device     : emmc1-2
Block Device     : emmc1-1
Character Device : uhub1
Character Device : tty1

Network:

IPV4 Address     : 10.0.1.88
Default Gateway  : 10.0.1.1
Domain Name Svr  : 10.0.1.1

Tasks:

#  ADDR     STAT  FL NAME
00 00608580 ready    main
01 0061E180 ready    wifireader
02 00632200 ready    wifitimer
03 006467C0 ready    net
04 00656C40 sleep    wpa_supplicant
05 006B3700 sleep    mqtt
06 0067E2C0 sleep    dhcp
07 006C9700 ready    cluster
08 006DB740 block    echo
09 006EC080 block    telnet
10 006FC9C0 block    httpd
11 00710A40 sleep    ntpd
12 00858A80 run      telnet-worker

SHOW TASK [{task}]

Display all running tasks (if no task name is specified), or else the details of an individual task. If a task name is specified, displays the task name, address, state, and up to the latest five (5) data values associated with the task.

OK, show task

#  ADDR     STAT  FL NAME
00 00608580 ready    main
01 0061E180 ready    wifireader
02 00632200 ready    wifitimer
03 006467C0 ready    net
04 00656C40 sleep    wpa_supplicant
05 006B3700 sleep    mqtt
06 0067E2C0 sleep    dhcp
07 006C9700 ready    cluster
08 006DB740 block    echo
09 006EC080 block    telnet
10 006FC9C0 block    httpd
11 00710A40 sleep    ntpd
12 00858A80 run      telnet-worker
OK, show task cluster
Task Name  : cluster
Address    : 006C9700
Task State : ready
Data Items : 4
 Data Item : [0] aramis|10.0.1.71|cluster,echo,telnet,web|624|BEE843E1
 Data Item : [1] athos|10.0.1.15|cluster,echo,telnet,web|624|ED5FC06A
 Data Item : [2] coloros|10.0.1.88|cluster,echo,telnet,web|624|2BDF99E7
 Data Item : [3] porthos|10.0.1.87|cluster,echo,telnet,web|624|2D77BF3E

SHOW TIME

Display the current date and time of the system clock.

OK, show time
Nov  8 20:23:29.08

SHOW VARIABLES

List all defined shell variables. Shell variables persist until the user logs out (if logins are enabled) or the computer is rebooted. Shell variables are unique to each user session, and unlike system properties, are not shared across user sessions.

OK, $hello = bonjour
OK, $goodbye = "au revoir"
OK, show variables
HELLO=bonjour
GOODBYE="au revoir"

WHERE

Display the current directory. A System user can be attached to any directory, whereas a non-System user can only be attached to their login directory, or any subdirecty beneath their login directory.