QNX User Guide
Please note that, although information is presented here in a
careful order, not all of the information appears when it is needed.
Please read the whole of this document before running an experiment.
Refer to the notes at the end of this document for more information
on the commands used.
Home Directory
The default file location is known as the home
directory, which is equivalent to the My Documents
folder on a Windows computer. The actual name of this directory
matches the username, and is a subdirectory of the directory called
home. For example, with a username of zoe,
the home directory is /home/zoe. The symbol
“˜” (known as the tilde) refers to this
directory.
Using Removable Disk Drives
QNX does not automatically ‘see’ the floppy disk and
CD-ROM; it has to be told to connect to them before files can be
copied to and from them. Also, when connected, they are not referred
to as the “A: drive” or “D: drive” as in
Windows. Instead, they are referred to as directories in QNX's file
system.
To make a connection to the floppy disk drive, follow these
steps:
- Bring up a terminal window, by clicking on the button called
Terminal on the right hand edge of the screen.
- Place the floppy disk in the disk drive.
- Type the command
su
- Enter the password for the root account.
- Type the command
mount -t dos /dev/fd0 /fs/floppy
- Type the command
exit
Files on the floppy disk can now be found in the directory
/fs/floppy. Copying files to this directory will put
files onto the floppy disk.
For the CD-ROM, the process is very similar, but replace
/dev/fd0 with /dev/cd0, and
/fs/floppy with /fs/cdrom.
Running Programs
- Move into the program's directory by typing the command
cd followed by a space, then followed by the name
of the directory that the program file is stored in
- Run the program by typing ./ followed by the
name of the program file, followed by a space and
2>err.err \&. For example, to run the
Cockpit program (the file name of which is
cockpit), use the following command:
./cockpit 2>err.err \&
Working With Files
Files and directories (Unix's name for folders) can be viewed and
manipulated on QNX using File Manager. File Manager can be
run by clicking on the button marked File Manager on the
right-hand edge of the screen. Its operation is very similar to that
of Windows Explorer on Windows computers.
The files that contain the configuration settings, instructions,
and function-labels, all contain only plain text. This means they
can be viewed easily and editted in any text editor. Plain text
files cannot contain any formatting information, so documents
created with word processors such as Word, are not plain text,
although most word processors can save a document in plain text
format, although the plain text file can contain none of the
formatting information in the original document.
The standard editor on QNX is called Ped (for Photon
Editor), and can be run by clicking on Launch, then Editors, then
Ped. It works in the same way as NotePad, which is the text editor
on Windows computers.
To view and edit text files, use File Manager. First locate the
file, then click on it to select it. Then go to the File menu, and
select Edit. This will automatically run the editor Ped and load the
selected file into it.
Many programs work with instruction files, or configuration files
(or both). These files should contain only plain text. They cannot
contain any formatting information (fonts, underlining, etc.) and
cannot be a Microsoft Word document.
Files and Directories
- Filenames are case-sensitive. For instance,
Europe.txt and europe.txt would
refer to two different files. Use all-lowercase letters, if
possible; it makes typing easier.
- File names must not contain spaces or brackets
(avoid all punctuation symbols, if possible). However, the hyphen
(“-”), the underscore (“_”), and the
full-stop (“.”) characters are fine, and are good
substitutes for spaces between words.
- The tilde (“˜”) symbol is an abbreviation
for the user's home directory (equivalent to My Documents
on a Windows computer).
- QNX always keeps a record of ‘where’ it is in the
file system, at any one time. This record is known as the
current directory, and file names are generally
specified relative to this directory. The name of the current
directory can be displayed by entering the command
pwd.
- Directories can be named in absolute or relative terms. An
absolute directory name works regardless of which directory the
computer is ‘in’ (the current directory) at the time.
To specify an absolute directory, the first character must be the
forward slash (“/”, also known as just the
“slash” character), which refers to the root
directory. In fact, absolute directory names can be thought of as
actually being relative to the root directory. Relative
directories, on the other hand are given relative to the current
directory.
- When specifying directory names, the current directory can be
referred to with a dot (full-stop, “.”). To indicate
the dot is a directory name, and not part of the actual file's
name, the forward slash separator is used. Thus. a file called
instruct.txt in the current directory can be
referred to as ./instruct.txt. However, it is not
necessary to use this name, since the computer will assume you
mean files in the current directory, if you do not specify a
directory name. Note that this does not apply when running
programs — for technical reasons, it is necessary to
specify the dot when referring to the program file.
- To refer to the parent directory of the current directory
(the directory in which the current directory is contained), the
double-dot name is used. This is simply two dots (without a space
between them). Thus, if the current directory is
/home/zoe/vsearch, the command cd
.. would change to the zoe
directory.
- The full name of a file is typically known as the
path, and this consists of two parts; the directory
name, and the file name. Thus, a full path might look like
/home/zoe/vsearch/instruct.txt.
- The floppy disk is actually treated as a directory, called
/fs/floppy. This is in contrast to DOS and
Windows, which refer to the floppy disk as “A:”.
- To save typing out a filename when entering a command, simply
type the first few letters of the name, and then press the ESC
key twice in rapid succession.
Using Commands
- QNX commands typically have a number of parts, which are
separated from each other by spaces. The first part is the
command name itself. The next part is any options to use when
performing the required operation, these are usually prefixed by
a hyphen. For instance, the “-i” option tells the
cp (copy) command to issue a warning if an
attempt is made to copy a file over an existing file. The options
are an optional part of the command and can be left out
altogether. The next part is usually the file to operate on (AKA
the source file) and usually must be supplied, and the
last part indicates where the operation is to be applied (i.e.
the destination or target).
- To copy files from the floppy disk, use the command
cp /fs/floppy/* destination directory
destination directory should be replaced with the name of
the directory to which the files should be copied (e.g.
instruct). You must ensure that the directory to
which the files will be copied already exists. Examples: To copy
the gestalt icon files, assuming the floppy disk contains labels
and icons for gestalt icons only, type
cp /fs/floppy/* ˜/icons/gestalt.
To copy instructions, type
cp /fs/floppy/*.txt ˜/instruct
- To move or rename files, use the command mv,
which is used in exactly the same way (in terms of naming the
source and destination) as the cp command.
- When copying files, the directory to which they are being
copied must already exist. To create a directory, use the
mkdir command. For instance, to create a
directory called multi in the
icons directory, type
cd icons
then press return, then type
mkdir multi.
- The contents of the floppy disk can be viewed using the
command
ls -l /fs/floppy
The “-l” is an ‘el’ not a one. (The
ls command LiSts files in the specified
directory, and the “-l” option provides more
information about each file).
- Commands can be re-entered (repeated) simply by pressing the
up and down arrow keys to scroll through the list of commands
that have already been entered. Use the right and left arrow
keys, along with the delete and backspace keys to edit the
command.
Content last updated: 2008-03-26