From the RISC OS desktop, there are three ways of reaching the command line:
If you can’t get to the RISC OS desktop, you may be able to boot to the command line by holding down the SHIFT key during boot.3
Once at the command line, you will be presented with a * prompt.
1 If nothing happens when you press F12, check that Scroll Lock isn’t active (translation: try pressing the Scroll Lock key).
2 You could in principle use the *Desktop command, but you may find that things are not quite right (e.g. the desktop may have a blank background instead of your chosen image).
3 This is not guaranteed to work (e.g. a USB keyboard may be ignored if there are too many other USB devices connected, or a particular keyboard may misinterpret a key held down at power-on as a “stuck key”).
In RISC OS, CLI commands are called star commands. This is a reference to the way that the commands are invoked from BBC BASIC, where the * character (the “star”) must appear at the front of the command.
When at the CLI, the leading * can be omitted, but the command will still work if it is present. In other words,
copy file1 file2
and
*copy file1 file2
will have the same effect.
Star commands are specified in mixed case for readability, but can be entered in lower case (or all upper case) if you prefer.
Here are a few “features” of the command line that you need to be aware of:
*Ex
) can produce output in two or more columns. If you are using a task window, ensure that the window is the full width of the screen, or you may miss some of the output.
In RISC OS, the path to a file is structured thus:
(filing-system:)(:drive).$.(directory1).(directory2).(filename)
For example: SDFS::Card0.$.Work.Example
Note that the directory separator is . (i.e. a full stop). When looking at a file transferred from another operating system, any full stops in the filename will be replaced with the / character (e.g. “example.txt” becomes “example/txt”).
Also note that $ represents the root directory of the drive.
It is not necessary to specify every component. If you have selected SDFS as the current filing system, that portion can be omitted (i.e. it becomes :Card0.$.Work.Example
). The concepts of “current drive” and “currently selected directory” also exist, so you could omit those components as well:
$.Work.Example
– a file on the current drive
Example
– a file in the Currently Selected Directory (CSD)
Each filing system maintains its own settings for current drive and CSD, so it would be possible to issue a command such as
copy cdfs:example sdfs:*
to copy a file from the CSD of CDFS to the CSD of SDFS.
*ADFS, *CDFS, *RAM, *SCSI, *SDFS
Select the named filing system, assuming that it exists on your system.
(Your system may have other filing systems not listed above – they can be selected by issuing the appropriate command)
*Drive
Selects a drive on the current filing system. The drive can be specified by name, or by number (0-7).
*Dir
Change directory: the specified directory becomes CSD. This can take a full path (e.g. SDFS::Card0.$.Work.Example) or the subsets as mentioned above. You can also use the following special characters:
^ | Parent directory |
$ | Root directory |
& | User root directory (e.g. on network shares) |
% | Library directory |
\ | Previous directory |
For example, *dir ^.^
would move two levels up the directory structure.
*Back
Swap current and previous directory. Handy if you are working in two directories.
*Up
Move up the directory structure the specified number of levels. Hence *Up
has the same effect as *dir ^
and *Up 2
has the same effect as *dir ^.^
*Cat
Displays a condensed directory listing of the specified directory, or of CSD if no directory is specified.
*Ex
Displays an expanded directory listing (including file size, date stamp etc.)
On widescreen monitors, the display can be in two or more columns, with a large gap between the columns. If you are running this from a task window, ensure that the window is the full width of the screen.
This is just a small sample. See *Commands for a full list.
*CDir – Create a directory.
*Copy – Copy a file or files. Wildcards are permitted.
*Delete – Delete a file or directory. If specifying a directory, it must be empty.
*Dismount – Dismounts a drive, to allow safe disconnection.
*Dump – Displays the contents of a file in hexadecimal and plain text.
*FileInfo – Displays full file information for the specified file.
*Free – Displays the amount of free space left on the drive.
*Help – Get help (where available) on a star command.
*Obey – Execute a text file as if it were an Obey file.
*Rename – Renames a file or directory.
*Type – Displays the contents of the named file.
*Wipe – Deletes one or more files or directories. Wildcards are permitted.
The RISC OS equivalent of a script file is an Obey file. This has its own filetype, so can be run from the desktop by double-clicking. In the CLI you can enter the name of the Obey file just as if it were a star command.
For more on Obey files, see Introduction to Obey.
A list of star commands can also be found in the file $.Documents.UserGuide.StarComms in the standard RISC OS HardDisc4 image.