Open System Services User's Guide Abstract This guide describes the HP NonStop operating system Open System Services (OSS) user environment. The HP NonStop operating system Open System Services (OSS) environment enables users on HP NonStop servers to integrate an operating system similar to the UNIX operating system into their work environment. Topics include the OSS environment's: file system, shell, commands and utilities, interoperability with the Guardian environment, and fundamental user tasks.
© Copyright 1996, 2014 Hewlett-Packard Development Company, L.P. Confidential computer software. Valid license from HP required for possession, use or copying. Consistent with FAR 12.211 and 12.212, Commercial Computer Software, Computer Software Documentation, and Technical Data for Commercial Items are licensed to the U.S. Government under vendor’s standard commercial license. Warranty The information contained herein is subject to change without notice.
Contents About This Document...................................................................................11 Supported Release Version Updates (RVUs)................................................................................11 Intended Audience..................................................................................................................11 Unsupported Utilities...............................................................................................................
OSS Filesets...........................................................................................................................30 Specifying Names With Pattern-Matching Characters .................................................................30 3 The OSS Shell..........................................................................................31 OSS Shell Features.................................................................................................................
Printing and Formatting ......................................................................................................63 Process Management.........................................................................................................63 Remote Access..................................................................................................................64 Search, Sort, Compare, and List...........................................................................................
Specifying Terminal Characteristics With the stty Command.........................................................88 Modifying Your Shell Environment.............................................................................................88 Managing the OSS Environment ..............................................................................................88 Backups............................................................................................................................
Changing Your Current Directory.......................................................................................114 Using Relative Pathname Notation......................................................................................115 Displaying Directories (ls -F)...................................................................................................116 Copying Directories (cp)........................................................................................................
12 Productivity Tools: grep and find.............................................................147 Searching Files for Text Patterns (grep).....................................................................................147 Using the -i Flag .............................................................................................................148 Extracting Lines and Saving Them in Another File ................................................................
Using the r (Read) Subcommand........................................................................................169 Displaying and Changing the Current Line...............................................................................170 Finding Your Position in the Buffer......................................................................................171 Changing Your Position in the Buffer...................................................................................171 Finding Text........
Figures 1 2 3 4 5 6 7 8 Manuals Related to the Open System Services User’s Guide..................................................18 OSS and Guardian Application and User Interfaces.............................................................23 A Typical OSS File System.................................................................................................27 Relative and Full Pathnames...............................................................................................
About This Document This user’s guide describes the HP NonStop™ Open System Services (OSS) user environment.
Acknowledgment The Portable Archive Interchange (pax) utility software was developed by Mark H. Colburn and is sponsored by the USENIX Association. ©1989 Mark H. Colburn. All rights reserved. The pax utility, distributed to HP free of charge, is used to support the tar, cpio, and pax user interfaces furnished with the OSS environment and is documented in this guide and the Open System Services Shell and Utilities Reference Manual.
• Added Secure SFTP transfer information to “The ftp Utility” (page 153). • Added the new “OSS Core Utilities User Commands” (page 185) appendix. New and Changed Information in the 522700-003 Edition The following information was added and changed for the J06.15 and H06.26 RVUs: • Added the OSS connect() function to “OSS Functions Audited When Used With Audited Filesets” (page 132) • Revised auditing information for the OSS sockets connect() function in “Considerations for File Auditing” (page 133).
Chapter 4: OSS Commands and Utilities This chapter lists and describes user commands and utilities. Chapter 5: Interoperability Between OSS and Guardian Environments This chapter discusses how to access the Guardian file system from within the OSS environment and how to use OSS commands in the Guardian environment. Chapter 6: Running the OSS Shell This chapter describes how to run the OSS shell using the osh command.
Computer Type Computer type letters indicate: • C and Open System Services (OSS) keywords, commands, and reserved words. Type these items exactly as shown. Items not enclosed in brackets are required. For example: Use the cextdecs.h header file. • Text displayed by the computer. For example: Last Logon: 14 May 2006, 08:02:23 • A listing of computer code.
M address [ , new-value ]… - ] {0|1|2|3|4|5|6|7|8|9}… An ellipsis immediately following a single syntax item indicates that you can repeat that syntax item any number of times. For example: "s-char…" Punctuation Parentheses, commas, semicolons, and other symbols not previously described must be typed as shown. For example: error := NEXTFILENAME ( file-name ) ; LISTOPENS SU $process-name.
[ ] Brackets Brackets enclose items that are sometimes, but not always, displayed. For example: Event number = number [ Subject = first-subject-value ] A group of items enclosed in brackets is a list of all possible items that can be displayed, of which one or none might actually be displayed. The items in the list can be arranged either vertically, with aligned brackets on each side of the list, or horizontally, enclosed in a pair of brackets and separated by vertical lines.
Figure 1 Manuals Related to the Open System Services User’s Guide Following are descriptions of related manuals: 18 • C/C++ Programmer’s Guide. This guide describes the HP implementation of the C and C++ programming languages. It discusses the C/C++ language syntax, the C/C++ compiler, and the C/C++ program execution environment. This guide is intended for system and application programmers writing programs for the Guardian and OSS environments. • Guardian Procedure Calls Reference Manual.
• Guardian TNS/R Native C Library Calls Reference Manual. This manual describes syntax and semantics of the C run-time library calls and header files for the Guardian environment. This manual is intended for system and application programmers. • Open System Services Library Calls Reference Manual. This manual describes syntax and semantics of the C run-time library calls and header files for the OSS environment. This manual is intended for system and application programmers.
Include the document title, part number, and any comment, error found, or suggestion for improvement you have concerning this document.
1 Introduction to Open System Services Open System Services (OSS) is the HP open computing interface to the NonStop operating system. The OSS environment coexists with the Guardian environment and provides a fully independent alternative to it. Open System Services interoperates with the NonStop operating system and makes use of many of its unique features, such as fault tolerance and parallel processing.
to the Guardian environment. The function of some OSS commands has been extended from ordinary UNIX usage to allow interoperability with the NonStop operating system. For more information about OSS commands and utilities, see Chapter 4 (page 53), the Open System Services Shell and Utilities Reference Manual, and the online reference pages. The OSS Utilities product (OSSUTIL – T8626 ) provides the essential OSS user commands and utilities. Beginning with the J06.14 and H06.
Figure 2 OSS and Guardian Application and User Interfaces Because of its interrelationship with the Guardian environment, from a user standpoint Open System Services can be viewed as: • An alternate interface to the NonStop operating system • A development environment for portable applications • An environment for porting applications to and from a NonStop system Alternative to Guardian Interface At the user and programmatic interface levels, Open System Services offers fully functional and independe
OSS Environment A typical NonStop system on which the OSS environment has been installed includes workstations connected to it by a local area network. While logged on to the NonStop system, users run Open System Services by issuing the osh command at the TACL prompt. For more details on system requirements and system configuration, refer to the Open System Services Installation Guide and the Open System Services Management and Operations Guide.
formats defined by the POSIX.1 standard; the shell and utilities defined by the POSIX.2 standard; plus additional commands, Internationalization (I18N), the ANSI C language and compiler, and other software features. XPG4 promotes communication between different kinds of applications and underlies the OSS and Guardian environment interoperability feature.
2 The OSS File System The OSS file system conforms to the POSIX standards and is therefore essentially the same as a UNIX file system. It is fundamentally different from the Guardian file system in several ways. The most apparent differences are the overall file-system structure and the file-naming rules.
OSS Directories and Subdirectories You can organize your files into groups and subgroups by placing them in directories. In addition, you can place directories within other directories. A directory that is held within another directory is known as a “subdirectory.” Directories that contain subdirectories are often called “parent directories.” The terms “directory” and “subdirectory” are frequently used interchangeably. They are almost invariably used relative to each other and to a pathname.
At the next level down from the root directory are nine directories, each with its own system of subdirectories and files. Figure 3 shows subdirectories and files only for the directory named /user. The other directories in the second level shown in Figure 3 are typical for an OSS file system (and many UNIX file systems). Most of them contain system files and directories. The third level of the structure in Figure 3 contains the home directories for two of the system’s users, /smith and /chang.
Relative Pathnames Relative pathnames do not begin with / (root). Instead they define a path that is relative to either the directory you are currently working in or your home directory. You can specify a relative pathname in one of four ways: • As the name of a file in the current directory. • As a pathname that begins with the name of a directory one level below your current directory. • As a pathname that begins with .. (dot dot, the relative pathname for the parent directory).
OSS Filesets The OSS file system consists of one or more filesets. Each fileset is a hierarchy of files—a set of directories, subdirectories, and files. In fact, the collection of directories and files under the root directory makes up one large fileset. Filesets are mounted and unmounted by the system administrator using the Subsystem Control Facility (SCF) commands START FILESET and STOP FILESET in the Guardian environment.
3 The OSS Shell The user interface in the OSS environment is called the OSS “shell.” The OSS shell is a program that interprets the commands you enter, runs the programs you ask for, and sends output to your screen. Open System Services supports the Korn shell (sh). The C shell is not supported by Open System Services; however, beginning with the J06.14 and H06.25 RVUs, the OSS Core Utilities product (T1202) provides the BASH (Bourne-Again SHell) shell.
Table 1 Selected OSS Shell Features (continued) Feature Description Parameter substitution A feature that allows user-assigned values to be passed to the shell and to variables in the command line. Command substitution A feature that allows you to use a command’s output as if it was the value of a variable. Signal trapping Mechanisms for trapping interruptions and other OSS signals. Conditional expressions A feature that allows values, attributes, and comparisons to be tested.
Table 2 Shell Metacharacters (continued) Metacharacter Description > Redirects output to a specified file. << Redirects input and specifies that the shell should read input up to a specified line. >> Redirects output to the end of a specified file. >& Redirects both diagnostic and standard output and appends them to a specified file. Expansion/Substitution ${.} Specifies variable substitution. % Specifies job number substitution. '.' Specifies command output substitution.
Table 3 Shell Built-In Commands (continued) Command Description kill(1) Sends a signal to a running process. (Both a regular form and a shell built-in form of kill are included with the OSS shell.) let(1) Presents authentic expressions for evaluation. print(1) Prints shell output. pwd(1) Displays the current directory pathname. (Both a regular form and a shell built-in form of pwd are included with the OSS shell.) read(1) Reads one line from standard input.
Command-Entry Aids The following shell command-entry aids are supported by the OSS shell: • “Using Multiple Commands and Command Lists ” • “Using Pipes and Filters ” • “Grouping Commands” • “Quoting” Using Multiple Commands and Command Lists The OSS shell usually takes the first string on a command line as the name of a command and any following strings as arguments to that command. That is, the shell usually considers each command line as a single command.
In the following example, the shell runs each command only if the previous command has executed successfully: $ cmd1 && cmd2 && cmd3 && cmd4 && cmd5 If cmd1 succeeds, the shell runs cmd2. If cmd2 succeeds, the shell runs cmd3, and so on through the series until a command fails or the last command has been run. (If any command fails, the shell stops executing the command line).
3. The output of grep r-x becomes the input to wc -l, which displays the number of files matching the grep criteria in the standard input file. To get the same results without using a pipeline, you would have to do the following: 1. Direct the output of ls -l /user to a file: $ ls -l >file1 2. Use file1 as input for grep r-x and redirect the output of grep to another file: $ grep r-x file1 > file2 3.
Quoting Reserved characters are characters such as < > |& ? and *. Reserved characters have special meanings to the shell. To use a reserved character literally (that is, without its special meaning to the shell), “quote” the character by using one of the shell-quoting conventions, as shown in Table 6. Table 6 Shell-Quoting Conventions Convention Description \ Backslash character. Quotes a single character. ' ' Single quotes. Quotes a string of characters (except the single quotation marks themselves).
more than one filename or pathname that matches the partial name you entered, the shell lists the possible matches. To activate the filename-completion mechanism, define the EDITOR variable in your .profile file. For example, if you wish to use the vi editor, enter the following variable definition in your .
Exporting Aliases The shell allows you to export the aliases you create. Aliases that are exported are passed to any subshells that are created so that when you execute a shell procedure or a new shell, the alias remains defined. (Variables that are not exported are used only by the current shell process, not by subshells.) You can export an alias by using the following command syntax: alias -x aliasname=command The -x flag specifies that you wish to export the alias.
reexecute them. This feature may save you time because it allows you to reuse long commands instead of reentering them. To view the contents of the history buffer, use the history command. The displayed output will be similar to the following (your output will vary): [18] $ history 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 ls -l pwd cd /usr/sales ls -l cp report report5 mv /usr/accounts/new . cd /usr/accounts/new mkdir june cd june mv /usr/accounts/new/june .
To display the command history buffer and edit its contents, use the built-in command fc (fix command). The fc command has two formats. The first format is as follows: fc [-e editor] [-nlr] [first] [last] This command format allows you to display and edit any number of command lines in your buffer. • The -e editor entry specifies the editor (usually vi) you wish to use in editing the command line. If you do not specify -e editor, the fc command displays the lines but does not allow you to edit them.
16 pwd 17 cd /u/ben/reports 18 more sales Editing and Executing Command Lines To display and edit command lines 15 through 18 with the vi editor, enter: $ fc -e vi 15 18 ls -la pwd cd /u/ben/reports more sales ~ ~ ~ ~ "/tmp/sh10268.3" 4 lines 40 characters After making your edits, write and exit the file with the vi :wq! command. The command lines in the file are then reexecuted.
A .profile file resides in each user’s home directory and contains information that affects only that individual user’s shell. The variables and user definitions in .profile are defined and maintained by each user. These environment variables are often called “local variables,” “local environment variables,” or “shell variables.” Table 8 lists the environment variables, except the localization environment variables, which are described in the Open System Services Management and Operations Guide.
Table 8 Variables (continued) Variable Description RANDOM Returns a random integer between 0 and 32767. Initialize by assigning a numeric value to RANDOM. REPLY Uses values set by the shell select function and by the read command when no arguments are supplied. SECONDS Returns the number of seconds the current shell process has been running. SHELL Specifies the pathname for the shell. (The default value is /bin/sh.) TERM Specifies the type of terminal you are using. (The default value is xterm.
Table 9 Default Environment Variables Variable Default Value (Applies Only to the /etc/profile File) COLUMNS Unspecified EDITOR Unspecified ENV Unspecified FCEDIT /bin/ed FPATH Unspecified HISTFILE Unspecified HISTSIZE Unspecified HOME Home directory of user (this value cannot be changed by the user) IFS Single space character LINES Unspecified PATH /bin:/bin/unsupported PS1 $pwd: PS2 > PS3 #? PS4 + SHELL /bin/sh TERM xterm TMOUT 0 UTILSGE Unspecified VISUAL Unspecif
Setting Variables on the Command Line To set a variable on the command line, simply enter an assignment statement. For example, you can create a variable called place by assigning it a value of U.S.A. with the following statement: $ place='U.S.A.' After entering this statement, you can use the variable place just as you would use its assigned value. To denote that an assigned variable is not a literal string, type a $ (dollar sign) in front of its name: $place. This is known as “parameter substitution.
$ . ./.profile Displaying the Values of Variables You can display the value of any variable currently set in your shell. To display the value of a single variable, use the echo command in the following general format: echo $variable The variable entry specifies the variable whose value you want displayed. For example, to display the value of the SHELL environment variable, enter: $ echo $SHELL /bin/sh To display the value of all currently set variables, use the set command without any options.
• Display of messages to your workstation • The trap command • Command aliases • History variables In the .profile file, an example of which is shown in Example 1, environment variables are set and exported, and shell variables are set. Table 10 explains each part of the file. The values in the following example .profile file (and its description) may differ from the values that are appropriate for your system and for your .profile file. Example 1 .
Table 10 Description of Example .profile File (continued) Line Description EDITOR=vi Specifies vi as the default editor for command-line editing at the shell prompt and for filename completion. FCEDIT=vi Specifies vi as the default editor for the fc command. PS1="'hostname' [!] $ " PS1 is the variable that specifies the shell prompt, and its default value is $.
the system administrator specifies default PATH directories for new users. However, more experienced users may need to change these PATH directories. The PATH variable contains a list of directories to search, each separated by a : (colon). The order in which the directories are listed is the search order that the shell uses to search for the commands that you enter. To determine the current value of PATH, use the echo command.
2. 3. Use the chmod +x command to give the file x (execute) status. For example, the command chmod g+x reserve gives execute status to the file reserve for any user in your group (g). See Chapter 10 (page 121), for more information on chmod. Run the procedure by simply entering its name. Enter the pathname if the procedure file is not in your current directory. The following is a simple shell procedure named lss that sorts ls -l command output by file size. Table 11 explains each line in lss.
4 OSS Commands and Utilities This chapter discusses the OSS end-user commands and utilities, file formats, and miscellaneous files. (Commands typically used only by system administrators are not discussed.) Also refer to the reference page for each command. For additional information on user commands and utilities, you may find one of the books on POSIX or UNIX commands, available at bookstores, helpful.
Utilities Reference Manual and in the online reference pages (sometimes called man pages). Each reference page documents a single command or utility. Beginning with the J06.14 and H06.25 RVUs, the OSS Core Utilities product (T1202) provides additional Open Source utilities. For information about the OSS Core Utilities, including how to view reference pages, see OSS Core Utilities User Commands (page 185).
returns the following: add_define(1) Creates one or more DEFINEs for the current OSS shell. del_define(1) Deletes one or more DEFINEs for the current OSS shell. more(1) Displays a file one screenful at a time. paste(1) Joins lines from one or more files. All the entries returned in this example contain the string more in either the name of the command or the description.
cal(1) Displays a calender. cancel(1) Removes job requests from the line printer spooling queue. cat(1) Concatenates or displays files. cd(1) Changes the current working directory. chgrp(1) Changes the group ownership of a file or directory. chmod(1) Changes permission codes. chown(1) Changes the owner of files or directories. cksum(1) Displays the checksum and byte count of a file. clear(1) Clears the terminal screen. cmp(1) Compares two files.
exit(1) Exits the shell (a shell built-in command). expand(1) Replaces tabs or space characters. export(1) Exports variables (a shell built-in command). expr(1) Evaluates arguments as expressions. false(1) Returns a nonzero exit value. fc(1) Lists, edits, and reexecutes commands previously entered in a shell (a shell built-in command). fg(1) Brings specified jobs to the foreground (a shell built-in command). fgrep(1) Searches a file for a pattern. file(1) Determines the file type.
localedef(1) Processes locale and character map files. logger(1) Makes entries in the system log. logname(1) Displays the user’s login name. lp(1) Sends files to a printer. lpstat(1) Displays line printer and print job status information. ls(1) Lists and generates statistics for files. make(1) Maintains program dependencies. man(1) Displays reference pages. mkcatdefs(1) Preprocesses a message source file. mkdir(1) Makes a new directory. mkfifo(1) Makes FIFO special files.
rmdir(1) Removes a directory. rsh(1) Executes the specified command remotely. run(1) Runs processes with Guardian attributes. runcat(1) Invokes the mkcatdefs utility and pipes the resulting message. runv(1) Runs a process in the Visual Inspect debugger. sed(1) Provides a stream-line editor. set(1) Sets shell parameters (a shell built-in command). set_define(1) Sets values for DEFINE attributes in the working attribute set (a shell built-in command).
uniq(1) Removes or lists repeated lines in a file. unpack(1) Expands files compressed by the pack command. unset(1) Erases parameter values (a shell built-in command). uudecode(1) Decodes a binary file. uuencode(1) Encodes a binary file. vi(1) Edits files (screen editor). vproc(1) Displays version information about commands and utilities. wait(1) Awaits process completion (a shell built-in command). wall(1) Sends a message to all users. wc(1) Counts lines, words, characters, and bytes.
strip(1) Removes unnecessary information from executable files. whatis(1) Describes a command’s function. Archiving Following is a list of OSS commands and utilities for archiving. ar(1) Creates and maintains archives and libraries. cpio(1) Copies files to and from archive storage. pax(1) Extracts, writes, and lists archive files. pinstall(1) Invokes a Guardian process that installs OSS files to an OSS file hierarchy (this is actually a TACL command). tar(1) Manipulates tape archives.
fold(1) Breaks lines in files. join(1) Joins the lines of two files. ln(1) Links files. ls(1) Lists and generates statistics for files. mkdir(1) Makes a new directory. mkfifo(1) Makes FIFO special files. mv(1) Moves files and directories. pack(1) Compresses files. paste(1) Joins lines from one or more files. patch(1) Applies changes to files. pathchk(1) Checks pathnames. pwd(1) Displays the current directory pathname. readonly(1) Marks specified names as read-only.
Printing and Formatting Following is a list of OSS commands and utilities for printing and formatting. cancel(1) Removes job requests from the line printer spooling queue. jobs(1) Lists information about printing jobs. kill(1) Removes printing jobs from the spooling queue. lp(1) Sends files to a printer. lpstat(1) Displays line printer and print job status information. print(1) Provides shell output. Process Management Following is a list of OSS commands and utilities for process management.
Remote Access Following is a list of OSS commands and utilities for remote access. ftp(1) Transfers files between a local OSS file system and a remote host. rsh(1) Executes a specified command remotely. telnet(1) Allows login to a remote host. Search, Sort, Compare, and List Following is a list of OSS commands and utilities for search, sort, compare, and list operations. apropos(1) Lists commands by keyword. awk(1) Manipulates text and matches patterns in files. cmp(1) Compares two files.
System Management and Configuration Information Following is a list of OSS commands and utilities for system management and configuration information. getconf(1) Displays system configuration variable values. hash(1) Affects the shell’s memory of the location of the utilities. localedef(1) Processes locale and character map files. set(1) Sets shell parameters. stty(1) Sets terminal characteristics. tty(1) Returns the pathname of a terminal device.
cd(1) Changes the current working directory. continue(1) Resumes the next iteration of an enclosing loop. del_define(1) Deletes one or more DEFINEs for the current OSS shell (a HP extension). echo(1) Writes its arguments to the standard output file. (Both a regular form and a shell built-in form of echo are included with Open System Services.) eval(1) Reads arguments and executes commands. exec(1) Executes a command. exit(1) Exits the shell. export(1) Exports variables.
wait(1) Awaits process completion. whence(1) Tells how a name would be interpreted if used as a command. Some shell built-in commands have counterparts that are regular OSS commands of the same names. The shell built-in version and the OSS version of a command might not behave in the same way or support the same flags. The shell built-in version is the default version.
5 Interoperability Between OSS and Guardian Environments On the user level, several types of interoperability between the OSS and Guardian environments exist: • Some OSS user commands issued from the OSS environment can act upon objects, such as files, in the Guardian environment. For example, you can use the OSS cp command to copy OSS files into the Guardian environment and to copy Guardian files into the OSS environment.
The Guardian file system is accessible from the OSS environment through the OSS /G directory for local files or the /E directory for files from remote nodes. Accessing Guardian Files From the OSS Environment Files in the Guardian file system are accessed from the OSS environment through the /G and /E directories, which are special directories in the OSS file system that serve as mount points for the Guardian file system. The /G Directory The OSS file system includes a special directory named /G.
NOE Causes the /E directory to be invisible to the specified command. NOG Causes the /G directory to be invisible to the specified command. NOG:NOE Causes both /E and /G directories to be invisible to the specified command. NOTE: The value NOE:NOG is not valid and is ignored. For example, enter the following command to specify that the Expand directory (/E) and the Guardian directory (/G) are to be invisible to the command chgrp. export UTILSGE=NOG:NOE chgrp -R SUPER.
The /E indicates that what follows is an Expand filename. The /G indicates that what follows is a Guardian filename. Note that the $ (dollar sign) is omitted from the volume name. When the system encounters one of these OSS pathnames, it converts the name to a Guardian filename using the following conventions: • /E/nodename is converted to \nodename. • The /G/ is replaced by a $ (dollar sign). • The / (slash) preceding fileid is interpreted as a . (period).
Guardian Filename OSS Pathname $P.#pty12 /G/p/#pty12 \node1.$vol.subvol.file /E/node1/G/vol/subvol/file The $ (dollar sign) in front of the volume name is not retained. Pathname Mapping Because of differences between OSS pathnames and Guardian filenames, each OSS file is assigned an underlying Guardian filename in addition to its OSS name. The Guardian names for OSS files are based on each file’s inode number. These names serve as Guardian identifiers to the OSS files.
gtacl -c 'fup dup subvolume.filename, newsubvolume.filename' To get information about a Guardian subvolume, at the OSS prompt enter: gtacl -p 'fup info \systemname.$volumename.subvolume.*' The gtacl command, its syntax, and its options are fully documented in the gtacl(1) reference page either online or in the Open System Services Shell and Utilities Reference Manual.
For more information on the run command, see the run(1) reference page either online or in the Open System Services Shell and Utilities Reference Manual. Editing Files The primary OSS text editor is the vi editor (described in Appendix A (page 155)). The Guardian text editor is TEDIT. While neither editor can be used directly to edit files in the opposite environment, they can be used indirectly and with limitations. It is always best to edit files with native text editors in their native environment.
You can try these (and the other) OSS commands within the Guardian environment, using the examples that follow as models. However, your results can vary from command to command depending on the flags you use, the objects you use the commands against, and whether you run the command from within the OSS environment or the Guardian environment (using osh). Printing and Spooler Commands OSS files are spooled to a printer through the Guardian environment. However, this is not apparent to the OSS user.
This command gets information about a Guardian subvolume. The shell quotes preserve special characters for interpretation by the Guardian process The gtacl command, its syntax, and its options are fully documented in the gtacl(1) reference page either online or in the Open System Services Shell and Utilities Reference Manual.
ps -W name=/G/cmon results in a display of information on the Guardian process named $cmon similar to the following: PROCESS BK /G/cmon CPU,PIN GPRI PFR %WT USERID PROGRAMFILE HOMETERM 0,51 170 P 001 255,255 /G/system/ /G/osp cmon/cmon To display information on all processes running in the Guardian environment, enter: ps -W node=systemname,all run Command With the run command you can start OSS programs with Guardian attributes.
Guardian Commands and OSS Equivalents Table 12 lists Guardian commands and their OSS equivalents. Not all Guardian commands have a corresponding OSS command, and not all OSS commands have a Guardian equivalent. For this reason, not all Guardian and OSS commands appear in the table. NOTE: Information in brackets ([ ]) indicates a series of command steps. Table 12 OSS Equivalents to Guardian Commands 78 Guardian Command Description ADD DEFINE Adds a named set of attributes and values.
Table 12 OSS Equivalents to Guardian Commands (continued) Guardian Command Description OSS Equivalent FUP PURGE Deletes a file. rm FUP RENAME Renames a file. mv FUP SECURE Changes a file’s access security. chmod HELP Provides information about the command interpreter. man HISTORY Displays previously issued commands. fc HOME Specifies where the command interpreter looks for VARs. env INFO DEFINE Displays attributes of the current command info_define interpreter process.
Table 12 OSS Equivalents to Guardian Commands (continued) Guardian Command Description OSS Equivalent STATUS Displays status of running processes. ps STOP Stops and deletes a process. kill SUSPEND Prevents a process from running until reactivated. ^Z, kill SYSTEM Sets the default system. None TACL Starts a command interpreter process. sh MEDIACOM Manages labeled tapes. None TEDIT Provides a full-screen editor. vi TGAL Provides a simple text formatter.
Table 13 Guardian Equivalents to OSS Commands (continued) OSS Command Description Guardian Equivalent c89 Compiles native mode C and C++ programs. • NMC for native mode C programs • NMCPLUS for C++ programs • CCOMP for TNS/E C programs • CPPCOMP for TNS/E C++ programs /nonnative/bin/c89 Compiles TNS C programs. C cancel Cancels line printer requests. PERUSE, JOB, DEL cat Concatenates and prints files. FUP DUP, FUP COPY cd Changes the working directory.
Table 13 Guardian Equivalents to OSS Commands (continued) 82 OSS Command Description Guardian Equivalent gencat Generates a formatted message catalog. None getconf Gets configuration values. None getopts Parses utility options. None grep Searches a file for a pattern. LOCATE head Copies the first part of files. FUP COPY FIRST iconv Provides codeset conversion. None id Returns the user identity. WHO, #username, #userid join Provides a relational database operator.
Table 13 Guardian Equivalents to OSS Commands (continued) OSS Command Description Guardian Equivalent rm Removes directory entries. PURGE rmdir Removes directories. PURGE run -debug High-level debugger for TNS/E programs. EINSPECT sed Provides a stream editor, which executes script commands in a file. OBEY sh Invokes the shell, a standard command TACL language interpreter. sleep Suspends execution for an interval. sort Sorts, merges, or sequence-checks text SORT files.
Table 13 Guardian Equivalents to OSS Commands (continued) 84 OSS Command Description xargs Constructs an argument list and invokes None a utility. yacc Invokes “yet another compiler compiler.
6 Running the OSS Shell A typical OSS environment includes a NonStop system running the NonStop operating system. Most frequently, users are working at a PC-compatible workstation or a UNIX workstation connected to the NonStop system by a LAN. In this type of arrangement, running Open System Services is a matter of starting a TELNET session from the workstation, logging on to the NonStop system, and then running Open System Services by issuing the OSS osh command from the TACL prompt.
If you do not have a password or if you want to change your password, use the PASSWORD utility. A password can contain from one to eight letters, numbers, or other characters, but no blank spaces.
Flag Explanation -debug Starts a Guardian environment debugging tool. -defmode on | off Specifies the Guardian DEFINE mode for the child process. -extswap pathname Specifies a Guardian swap file or volume for the extended data segment of the child process. -gpri n Assigns the initial Guardian execution priority n (1-199) to the child process. The value 1 is the lowest priority; the value 199 is the highest priority. The default priority is the priority used for osh.
exit This will return you to your TACL prompt. To log off from the TACL session, at the TACL prompt enter: logoff End the TELNET session. If necessary, refer to the instructions provided by the emulation software manufacturer. Specifying Terminal Characteristics With the stty Command The stty command sets or reports on terminal I/O characteristics for the device that provides its standard input information.
Backups Backups are done using the pax utility. The backup process for an OSS system is described in the Open System Services Management and Operations Guide. Information on pax also appears in Chapter 13 (page 151). Mounting and Unmounting Filesets Mounting and unmounting filesets (making one or more OSS filesets available to other OSS file systems) are performed by the system administrator using the OSS Monitor.
7 Creating Files This chapter begins the tutorial part of this guide, where you are introduced to many of the frequently used OSS user commands and utilities, in a tutorial format. Introduction to the Tutorials and Examples The examples and lessons in this chapter and the sections that follow build upon each other, so starting with this chapter, you should work through each chapter sequentially, performing the examples in the order in which they are given.
Two text editing programs are available with Open System Services: vi and ed. Each has its own methods of displaying text, as well as its own set of subcommands and usage rules. Your editing takes place in an edit buffer that you can save or discard. For more information on vi, see Appendix A (page 155). For more information on ed, see Appendix B (page 166). Commercially available books on vi and ed can also be helpful. Beginning with the J06.14 and H06.
4. Close the file file1 by pressing the Esc key (to exit from insert mode) and then typing a : (colon) followed by the letter w and pressing Return (:w ). The w instructs the OSS system to write (save) a copy of the file. Your screen should look like the following: You start the vi program by entering the command vi, optionally followed by the name of a new or existing file.
8 Managing Files This chapter discusses how to manage OSS files. After reading this chapter, you will be able to: • List files • Display and print files • Copy, rename, and move files • Compare and sort files • Remove files from the system • Link files • Determine file type A good way to learn about managing OSS files is to try the examples in this chapter. Do the examples in the order given so that the information on your screen is consistent with the text.
You can also list individual files and subdirectories in your current directory using the command format: ls filename The filename entry can be the name of a file or a list of filenames separated by spaces. You can also use pattern-matching characters to specify files. See Chapter 3 (page 31), for information on pattern matching.
The following example shows a long (-l flag) listing of a current directory. (The name larry is the owner of the files. Your user name will replace larry on your screen.) $ ls -l total 4 -rw-r--r-- 1 larry system 101 Jun 5 10:03 file1 -rw-r--r-- 1 larry system 75 Jun 5 10:03 file2 -rw-r--r-- 1 larry system 65 Jun 5 10:06 file3 drwxr-xr-x 2 larry system 32 Jun 5 10:07 project Table 15 explains the information displayed on your screen by the ls -l command.
The general format of more and cat is the following: command filename The command entry is either more or cat. The filename entry can be the name of one file or a series of filenames separated by spaces. You can also use pattern-matching characters to specify your files. For more information on pattern-matching characters, see Chapter 3 (page 31). The more Command The more command displays text files one screenful at a time.
to take the output from the pr command and use it as input to the more command. For more information on pipes, see Chapter 3 (page 31). Sometimes you may prefer to display a file in a more sophisticated format. You can use a number of flags in the pr command to specify additional formatting features. Table 16 explains several of these flags. Table 16 The pr Command Flags Flag Description +page Begins formatting on page number page; otherwise, formatting begins on page 1.
Printing Files The OSS print utilities include three utilities: lp, lpstat, and cancel. The lp utility sends the print job requests to the Guardian spooler. The lpstat utility shows the status of the online printer devices and the job requests. The cancel utility removes a print job from the spooler print queue and stops it from being printed. The lp utility is an interface layer between an OSS process and the Guardian spooler subsystem.
The lpstat utility writes, to the standard output device, information about the current status of the online accessible printer devices and the status of the spooler job requests. If no spooler location is given, lpstat generally uses the system default destination, as specified in the printcap database file. If no arguments are given, lpstat writes the status of all the job requests made to lp by the user that are still in the spooler queue.
If your request has already been printed, or if there are no requests in the print queue, the system responds with the following message: No spooler jobs are found. If there are entries in the print queue, the system lists them and indicates which request is currently being printed. Following is a typical listing of print queue entries (your listing will vary): Job State Owner Pages Copies Pri/Hold Location Report 253 Print 8,68 13 1 4 #Printer1 qa.
The general format of the cp command is: cp source destination source is the name of the file to be copied, destination is the name of the file to which you want to copy source. source and destination can be filenames in your current directory or pathnames to different directories. source can also be a series of one or more filenames, in which case destination must be a pathname that ends with the name of the target directory.
$ ls reports file2 file3 Note that you do not have to specify file2 and file3 as part of dirname. This is because the files being copied are retaining their original filenames. You can use pattern-matching characters when specifying files to be copied. For example, to copy file1, file2, file2x, and file3 into /reports, you can use the following command: cp file* reports.
NOTE: For the following RVUs, the mv command fails with error “Guardian or User Defined Error 197” if a remote user attempts to move an SQL object that is in the OSS file system and the file is present in the destination directory. • All G-series RVUs • H-series RVUs prior to H06.23 • J-series RVUs prior to J06.12 To move this type of file on systems running the above RVUs, a local user must execute the mv command. Renaming Files You can use the mv command to rename files.
$ ls file1 file3 newfile project reports Finally, list the contents of the /reports directory to verify that the command has moved the file there: $ ls reports file2 file3 notes You can use pattern-matching characters to move files.
The actual differing lines then follow. In the leftmost column, < (left angle bracket) indicates lines from file1 and > (right angle bracket) indicates lines from file2.
The filename entry can be the name of the file, the relative pathname of the file, the absolute pathname of the file, or a list of filenames separated by spaces. You can also use pattern-matching characters to specify files. A good example of what the sort command can do for you is to sort a list of names and put them in collated order as defined by your current locale. For example, assume that you have lists of names that are contained in three files: list1, list2, and list3.
Removing a Single File In the following example, you remove the file called file1 from your home directory. If you aren’t already in your home directory, return to it using the cd (change directory) command. Enter the pwd (print working directory) command to verify that your home directory is your current directory, and then list its contents. Remember that the system substitutes the name of your home directory for the notation /u/uname in the example.
$ rm -i record? Before removing each file, the system prompts you, and with a y or n response to the prompt, you can tell the system whether to remove each file: rm: remove record1? n rm: remove record2? y rm: remove record3? y rm: remove record4? y rm: remove record5? y rm: remove record6? n In this example, all files except record1 and record6 are removed.
a single disk partition. (A disk partition is a physical disk, or a portion of one, that has been prepared to contain file directories.) Using Links To link files in the same file system, use the following command format: ln /dirname1/filename1 /dirname2/filename2 The /dirname1/filename1 entry is the pathname of an existing file. The /dirname2/filename2 entry is the pathname of a new filename to be linked to the existing /dirname1/filename1.
Removing Links Files are removed (deleted) with the rm (remove file) command. When a file is linked to more than one filename—that is, when several names refer to the same inode-number—the rm command removes the link between the inode-number and that filename but leaves the physical file intact. The rm command actually removes a physical file only after it has removed the last link between that file and a filename, as shown in Figure 5.
The third field for each entry, the number to the left of the user name, represents the number of links to that inode-number. Notice that file3 and checkfile have the same i-number, 1079, and that both show two links. Each time the rm command removes a filename, it reduces the number of links to that inode-number by one. In the following example, use the rm command to remove the filename checkfile: $ rm checkfile Now, list the contents of the directory with the ls -il command.
Note that the file command has identified file1, file2, and file3 as ASCII text files and project and reports as directories. NOTE: For ASCII text files, the file command returns either ascii text or English text. For more information on the file command, see the file(1) reference page either online or in the Open System Services Shell and Utilities Reference Manual.
9 Managing Directories This chapter describes how to manage OSS directories. After completing this chapter, you will be able to: • Create directories • Change directories • Display, copy, and rename directories • Remove directories A good way to learn about managing directories is to try the examples in this chapter. Be sure to do the examples in the order given.
Note that in the file structure in Figure 6, the /project, /project2, and /reports directories are located one level below your home directory and that the /status directory is located one level below the /reports directory. Figure 6 Example File Structure As for filenames, the maximum length of a directory name is 248 bytes (the default length).
$ pwd /u/uname/project2 $ cd To change your current directory to the /status directory, enter the cd command with the relative pathname, as follows: $ cd reports/status $ pwd /u/uname/reports/status Using Relative Pathname Notation You can use the following relative pathname notation to change directories quickly: • Dot notation (. and ..) • Tilde notation (~) Every directory contains at least two entries represented by . (dot) and .. (dot dot).
$ pwd /u/uname To move up the directory structure more than one level, you can use a series of relative directory names, as shown in the following example. The response to the following pwd command, the / (slash) entry, represents the parent directory of your home directory. $ cd ../.. $ pwd / You can use ~ (tilde) to specify a user’s home directory.
Copying Directories (cp) You can use the cp command with the -r flag to copy directories and directory trees to another part of the file system. The cp -r command has the following format: cp -r source destination The source entry is the name of the directory to be copied. The destination entry is the name of the directory location to which you want to copy source. Figure 7 shows how the cp -r command in the following example copies the directory tree /reports into the directory /project2.
Removing Directories (rmdir) When you no longer need a particular directory, you can remove it from the file system with the rmdir (remove directory) command. This command removes only empty directories; that is, only directories that contain no files or subdirectories. For information about removing files from directories, see “Removing Files and Directories Simultaneously (rm -r) ” (page 119) and Chapter 8 (page 93). You cannot remove a directory while it is your current directory.
costs tasks The /project2 directory still contains three subdirectories: /costs, /reports, and /tasks. You can remove these directories by using pattern-matching characters if you wish. Once these subdirectories are removed, you can delete the /project2 directory, as described in “Removing Your Current Directory ” (page 119). Removing Multiple Directories You can remove more than one directory at a time with the rmdir command by using pattern-matching characters.
rm -ri pathname When you enter the command in this form, you are prompted for verification before each file or directory is removed. By answering y (yes) or n (no) in response to the prompt, you control the actual removal of a file or directory. Be aware that when using the rm -r command to remove files or directories in the root directory, the /E and /G directories are, by default, also removed.
10 Managing Access to Files and Directories This chapter describes how to control access to your files and directories. After reading this chapter, you will be able to do the following: • Understand file and directory permissions • Display and set file and directory permissions • Change owners and groups • Understand file auditing A good way to learn about managing directories is to try the examples in this chapter. You should do each example in the order given.
The user/owner of a file or directory is generally the person who created it. If you are the owner of a file, you can change the file permissions with the chmod command, which is described in “Setting File and Directory Permissions (chmod)” (page 124). The group specifies the group to which the file belongs. If you are the owner of a file, you can change the group ID of the file with the chgrp command, which is described in “Changing Owners and Groups” (page 130). “Others” are all other users on the system.
Figure 8 File and Directory Permission Fields Default Permissions When you create a file or directory, the system automatically supplies a predetermined permission code. A typical file permission code is: -rw-r--r-- This file permission code specifies that the owner has read and write permissions but not execute permission, while the group and all others have read permission but not write or execute permission.
-rw-r--r-- 1 larry system 0 Jun 5 11:03 record1 -rw-r--r-- 1 larry system 0 Jun 5 11:03 record6 drwxr-xr-x 2 larry system 32 Jun 5 10:31 reports The first string of each entry in the directory shows the permission code for that file or directory. For example, the fourth entry, drwxr-xr-x, shows the following: • This is a directory (the d notation). • The owner can view it, write in it, and search it (the rwx sequence).
the file or files whose permissions you want to change. You can also use pattern-matching characters to specify files.
Changing Directory Permissions The procedure for changing directory permissions is the same as that for changing file permissions.
You can also use an absolute assignment to remove permissions. In the following example, the command chmod a=rw file3 assigns read (r) and write (w) permission and removes the execute permission (x) for all groups (a) from the file file3: $ chmod a=rw file3 $ ls -l file3 -rw-rw-rw- 1 larry system 130 Jun 5 10:06 file3 Specifying Permissions With Octal Numbers You can use octal numbers to change file and directory permissions.
The entire permission code for a file or directory is specified with a four-digit octal number, one digit each for owner, group, and others, and one digit (leftmost) for the setuid, setgid, and sticky bits (you can omit leading zeros). Table 20 shows some typical octal permission codes and how they relate to the permission fields.
2=no write permission 1=no execute permission 0=read,write, and execute permission Table 21 lists the eight possible octal values for each position of octalnumber for umask. Note that the umask permission values are the inverse of those specified for regular permission codes. Also note that these permission values are applied to those set by the creating program.
read and execute permissions. However, because you have previously set a user mask of 037, that further restricts the file permissions. As a result, the owner still has all permissions, but the group cannot execute the file and all others have no permissions. You can activate the umask command in two ways: • Include it in your .profile file. This is the most common and efficient way to specify your user mask, because the specified value is set automatically for you whenever you run osh.
The owner entry is the user name of the new owner of the file. The filename entry is a list of one or more files whose ownership you want to change. You can also use pattern-matching characters to specify files. Enter the chgrp command in the following form: chgrp group filename The group entry is the group ID or group name of the new group. Note that to change the group ownership of a file, you must be a member of the group to which you are changing the file.
Manipulating an audited Guardian file through OSS function calls and the /G directory also causes log entries; the information logged for Guardian files is controlled by Guardian auditing policies rather than by membership in an audited fileset. Similarly, manipulation of Guardian files through Guardian procedure calls from an OSS program can be audited through Guardian policies, which are not discussed in this guide.
Table 22 OSS Functions Audited When Used With Audited Filesets (continued) OSS Function Attributes or Actions Audited symlink() The contents of the symbolic link and the value of the file mode, OSS user ID, group ID, and rdev. tdm_execve(), tdm_execvpe() The process name and the value of the OSS user ID and group ID. Use on files in the /G directory is also audited. tdm_fork() The process name and the value of the OSS user ID and group ID.
Additional Security Considerations The security guidelines enforced at your site protect your files from unauthorized access.
11 Managing Processes This chapter discusses OSS processes. After completing this chapter, you will be able to do the following: • Understand OSS programs and processes • Redirect process input, output, and errors • Run processes in the foreground and background • Check the status of processes • Cancel processes • Display information about users and their processes • Schedule jobs A good way to learn about these topics is to try the examples in this chapter.
Table 25 Shell Notation for Redirecting Input and Output Notation Description Example < Reads standard input messages from a file. wc Writes standard output messages to a file. ls >file3 >> Adds standard output messages to the end of a ls >>file3 file. The following subsections describe how to read input from a file and how to write output to a file.
$ ls >> file If file does not exist, the shell creates it. Redirecting Standard Error Messages to a File When a command executes successfully, it displays the results on the standard output file. When a command executes unsuccessfully, it displays error messages on the default standard error file: the screen. However, the shell allows you to redirect the standard error file of a process from the screen to a file.
the shell to write the standard error output (file descriptor 2) to the file associated with the standard output file (>&1), outfile. Running Several Processes Simultaneously Open System Services can run a number of different processes at the same time. To make optimum use of this capability, you’ll want to execute some commands as foreground processes and others as background processes.
$ find / -type f -print > dirpaths & [1] 24 When the background process starts, the system assigns it a job number and a process ID and displays them. In this example, [1] is the job number and 24 is the process ID. (Your process ID will be different from the one shown in this and following examples.) You can then check the status of the process with the jobs command. You can also terminate a process with the kill command.
You can also check the status of a particular process by using the -p flag and the process ID with the ps command. The general format for checking the status of a particular process is the following: ps -pprocess_ID The ps command also displays the status of background processes. If there are any background processes running, they are displayed along with the foreground processes.
57618 #ptmy11a 00:00 /bin/-sh 46150 #ptmykzh 00:00 vi 57570 #ptmy110 00:00 85419 #ptmy110 00:00 Generally, the simple ps command described here tells you what you need to know about processes. However, you can control the type of information that the ps command displays by using more of its flags. One of the most useful ps flags is -e, which causes ps to return information about all processes, not just those associated with your workstation.
The general format for terminating a process is as follows: kill process_ID If you wish to end all the processes you have started since starting Open System Services, use the kill 0 command. You do not have to know the process IDs to use kill 0. Because this command deletes all of your processes, use it with care. The following example shows how to start another find process, check its status, and then terminate it with the kill command.
MANUALS.RICK /G/ztnt/#pty003e Oct 19 15:12 Note that the who command lists the user name of each user on the system, the system being used, and the time each user logged on. The who -u command gives all the information of the who command and also displays the process ID of each user and the number of hours and minutes there was activity at each workstation. Activity for less than a minute is indicated by a dot (.).
lp outfile 127448228.a Alternatively, you can submit multiple commands by entering the commands into a file and specifying the filename on the at command. Use an editor, such as vi, to create the file with one command on each line. For example, assume that filea contains the following: c89 sfile.c -o bfile bfile p1 p2 outfile lp outfile The following at command schedules these commands for execution at 10:00 a.m.: $ at 1000 filea 127448231.
where job-numbers is one or more assigned job numbers assigned by at. For example, the following command cancels three jobs: $ at -r 127448231.a 127448246.a 127451526.a Job Scheduling Using the batch Command The batch command is actually a special form of the at command that submits a job to a special batch input queue that is executed at a time when the level of system activity allows. The batch command reads the commands to be executed from the standard input file (the terminal).
• month is the month of the year (1 through 12) of execution. • weekday is the day of the week (0 through 6 for Sunday through Saturday) of execution. • command is the command to be executed.
12 Productivity Tools: grep and find This chapter describes two utilities that help you work with files. After completing this chapter, you will be able to do the following: • Use the grep command to search files • Use the find command to locate files Both the grep and find utilities provide extensive functions. This chapter does not provide detailed discussions of these utilities. Instead, it provides a few examples that are likely to assist general users.
$ grep "Mario Garcia" emp* empad: Mario Garcia X3871 As a result of the preceding grep command, you have learned that Mario Garcia is in the Advertising Department (empad) and that he can be reached at extension 3871. You can also use a number of flags in the grep command to specify additional features. Table 26 explains several of these flags. Table 26 The grep Command Flags Flag Description -c Displays the filename and the number of matching lines.
Deleting Lines and Saving the Output in Another File Suppose that you maintain a file that lists everyone in your company by medical insurance carrier. You have been asked to produce a list of everyone not insured by Acme Insurance.
/usr/chang/reports96 /usr/chang/reports96/reportjan /usr/chang/reports96/reportjan.tmp /usr/chang/reports96/reportmay /usr/chang/reports96/reportmay.tmp /usr/chang/reports96/reportsept /usr/chang/reports96/reportdec /usr/chang/reports97 /usr/chang/reports97/reportjan /usr/chang/reports97/reportmay /usr/chang/reports97/reportsept /usr/chang/reports97/reportsept.tmp /usr/chang/reports97/reportdec /usr/chang/reports98 /usr/chang/reports98/reportjan /usr/chang/reports98/reportmay /usr/chang/reports98/reportmay.
13 Transferring and Archiving Files There are several utilities for copying, moving, and transferring files between the OSS and Guardian environments. For simply copying and moving files and directories between the Guardian and OSS environments, the OSS cp (copy) and mv (move) commands may be easiest. NOTE: The mv command fails with error "Guardian or User Defined Error 197" if a remote user attempts to move an SQL object that is in the OSS file system and the file is present in the destination directory.
behave the same as UNIX tape devices. The interaction between the tape process and tape device is transparent to the pax user. If the -W wait flag appears, pax first issues a mount request to the Guardian tape process and then prints the following tape mount message to the terminal (/dev/tty): Device not ready or tape is not mounted? If the -W wait flag does not appear, pax is in a wait state until an unlabeled tape has been mounted on the tape drive correctly.
Restoring Files From a Tape to the Guardian Environment To restore files from the tape mounted on $TAPE to the Guardian target $VOL.SUBVOL, extracting only the .c files and overwriting any existing Guardian files with the same name, enter the following: $ cd /G/vol/subvol $ PAX -rv -f /G/tape -W clobber *.c The -r flag reads an archive file from the standard input file. The -v flag in list mode produces a verbose table of contents. Otherwise, it writes archive member pathnames to the standard error file.
If ftp finds a $HOME/.netrc autologin entry for the specified host, ftp attempts to use the information in that entry to automatically log in to the remote host. The ftp command also loads any command macros defined in the entry. In some cases (for example, when the required password is not listed in an autologin entry), ftp prompts for the password before displaying the ftp> prompt. Once ftp completes the autologin process, ftp executes the init macro if the macro is defined in the autologin entry.
A The vi Editor The vi text editor is well suited for the day-to-day editing tasks of most computer users. Using vi, you can quickly and easily open a file, edit it, and save the results. The vi editor operates basically the same way on all UNIX systems, so if you’ve used vi on a UNIX system, you should be able to immediately start using vi in the OSS environment.
also result in certain vi command keys not functioning properly. However, you can take the following steps to ensure the correct behavior of vi: • Start the terminal session in the appropriate emulation mode. • Create a .exrc file in your home directory containing customized key mappings. Setting Terminal Emulation Mode The method for setting the terminal emulation mode depends on the emulation program you are using.
Example 2 Sample .
You should see the text of your sample file at the top of the screen and a number of lines following it that begin with a ~ (tilde). The lines beginning with tildes are the remaining blank lines on your screen. The line at the very bottom of the screen shows the name of the file, the number of lines in the file, and the number of characters. To quit vi at this point, enter: :q Exiting vi is described in “Finishing Your Edit Session” (page 160). Moving Within the File If you have closed my.
Add the word “new” just before the word “text” in the first line in the file: First, move the cursor to the t in “text.” Then, enter input mode by typing: I Next, enter the word “new,” plus a space character: new Now exit input mode by pressing: The cursor should now be on the space between the words “new” and “text.” The i command starts inserting text before the character that the cursor is on. To insert text after the character the cursor is on, use the a command.
general form to move the cursor in larger steps. For example, to move the cursor forward five words, enter: 5w Deleting Multiple Words Using the general form described earlier, you can delete the last five words in my.file by moving to the beginning of the last line and entering: 5dw Note that it takes five words to delete the whole line, rather than four. This is because the trailing period counts as a word. The dd command deletes an entire line of text.
Searching for Strings Use the / command to search for strings of characters in a file. To try the / command, first move to the top of the my.file file. Then type / followed by the string “th” and press Return as follows: /th As soon as you enter /, it will be displayed on the bottom of the screen. As you type the string “th”, it will be echoed at the bottom of the screen. You can press Backspace to fix mistakes as you type the search string.
Other vi Features You may want to try some of the other features of vi. The reference page for vi lists its available commands. You may want to pay particular attention to the following: J Joins the following line to the current line. . Repeats the last command. s Substitutes the current character with the following entered text. x Deletes the current character. ~ Changes the alphabetic case of the current character.
The vi command : prompts for an ex command. This substitution command is applied to all lines in the file by the % address. The / (slash) is used as a separator. (Any other character can be used.) The g flag at the end of the command causes the substitution to occur on each instance of the pattern within each line. Without the g flag, substitution occurs only once on each line. You should be careful when making substitutions to ensure that you get what you want.
:1,3w my.new.file Deleting a Block of Text The delete command in ex is d, just as in vi. To delete from the current line to the end of the file, use the following command: :.,$d Moving and Copying Blocks of Text The ex command d saves the deleted text to the same paste buffer as the vi command. You can also use the ex copy command ya (for yank) and the paste command pu (for put) to copy and paste text.
you enter vi or ex. In this file, you do not need to use the vi command :, because these commands are read directly by the underlying ex editor. For example, to customize your environment to always display line numbers for your files, to use the map sequence shown in the previous subsection, and to set an automatic right margin of five spaces, you would open the .
B The ed Editor This appendix explains how to create, edit, display, and save text files using the ed editor, a line-editing program. A good way to learn how ed works is to try the examples in this appendix on your system. Because the examples build upon each other, it is important for you to work through them in sequence. Also, to make what you see on the screen consistent with what you see in this guide, it is important to do the examples just as they are given.
a The only way to stop appending is to type a line that contains only a period. . If you stop adding text to the buffer and then decide you want to add some more, enter another a subcommand. Type the text and then enter a period at the start of a new line to stop adding text to the buffer. If you make errors as you type your text, you can correct them before you press Return. Press the Backspace key to erase the incorrect characters. Then type the correct characters in their place.
NOTE: The u (undo) subcommand restores the buffer to the state it was in before it was last modified by an ed subcommand. The subcommands that u can reverse are a, c, d, g, G, i, j, m, r, s, t, v, and V. Saving Text Under a Different Filename If you have followed the previous examples, you have a file named afile that contains the original text of your document.
e filename This command loads the file filename into the buffer, erasing any previous contents of the buffer. nr filename This command reads the named file into the buffer after line n. If you do not specify n, ed adds the file to the end of the buffer. Using the ed (Edit) Command To load a file into the edit buffer when you start the ed program, simply type the name of the file after the ed command.
then renumbers all the lines in the buffer. If you do not use a line number, the r subcommand adds the new file to the end of the buffer’s contents. The following example shows how to use the r subcommand with a line number: 1,$p The only way to stop appending is to type a line that contains only a period. 3r cfile 44 1,$p The only way to stop appending is to type a line that contains only The only way to stop appending is to type a period. The 1,$p subcommand displays the four lines of afile.
Finding Your Position in the Buffer When you first load a file into the buffer, the last line of the file is the current line. As you work with the file, you usually change the current line many times. You can display the current line or its line number at any time. To display the current line, enter p: p a period. The p subcommand displays the current line (“a period.”). Because the current line has not been changed since you read afile into the buffer, the current line is the last line of the buffer.
The only way to stop ? When you try to move beyond the first line in the buffer, you receive the ? message. You cannot move beyond the top of the buffer. To move the current line forward through the buffer more than one line at a time, enter .n (where n is the number of lines you want to move): .2 line that contains only Note that .2 is an abbreviation for .+2. To move the current line backward through the buffer more than one line at a time, enter: .-n (where n is the number of lines you want to move): .
The context search begins on the first line before the current line and locates the first line that contains the string appending. That line becomes the current line. If ed searches the entire buffer without finding the string, it stops the search at the current line and displays the message ?. Once you have searched backward for a string, you can search backward for the same string again by entering just ??.
where n is the number of the line on which the substitution is to be made. In the following example, the s subcommand moves to line number 1, replaces the string “stop” with the string “quit”, and displays the new line: 1s/stop/quit/p The only way to quit The s subcommand changes only the first occurrence of the string on a given line. To learn how to change all occurrences of a string on the line, see “Substituting Every Occurrence of a String” (page 174).
Substituting at the Beginning or End of a Line Two special characters let you make substitutions at the beginning or end of a line: ^ (circumflex) Makes a substitution at the beginning of the line. $ (dollar sign) Makes a substitution at the end of the line. (In this context, the $ character does not stand for the last line in the buffer.) To make a substitution at the beginning of a line, use the s/^/newstring subcommand.
nd • To delete lines numbered n through m from the buffer, enter: n,md Deleting the Current Line If you want to delete the current line, simply enter d. In the following example, the 1,$p subcommand displays the entire contents of the buffer, and the $ subcommand makes the last line of the buffer the current line: 1,$p Remember, the only way to quit adding is to type a line that contains only a period. Then press Enter. $ a period. Then press Enter.
In the following example, the 1,2m4 subcommand moves the first two lines of the buffer to the position following line 4: 1,2m4 1,$p line that contains only a period. The only way to stop appending is to type a The 1,$p subcommand displays the contents of the buffer, showing that the move is complete. To move a group of lines to the top of the buffer, use 0 (zero) as the line number for the line to follow.
The only way to stop appending new material is to use the proper keys to create a a period. The period on a line by itself stops ed from adding text to the buffer. The 1,$p subcommand displays the entire contents of the buffer, showing that the change was made. Changing Multiple Lines To change more than one line of text, give the starting and ending line numbers of the group of lines to be replaced with the c subcommand. You can replace the group of lines with one or more new lines.
line that contains only --repeat, only-a period. In the 4i subcommand, you enter the new line of text and then type a period on the next line to end the i subcommand. A second 1,$p subcommand displays the contents of the buffer again, showing that the new text was inserted. Using a Context Search Another way to specify where the i subcommand inserts new lines is to use a context search.
The 1,$p subcommand displays the entire contents of the buffer, showing that ed has made and inserted the copies and that the original lines are not affected. Using System Commands from ed Sometimes you may find it convenient to use a system command without leaving the ed program. Use the exclamation point (!) character to leave the ed program temporarily.
C Displaying Version Information With vproc The vproc command uniquely identifies and displays product version information for one or more files. If you are reporting a problem or asking for product support, you need to supply HP with the correct product version information for the files of that product. To use vproc, you must perform the following steps: 1. Find the product files. 2. Select a file for which vproc can return information, based upon the file codes for all of the product’s files. 3.
Running vproc Interactively vproc can be run interactively. Starting an interactive vproc process from the OSS environment allows you to retrieve information for multiple, unrelated files. To start a vproc process, enter vproc after the OSS shell prompt.
Displayed Label Displayed Information Target CPU: Indicates the type of system the product runs on, which can be TNS (CISC-based architecture), TNS/R (RISC-based architecture), or UNSPECIFIED. AXCEL timestamp: Indicates the date and time the code was accelerated. This information appears only for files that have been accelerated. Native Mode: Indicates whether the file can be executed. This information appears only for files with file code 700.
Recovery No action is required.
D OSS Core Utilities User Commands The OSS Utilities product (OSSUTIL – T8626) provides the essential OSS user commands and utilities. Beginning with the J06.14 and H06.25 RVUs, the OSS Core Utilities product (T1202) provides additional Open Source utilities. The OSS Core Utilities provide industry-standard alternatives (not replacements or updates) to the original OSS Utilities. Some of the OSS Core Utilities have the same names as those present in the OSS Utilities.
The following table lists the available OSS Core Utilities commands as of the J06.17 and H06.28 RVUs. This list is not a comprehensive list. arch Print machine hardware name (same as uname -m). base64 base64 encode/decode data and print to standard output. basename Strip directory and suffix from filenames. bash GNU Bourne-Again SHell. bzgrep Search possibly bzip2 compressed files for a regular expression. bzip2 Block-sorting file compressor.
groff Front-end for the groff document formatting system. groups Print the groups a user is in. gzip Compress or expand files. head Output the first part of files. hostid Print the numeric identifier for the current host. hostname Set or print the name of the current host system. id Print real and effective user and group IDs. install Copy files and set attributes. join Join lines of two files on a common field. kill Send signals to processes, or list signals.
rm Remove files or directories. rmdir Remove empty directories. sdiff Side-by-side merge of file differences. seq Print a sequence of numbers. sha1sum Compute and check SHA1 message digest. sha224sum Compute and check SHA224 message digest. sha256sum Compute and check SHA256 message digest. sha384sum Compute and check SHA384 message digest. sha512sum Compute and check SHA512 message digest. shred Overwrite a file to hide its contents, and optionally delete it.
users Print the user names of users currently logged in to the current host. vdir List directory contents. vim Vi IMproved, a programmer's text editor. wc Print newline, word, and byte counts for each file. who Show who is logged on. whoami Print effective userid. xargs Build and execute command lines from standard input. xinted Extended Internet services daemon. yes Output a string repeatedly until killed. zgrep Search possibly compressed files for a regular expression.
or specify: /usr/coreutils/bin/command ◦ To use an original OSS Utilities command, you can set the PATH environment variable: export PATH=/bin:/usr/coreutils/bin:/home or specify: /bin/command • To access a command's reference page, you can specify the path by setting the MANPATH environment variable: ◦ To access an OSS Core Utilities reference page, you can set the MANPATH environment variable: export MANPATH=/usr/coreutils/share/man:/usr/share/man or specify: man -M /usr/coreutils/share/man title
Glossary $ZTC0 1. The default transport-provider process that provides Transmission Control Protocol/Internet Protocol (TCP/IP) services to sockets programs. 2. The default transport-provider process for AF_INET sockets programs. absolute pathname. A pathname that begins with a slash (/) character and is resolved beginning with the root directory. Contrast with relative pathname. access mode The form of file access permitted for a user or process.
See also common applications environment (CAE). base profile. A minimum set of software components required to create a common applications environment. block special file A device that is treated as a file for which all input or output must occur in blocks of data. Traditionally, such files are disk or tape devices. Block special files provide access to a device in a manner that hides the hardware characteristics of the device. Contrast with character special file. blocked signal.
compliance The testing and verification process that precedes X/Open licensing. conformance document An implementor’s document that must accompany software claiming conformance with a POSIX standard. The document specifies the behavior or other aspect of the software when the standard describes a behavior or aspect as implementation-defined. conformance statement questionnaire (CSQ).
data transparent. Describes software that examines all eight bits of every data byte, and that uses no bit in a data byte for its own purposes. Internationalized applications must be data transparent. dearchived Restored into a file system from a specially formatted file called an archive. demon On a UNIX system, a process that runs continuously to provide a specific service for other processes. A demon does not have a controlling terminal and is not explicitly invoked.
extended data segment An area of virtual memory used to contain data. feature-test macro A symbol that, if defined in a program’s source code, includes specific other symbols from a header within that program’s source code and makes those symbols visible. field. An addressable entry within a data structure. The term “field” is sometimes used to mean “member.” FIFO special file. See FIFO.. FIFO. A type of special file that is always read and written in a first-in, first-out manner. file class.
See also fileset.. file transfer protocol (FTP) 1. The Internet-standard, high-level protocol for transferring files from one machine to another. The server side requires the client to supply a logon identifier and password before it honors requests. It makes no assumptions about the file-naming structure of the source and destination systems. It allows the file names of each system to be represented in the vernacular. 2.
• Supplementary group ID • Saved-set group ID group list. A process attribute that is used with the effective group ID of the process to determine the file access permissions for the process. group. In the Open System Services (OSS) environment, a set of user IDs with the same group ID. Guardian An environment available for interactive or programmatic use with the HP NonStop operating system.
internationalization. The process of designing and coding software so that it can be adapted to meet the needs of different languages, cultures, and character sets, with the ability to handle various linguistic and cultural conventions. Internationalization methods enable the processing of character-based data independently of the underlying character encoding, allowing choice among character sets.
localization. The process of adapting computer interfaces, data, and documentation to the culturally accepted way of presenting information in the culture. Sometimes referred to as “L10N,” derived from the 10 letters between the initial “L” and the final “N” of the word “localization.” login name. A user name associated with a session. login. The activity by which a user establishes a locally authenticated identity on a HP NonStop server node. Each login has one login name. man page.
Open System Services (OSS) environment The HP NonStop Open System Services (OSS) application program interface (API), tools, and utilities. Open System Services (OSS) Monitor A Guardian utility that accepts commands affecting OSS objects through an interactive Guardian interface named the Subsystem Control Facility (SCF). Open System Services (OSS) signal A signal model defined in the POSIX.1 specification and available to TNS processes and TNS/R native processes in the OSS environment.
pathname component. See filename.. pathname resolution. In the Open System Services (OSS) environment, the process of associating a single file with a specified pathname. pathname-variable limits. Limits that can vary within the Open System Services (OSS) file hierarchy; that is, the limits on a pathname variable can vary according to the directory in which pathname resolution begins. pathname. In the OSS environment, the string of characters that uniquely identifies a file within its file system.
real group ID. An attribute of a process. When a process is created, the real group ID identifies the group of the user or parent process that created the process. The real group ID can be changed after process creation. real user ID. An attribute of a process. When a process is created, the real user ID identifies the user or parent process that created the process. The real user ID can be changed after process creation. reference page.
set-user-ID program A program file that has the S_ISUID bit set in its file mode. shared memory An interprocess communication mechanism that allows two or more processes to share a given region of memory. shared run-time library (SRL). An object file that the operating system links to a program file at run time. SRLs use direct addressing and cal load and execute only at a specific assigned virtual memory address (the same address in all processes).
system A single copy of the HP NonStop operating system and the collection of hardware groups in which it runs. system console An optional file that receives messages sent through specific function or procedure calls. system manager See manager.. system process A part of a single copy of the HP NonStop operating system with Open System Services (OSS) interfaces. A system process does not have an OSS process ID. System V A version of UNIX developed and marketed originally by AT&T.
Index Symbols &, 138 &&, 35 ( ), 37 *, 30 .exrc file and vi editor, 156 .
COLUMNS variable, 44 comm command, 56 Command entry aids, 35 scheduling at command, 143 batch command, 145 crontab command, 145 syntax, 55 command command, 56 Command interpreter, 31 Command keys, customizing, 156 Command line editing, 41 Commands add_define, 33, 55, 65 alias, 33, 39, 55, 59, 65 apropos, 54 ar, 55 at, 55, 143 awk, 55 banner, 55 basename, 55 batch, 55, 145 bc, 55 bg, 33, 55, 65 break, 33, 55, 65 c89, 55 cal, 56 cancel, 56, 74, 100 cat, 56, 96 cd, 33, 56, 66, 93, 114 chgrp, 56, 130 chmod, 56,
line, 57 ln, 57, 108 locale, 57 logger, 58 logname, 58 lp, 58, 99 lpstat, 58, 99 ls, 58, 74, 76, 93, 116 make, 58 man, 54, 58 man pages, 53 mkcatdefs, 58 mkdir, 58, 93, 113 mkfifo, 58 more, 58, 96 mv, 58, 102, 117 nawk, 58 newgrp, 58 nice, 58 nld, 58 nm, 58 nmcobol, 58 noft, 58 nohup, 58 od, 58 osh, 73, 74, 76, 86 OSS Core Utilities, 185 paste, 58 patch, 58 pathchk, 58 pax, 58, 74, 76, 151 pinstall, 74, 76 pname, 72 pr, 58, 96 print, 34, 58, 66 printf, 58 ps, 58, 74, 76, 139 pwd, 34, 58, 66, 114 read, 34, 5
cron program, 145 crontab command, 56, 145 crontab file, 145 csplit command, 56 Ctrl-c, 90 Current directory overview, 114 removing, 119 Customizing the vi environment, 156 cut command, 56 D date command, 56 dc command, 56 dd command, 56 del_define command, 33, 56, 66 df command, 56 diff command, 56, 104 dircmp command, 56 Directories /E, 28, 68 /G, 28, 68 access, 121 changing, 114 copying, 117 creating, 113 current, 114 displaying, 116 listing, 93, 114, 116 managing, 113 OSS commands, 189 overview, 27 per
overview, 26 permissions, 121, 125 printing, 98 removing, 106 renaming, 103 searching, 147 sorting, 105 transferring, 151 types, 111 Filesets mounting, 89 overview, 30 unmounting, 89 Filters, 36 find command, 57, 138, 149 Finding files, 149 FIPS, 25 flex command, 57 Flow control, 31 fold command, 57 Foreground processes, 138 fork() function, 132 Formatting commands, 63 files with pr command, 96 FPATH variable, 44 FTP, 153 ftp command, 57, 153 G gencat command, 57 genxlt command, 57 getconf command, 57 geto
Locating files, 149 logger command, 58 Logging off TACL, 87 Logging on to TACL, 85 logname command, 58 LOGNAMES variable, 44 lp command, 58, 99 lpstat command, 58, 99 ls command, 58, 74, 76, 93, 116 make command, 58 man command, 54, 58 Man pages, 53 Metacharacters, 30 mkcatdefs command, 58 mkdir command, 58, 93, 113 mkdir() function, 132 mkfifo command, 58 mkfifo() function, 132 mknod() function, 132 Monitoring processes, 139 more command, 58, 96 Moving files, 103 Multiple commands, 35 mv command, 58, 102,
pinstall command, 74 pipe() function, 133 Pipes, 36 pname command, 58 POSIX.1 standards, 25 POSIX.
SHELL variable, 45 Shell variables .
interactive, 182 VT100 emulation, 85 W wait command, 34, 60, 67 wall command, 60 wc command, 60, 136 whatis command, 54, 60 whence command, 34, 60, 67 who command, 60, 74, 77 Word count, 136 wr command, 60 Write permissions, 121 X X/Open Common Applications Environment (CAE) , 24 X6530 emulation, 85 xargs command, 60 XPG4 standards, 24 Xterm emulation, 85 Y yacc command, 60 Z zcat command, 60 zombie processes, 140 ZYQ subvolumes, 72 213