p>. [[CLI Basics|Index ^^]] | [[CLI Basics part 2|Part 2 >>]] --- <div id="toc_heading"></div><div id="toc"></div> h2. Getting to the command line From the RISC OS desktop, there are three ways of reaching the command line: # Press *Ctrl-F12* to open a Task Window. This multi-tasks on the desktop, but there are some restrictions to its use: see [[TaskWindow usage notes]] for details. # Press *F12* to reach the ShellCLI.[1] This runs in single-tasking mode (all desktop applications are suspended). To return to the desktop, press RETURN on a blank line. # Click on the Task Manager icon to display the Tasks window, then click MENU and choose <i>Exit desktop</i>. You would only use this method if you wanted to be sure that no desktop applications or tasks were active, as the only reliable[2] way back to the desktop is to reboot. You can force RISC OS to boot to the command line by holding down the <b>*</b> key (on the numeric keypad) during boot. Holding down the SHIFT key can also cause RISC OS to boot to the command line, but this is less reliable (it won't work if you have installed RISC OS via NOOBS, for example). Once at the command line, you will be presented with a <b>*</b> prompt. fn1. <small>If nothing happens when you press F12, check that Scroll Lock isn't active (translation: try pressing the Scroll Lock key).</small> fn2. <small>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).</small> h2. Star commands In RISC OS, CLI commands are called <b>star commands</b>. This is a reference to the way that the commands are invoked from BBC BASIC, where the <b>*</b> character (the "star") must appear at the front of the command. When at the CLI, the leading <b>*</b> 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. h2. Command line quirks Here are a few "features" of the command line that you need to be aware of: * If a command produces a lot of output to the screen, it may pause after each screenful. Press the SHIFT key to see the next screenful. <b>There is no on-screen reminder of this</b>, so it can look like the computer has frozen when it is simply waiting for the SHIFT key to be pressed. * If the Scroll Lock LED is illuminated, the screen won't scroll when the cursor reaches the bottom of the screen. Press the Scroll Lock key to release the lock. * When using a widescreen monitor, some commands (e.g. @*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. * Officially, the maximum length of a command line is 1023 characters. However, you may run into problems (especially when using the desktop) if the command length exceeds approximately 236 characters. h2. Finding your way around the directory structure 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 <b>.</b> (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 <b>$</b> 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. h3. Directory navigation commands [[*ADFS]], [[*CDFS]], [[*RAM]], [[*SCSI]], [[*SDFS]] Select the named filing system, assuming that it exists on your system. <i>(Your system may have other filing systems not listed above - they can be selected by issuing the appropriate command)</i> [[*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 ^.^@ h3. Directory display commands [[*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 <i>large</i> gap between the columns. If you are running this from a task window, ensure that the window is the full width of the screen. h3. Other useful commands 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. h2. Obey files The RISC OS equivalent of a script file is an <b>Obey</b> 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]]. h2. Further reading * [[Introduction To *Commands]] in the Programmer's Reference Manual * [[*Commands|Full list of star commands]] A list of star commands can also be found in the file $.Documents.UserGuide.StarComms in [[Software information: HardDisc4|the standard RISC OS HardDisc4 image]]. --- p>. [[CLI Basics|Index ^^]] | [[CLI Basics part 2|Part 2 >>]]