|HP-UX Reference > I
HP-UX 11i Version 3: February 2007
introduction — HP-UX operating system and HP-UX Reference
HP-UX is the Hewlett-Packard Company's implementation of a UNIX® operating system that is compatible with various industry standards. It is based on the System V Release 4 operating system (SVR4) and includes important features from the Fourth Berkeley Software Distribution (4BSD).
Improvements include enhanced capabilities and other features, developed by HP to make HP-UX a very powerful, useful, and reliable operating system, capable of supporting a wide range of applications ranging from simple text processing to sophisticated engineering graphics and design. It can readily be used to control instruments and other peripheral devices. Real-time capabilities further expand the flexibility of HP-UX as a powerful tool for solving tough problems in design, manufacturing, business, and other areas where responsiveness and performance are important.
Extensive international language support enables HP-UX to interact with users in any of dozens of human languages. HP-UX interfaces easily with local area networks and resource-sharing facilities. By using industry-standard protocols, HP-UX provides flexible interaction with other computers and operating systems. Optional software products extend HP-UX capabilities into a broad range of specialized needs.
The HP-UX Reference is not a learning tool for beginners. It is primarily a reference tool that is most useful for experienced users of UNIX or UNIX-like systems. If you are not already familiar with UNIX or HP-UX, refer to the series of Beginner's Guides, tutorial manuals, and other learning documents supplied with your system or available separately. System implementation and maintenance details are explained in the HP-UX System Administrator's Guide.
This introduction and the section intro manpages describe the "core" manpages that are delivered with HP-UX. Other manpages may be delivered separately with optional HP-UX and third-party software and may reside in the same directories as the core manpages, or in other directories.
The contents of the HP-UX Reference and its on-line counterpart are a number of independent entries called manpages. These are also called manual entries or reference pages.
For convenient reference, the manpages are divided into eight specialized sections. The printed manual also has a table of contents for each volume and a composite index.
Each manpage consists of one or more printed pages, with the manpage name and section number printed in the upper corners. Manpages are arranged alphabetically within each section of the reference, except for the intro page at the beginning of each section. Manpages are referred to by name and section number, in the form pagename (section).
The manpages are available on-line through the man command if the manpages are present on the system. Refer to the man(1) manpage in Section 1 for more information.
Each page in the printed manual has two page numbers, printed at the bottom of the page. The center page number starts over with page 1 at the beginning of each new manpage; it is placed between two dashes in normal typeface. The number printed at the outside corner on each page is the sequence number of the page within the volume. Users usually locate manpages by the alphabetic headings at the top of the page as when reading a dictionary.
Some manpages describe two or more commands or routines. In such cases, the manpage is usually named for the first command or function that appears in the NAME section. Occasionally, a manpage name appears as a group descriptor in the NAME section. In such instances, the name describes the commands or functions in more general terms. For example, the acct(1M) manpage with group descriptor acct: describes the acctdisk, acctdusg, accton, and other commands, while the string(3C) manpage with group descriptor string: describes many character string functions.
SECTIONS OF THE HP-UX REFERENCE
The HP-UX Reference contains the following sections:
All manpages follow an established section heading format, but not all section headings are included in each manpage. A few manpages have self-explanatory specialized headings.
GETTING STARTED WITH HP-UX
This is a very brief overview of how to use the HP-UX system: how to log in and log out, how to communicate through your machine, and how to run a program.
HP-UX uses control characters to perform certain functions. Control characters are generally shown in the form ^x, such as ^D for Control-D. Hold down the Control (Ctrl) key while you press the character key.
Note: The key names Enter and Return refer to the same key.
To log in you must have a valid user name and password, which can be obtained from your system administrator.
When a connection has been established, the system displays login: on your terminal. Type your user name and press the Enter key. Enter your password (it is not echoed by the system) and press Enter.
A list of copyright notices and a message-of-the-day may greet you before the first prompt.
It is important that you type your login name with lowercase letters, if possible. If you type uppercase letters, HP-UX assumes that your terminal cannot generate lowercase letters, and treats subsequent uppercase input as lowercase.
When you log in successfully, the system starts your login shell. The default is the POSIX shell, /usr/bin/sh. The POSIX shell (and its predecessors, the Korn and Bourne shells) use $ as the default prompt for users. The C shell uses %. All the shells use # as the default superuser prompt.
You can log out of the shells by typing an exit command or the eof (end-of-file) character (see the Special Interactive Characters subsection below). The shell terminates and the login: prompt appears again. (If you are using the C, Korn, or POSIX shells, respectively, see csh(1), ksh(1), or sh-posix(1) for information about the ignoreeof special command.)
How to Communicate Through Your Terminal
HP-UX gathers keyboard input characters and saves them in a buffer. The accumulated characters are not passed to the shell or other program until you type Enter.
HP-UX terminal input/output is full-duplex. It has full read-ahead, which means that you can type at any time, even while a program is printing on your display or terminal. Of course, if you type during output, the output display will have the input characters interspersed in it. However, whatever you type will be saved and interpreted in the correct sequence. There is a limit to the amount of read-ahead, but it is generous and not likely to be exceeded unless the system is severely overloaded or operating abnormally. When the read-ahead limit is exceeded, the system throws away all the saved characters.
Special Interactive Characters
A number of special characters are used to control the input and output of your terminal. These characters have defaults and can be redefined with the stty command (see stty(1)). Definitions of the stty names are in termio(7) and termiox(7).
Note: The system administrator can modify the system login defaults by changing the characteristics of the /dev/ttyconf device file with the stty command.
The eof character terminates "file" input from the terminal, as read by programs and scripts. By extension, eof can also terminate the shell (see the Logging Out subsection above).
The erase character erases the last character typed. Successive uses of erase will erase characters back to, but not beyond, the beginning of the input line.
The kill character deletes all characters typed before it on a terminal input line.
The intr character generates an interrupt signal that bypasses the input buffer. This signal generally causes whatever program you are running to terminate. It can be used to stop a long printout that you don't want. However, programs can arrange either to ignore this signal altogether, or to be notified when it happens (instead of being terminated). For example, the vi editor catches interrupts and stops what it is doing, instead of terminating, so that an interrupt can be used to halt an editing operation without losing the file being edited.
The quit character generates a quit signal that bypasses the input buffer and most program traps and causes a running program to terminate. It can cause a core dump in the current directory.
The stop character can be used to pause output to the terminal. It is commonly used on video terminals to suspend output to the display while you read what is already being displayed. You can then resume output by typing the start character. When stop and start are used to suspend or resume output, they bypass the keyboard command-line buffer and are not passed to the program. However, any other characters typed on the keyboard are saved and used as input later in the program.
The eof, erase, and kill characters can be used as normal text characters if you escape them with a preceding \, as in \^D. Therefore, to erase a \, you need two erases.
The intr, quit, start, and stop characters cannot be escaped on the input line.
End-of-Line and Tab Characters
Besides adapting to the speed of the terminal, HP-UX tries to be intelligent as to whether you have a terminal with a newline (line-feed) key, or whether it must be simulated with a return/line-feed character pair. In the latter case, all incoming return characters are changed to line-feed characters (the standard line delimiter), and a return/line-feed pair is echoed to the terminal. If you get into the wrong mode, use the stty command to correct it (see stty(1)).
Tab characters are used freely in HP-UX source programs. If your terminal does not have the tab function, you can arrange to have tab characters changed into spaces during output, and echoed as spaces during input. The stty command sets or resets this mode. By default, the system assumes that tabs are set every eight character positions. The tabs command (see tabs(1)) can set tab stops on your terminal, if the terminal supports tabs.
How to Run a Program
When you have successfully logged into HP-UX, the shell monitors input from your terminal. The shell accepts typed lines from the terminal, splits them into command names and arguments, then executes the command. The command can be the name of a shell built-in, an executable script of commands, or an executable program. There is nothing special about system-provided commands, except that they are kept in directories where the shell can find them. You can also keep commands in your own directories and arrange for the shell to find them there.
The command name is the first word on an input line to the shell; the command and its arguments are separated from one another by blanks (one or more space and/or tab characters).
When a program terminates, the shell ordinarily regains control and prompts you to indicate that it is ready for another command. The shell has many other capabilities, which are described in detail in the appropriate manpages: sh-posix(1) for the POSIX shell, ksh(1) for the Korn shell, or csh(1) for the C shell.
The Current Directory
HP-UX has a file system arranged in a hierarchy of directories. When the system administrator gave you a user name, he or she also created a directory for you (ordinarily with the same name as your user name, and known as your login or home directory). When you log in, that directory becomes your current 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 the cd command (see cd(1)).
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 aC++ (see aCC(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 subsequent 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 probably need to link library subroutines with it (see ld(1)). FORTRAN, C, and aC++ call the linker automatically.
When you have gone through this entire process without encountering any diagnostics, the resulting program 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. For more information, see your language's Programmer's Guide.
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. 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.
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 terminal display (if permission to do so has been granted by the other user). Otherwise, elm, mailx, or mail (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.
cat(1), cc_bundled(1), cd(1), chsh(1), cp(1), csh(1), ed(1), ex(1), ksh(1), ld(1), login(1), lp(1), ls(1), mail(1), mailx(1), man(1), mkdir(1), more(1), mv(1), passwd(1), pr(1), rm(1), rmdir(1), sed(1), sh(1), sh-posix(1), stty(1), tabs(1), vi(1), write(1), a.out(4), profile(4), glossary(9).
The HP Technical Documentation website at: http://docs.hp.com.