Tag Archive: command line

When an operating system like JANOS is created it first reaches out to the world through the simplest communications channel, a serial port. When the developer then wants to interact with the new OS, commands are entered through that Command Line Interface. Soon a reasonable vocabulary of commands are made available for use and this becomes the developer’s Console.

As the operating system finds new ways to communicate with its surroundings it discovers the network and begins to support useful protocols. Logically the first would be some serial channel simulation (Telnet) over which it can offer access to its Command Line Interface for use by others. Eventually, graphical user interfaces emerge and a more modern and user-friendly environment comes into existence.

While the Command Line may seem Old School and it may generate some apprehension on the part of a new user, it is the Go-To utility for the developer. It is here that the system’s vitals can be monitored and the OS can be encouraged to perform for us. It is no surprise that the Command Line has been a key element of the JNIOR from the beginning. We will cover aspects of this user interface that have been enhanced with JANOS v2.0.

Persistent Command History

Every JNIOR, even back to the Series 3, memorized a few commands as you entered them during the Console session. It has always been possible to scroll back to a prior command using the cursor UPARROW and DNARROW keys. This allowed you to scroll to a command and re-execute it by hitting ENTER. You could even edit the command to create a new similar command and execute that. The Series 4 more than doubled the number of individual commands that it would remember during the session.

With JANOS v2.0 this command line history is now persistent. Meaning that you can exit the Console session, return at a later time and scroll back to commands that were entered in prior sessions. This persistent history is saved by User and so each user has his/her own. The same user can even access the Console simultaneously through different channels and retrieve past command history, not have confusion over commands entered in the other session, and see the logical combination of activities later. The number of commands remembered has been expanded to 99. This history, however, remains available ONLY as long as the JNIOR stays powered.


The HISTORY command has always been available and it displays those memorized commands. With Series 3 it was just a few and with Series 4 a longer list. But in those instances it otherwise had little utility.

With JANOS v2.0 the HISTORY command has been expanded to provide better access to the (now larger) record of commands. 

bruce_dev /> help history
HISTORY [index|regex]

index Integer selects command for editing
regex Used for case-insensitive search

Accesses the command line history.

bruce_dev />

For example, if you had entered a command earlier to reboot the JNIOR with some options that you now want to repeat, you can locate that command by typing hist boot. The HIST command being just a shortened alias for HISTORY. The “boot” text is used as a Regular Expression to search the history and any line matching the inquiry is listed. If there is only one matching line it will be selected and brought to the command line to be edited or executed. This command is now very useful.

When multiple lines are listed they are enumerated. You can select any command by entering its index. For example, hist 5 will retrieve the command line displayed with index 5 for editing and execution.


The <TAB> key has become useful in later versions of JANOS. It provides a means of auto-completion. For example, when entering a parameter to a command you can type the first couple of characters of a file or folder name and use the <TAB> key.  JANOS will finish the entry with matching file of folder names. Repeated use of the <TAB> key scrolls through all possible matches and returns to your original line if none meets your need. If the name you seek is displayed you can merely continue to enter your command having been saved from explicitly typing the entire file or folder specification. Warning: You will become addicted to this aid. As much as you want it to, the Series 3 will not do it.

The <TAB> key in fact is context sensitive. If you are entering a REGISTRY command (REG for short) the auto-completion will use known or existing Registry keys instead of file or folder names. In addition, if you have entered the REG command, a Registry key and then the equals ‘=’ sign, if you immediately hit <TAB> (before any space) the current key’s value will be supplied. This is very useful, first if you cannot precisely remember a Registry key and then if you only want to modify the existing value slightly.

At the beginning of a line you can enter the first character or two of a command and use <TAB>. This will auto-complete with valid commands and even offer matching commands from your command history.  But, of course, some people do like to type.

Finally, imagine that you have just loaded an unruly named UPD file into the /temp folder and need to execute a manual update using the JRUPDATE command. The following generally builds the command for you without much thought:

jru<TAB> -fup t<TAB>/<TAB>

This is best experienced through experimentation. Give it a try.

New Commands

JANOS v2.0 introduces some new commands:

  • EDIT a simple text editor.
  • NBTSTAT for new NetBIOS support.
  • … and some additional command aliases.


Once a JNIOR is up and running in an application it rarely needs attention. In fact many users forget that it is even there. It is however good practice to check the system logs once and a while. Fortunately there are a number of ways that you can do that. If you open the DCP (Dynamic Configuration Pages) by accessing the unit with a browser there is a ‘Syslog’ tab. This displays the log with the most recent events right at the top. You can also go to the ‘Console’ tab or otherwise open the Command Line through a Telnet connection or the serial port where you can list the log content directly to the screen or window. In this case the latest entries are the last listed.

If you are developing a new application and testing it on the JNIOR you may wish to monitor the log more closely. Naturally you can leave the DCP open on the ‘Syslog’ tab and new events would just pop up when they are logged. That might not be as convenient as it sounds especially if you are building a network-facing application and are constantly testing and working with the JNIOR using various browsers. Perhaps you are rebooting the unit causing the DCP to reconnect far too often. More typically we periodically make a Command Line connection through Telnet and manually list the log. Here we make use of the CAT command.

mqtt-test /> help cat
CAT filespec

 -H             Dump file in hex
 -J             Formats JSON
 -P             Displays last page

Displays the contents of a file.
Aliases: CAT, TYPE

mqtt-test /> cat -p jniorsys.log

Now the jniorsys.log file is limited to about 64KB characters. That can represent a lot of lines. Do you really want to list those every time? Here we see that the CAT command also provides the -P option which will show only the last page (25 lines) of the file. Of course you do have to remember to include the option. One side note here is that with JANOS you can supply the options anywhere on the line. So if you at first forget to include the -P you can place it after the filename. No problem.

We can improve on this by making use of JANOS batch file capabilities. A batch file is a kind of script file that can contain commands to be executed one after another. Most operating systems, JANOS included, provide some facility for batch execution. But you might be wondering how do you create batch files or if you do that externally how do you get them onto the JNIOR? Well here’s a tip: You can create them on the fly. Of course, the simpler the file the easier that can be accomplished.

For example we will create a simple batch file called log.bat as as kind of short hand that we can use when we want to display the System Log. Here we simply ECHO the command routing the text to the file. Immediately we can use the short batch file name to execute the command.

mqtt-test /> echo cat -p jniorsys.log > log.bat

mqtt-test /> log
cat -p jniorsys.log
10/03/18 18:54:15.850, FTP/ uploaded /flash/MQTT.jar [325.8 kbps]
10/03/18 18:54:24.571, ... (etc.)

Here we see that we used the ‘>’ pipe character to route the output to the specified file. If you need to build a batch file with more than one command you can append to it using ‘>>’ as well. The power here comes in combining commands to achieve some goal. The advantage being that you can repeat the procedure easily using the batch file name as shorthand. While batch files in JANOS are not as fully featured as you will find in Linux or MS-DOS systems most of the basics are there.

Suppose instead we want to list only today’s events. Here we create our batch file in way that lists only those entries with today’s date. Check it out.

mqtt-test /> echo grep %DATE% jniorsys.log > log.bat

mqtt-test /> log
grep 10/04/18 jniorsys.log
10/04/18 12:10:48.657, Ending session Command/ (pid 132)
10/04/18 12:37:53.642, Command/ login 'jnior' (pid 405)
10/04/18 12:38:05.179, FTP/ login 'jnior'
10/04/18 12:38:05.711 ... (etc.)

And there you go. You now have a simple way to check recent System Log activity. Now I bet that you are thinking how you might alter this to be even more helpful. Well, if you find that you cannot achieve what you have in mind just let us know. An advantage that you have with INTEG is a direct link to the technical team and the advantage we have is the power to implement what you need.