HP-UX Reference (11i v2 04/09) - 7 Device (Special) Files, 9 General Information, Index (vol 10)

introduction(9) introduction(9)
or working directory, and any file name you type is assumed to be in that directory by default. Because
you are the owner of this directory, you have full permission to read, write, alter, or destroy its contents.
The permissions you have for other directories and files will have been granted or denied to you by their
respective owners, or by the system administrator. To change the current working directory use cd(1).
Path Names
To refer to files not in the current directory, you must use a path name. Full (absolute) path names begin
with
/, which is the name of the root directory of the whole file system. After the slash comes the name of
each directory containing the next subdirectory (followed by a
/), until finally the file name is reached
(for example,
/usr/ae/filex
refers to file filex in directory ae, while
ae is itself a subdirectory of
usr; usr is a subdirectory of the root directory). See glossary (9) for a formal definition of path name.
If your current directory contains subdirectories, the path names of files in them begin with the name of
the corresponding subdirectory (without a prefixed
/). Generally, a path name can be used anywhere a
file name is required.
Important commands that modify the contents of directories are
cp, mv, and rm which respectively copy,
move (that is, rename, relocate, or both), and remove files. To determine the status of files or the contents
of directories, use the
ls command. Use
mkdir to make directories, rmdir to destroy them, and mv to
rename them (see cp(1), ls(1), mkdir (1), mv(1), rm(1), and rmdir(1)).
Writing a Program
To enter the text of a source program into an HP-UX file, use a text editing program such as
vi, ex,or
ed (see vi(1), ex(1), and ed(1)). The three principal languages available under HP-UX are C (see
cc_bundled (1) and cc(1)), FORTRAN (see f77(1)), and Pascal (see pc (1)). After the program text has been
entered with the editor and written into a file (whose name has the appropriate suffix), you can give the
name of that file to the appropriate language processor as an argument. Normally, the output of the
language processor will be left in a file named
a.out in the current directory. Since the results of a sub-
sequent compilation may also be placed in a.out, thus overwriting the current output, you may want to
use mv to give the output a unique name. If the program is written in assembly language, you will prob-
ably need to link library subroutines with it (see ld(1)). FORTRAN, C, and Pascal call the linker
automatically.
When you have gone through this entire process without encountering any diagnostics, the resulting pro-
gram can be run by giving its name to the shell in response to the prompt.
Your programs can receive arguments from the command line just as system programs do by using the
argc and argv parameters. See the supplied C tutorial for details.
Text Processing
Almost all text is entered through a text editor. The editor preferred above all others provided with HP-
UX is the
vi editor. For batch-processing text files, the
sed editor is very efficient. Other editors are
used much less frequently. The
ex editor is useful for handling certain situations while using vi
but
most other editors are rarely used except in various scripts.
The following editors are the same program masquerading under various names:
vi, view, and vedit
(see vi (1)) and ex and edit (see ex(1)). For information about the sed stream editor, see sed(1). The
ed line editor is described in ed(1).
The commands most often used to display text on a terminal are
cat, more, and pr (see cat (1), more(1),
and pr(1)). The cat command simply copies ASCII text to the terminal, with no processing at all. The
more command displays text on the terminal a screenful at a time, pausing for an acknowledgement from
the user before continuing. The pr command paginates text, supplies headings, and has a facility for
multicolumn output. pr is most commonly used in conjunction with the lp command (see lp(1)) to pipe
formatted text to a line printer.
Interuser Communication
Certain commands provide interuser communication. Even if you do not plan to use them, it could be
beneficial to learn about them, because someone else may direct them toward you. To communicate with
another user that is currently logged in, you can use
write to transfer text directly to that user’s termi-
nal display (if permission to do so has been granted by the other user). Otherwise, elm, mailx,ormail
(in order of ease of use) can send a message to another user’s mailbox. The user is then informed by HP-
UX that mail has arrived (if currently logged in) or mail is present (when the user next logs in). Refer to
elm(1), mail(1), mailx(1), and write (1) for explanations of how these commands are used.
Section 932 Hewlett-Packard Company 6 HP-UX 11i Version 2: September 2004