tips and tricks for hp-ux...

229
Tips and Tricks for HP-UX Certification HPCS Technical On-line Seminar Program

Upload: vuongtu

Post on 11-Mar-2018

243 views

Category:

Documents


5 download

TRANSCRIPT

Page 1: Tips and Tricks for HP-UX Certificationdbmanagement.info/Books/MIX/HP_unix_book_for_certification_hp_unix...• Pass the HP-UX System Administration Exam. Tips and Tricks for HP -UX

Tips and Tricks for HP-UX

Certification

HPCS Technical On-line Seminar Program

Page 2: Tips and Tricks for HP-UX Certificationdbmanagement.info/Books/MIX/HP_unix_book_for_certification_hp_unix...• Pass the HP-UX System Administration Exam. Tips and Tricks for HP -UX
Page 3: Tips and Tricks for HP-UX Certificationdbmanagement.info/Books/MIX/HP_unix_book_for_certification_hp_unix...• Pass the HP-UX System Administration Exam. Tips and Tricks for HP -UX

Notice

The information contained in this document is subject to change without notice.

HEWLETT-PACKARD PROVIDES THIS MATERIAL "AS IS" AND MAKES NO WARRANTY OF ANY KIND, EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. HEWLETT-PACKARD SHALL NOT BE LIABLE FOR ERRORS CONTAINED HEREIN OR FOR INCIDENTAL OR CONSEQUENTIAL DAMAGES (INCLUDING LOST PROFITS IN CONNECTION WITH THE FURNISHING, PERFORMANCE OR USE OF THIS MATERIAL WHETHER BASED ON WARRANTY, CONTRACT, OR OTHER LEGAL THEORY).

Some states do not allow the exclusion of implied warranties or the limitations or exclusion of liability for incidental or consequential damages, so the above limitations and exclusion may not apply to you. This warranty gives you specific legal rights, and you may also have other rights which vary from state to state.

Hewlett-Packard assumes no responsibility for the use or reliability of its software on equipment that is not furnished by Hewlett-Packard.

This document contains proprietary information which is protected by copyright. All rights reserved. No part of this document may be photocopied, reproduced or translated to another language without the prior consent of Hewlett-Packard Company.

UNIX® - UNIX is a registered trademark of the Open Group.

© Copyright 2004 by the Hewlett-Packard Company

- See Reverse for Critical Attendee Information -

HPCS Technical On-line Seminar Program

Page 4: Tips and Tricks for HP-UX Certificationdbmanagement.info/Books/MIX/HP_unix_book_for_certification_hp_unix...• Pass the HP-UX System Administration Exam. Tips and Tricks for HP -UX

Topic Name: Tips and Tricks for HP-UX CertificationDelivery Date: April 8, 2004Delivery Time: 12:00 – 4:00 EasternDial-in Number: 877-503-1717 US Toll Free

706-679-3005 Intl Toll HP’s Virtual Classroom Login: http://www.hpe-learning.comVirtual Classroom Key: U639BXQ7BVirtual Classroom Helpdesk: 888.351.4732Intercall Helpdesk: 877.643.6278

Instructions for Checking System Requirements:Prior to the event, you will need to check your system requirements. We ask that this be completed a day or two before the session, so in the event you run into any problems, you will be able to reach technical support well before the scheduled event.Note: Before entering the HP Virtual Classroom, please close all other applications, especially Outlook, to make sure you have sufficient virtual memory to display the training material. This test will ensure you are successful at event time:1. Go to the URL: http://www.hpe-learning.com/attend/attend_class.asp2. Click: “Test your Setup” link

Dear Attendee,

I want to thank you for requesting that your Account Support Consultant register you to attend this Technical On-line Seminar. The employees involved in developing and delivering these materials have worked very hard to ensure that this delivery is a success and that it meets and exceeds your expectations.

Your feedback is very important to me and this program as a whole. If you have any questions about the program or comments about this or any other delivery, you may send them directly to me at: [email protected] or [email protected]

Thank you for attending,

Annette ZurawskiTOS Program Manager813.287.7669

If you encounter any problems, please call the

Virtual Classroom Support line at 1.888.351.4732 to request

further assistance.

HPCS Technical On-line Seminar Program

Page 5: Tips and Tricks for HP-UX Certificationdbmanagement.info/Books/MIX/HP_unix_book_for_certification_hp_unix...• Pass the HP-UX System Administration Exam. Tips and Tricks for HP -UX

Tips and Tricks for HP-UX Certification Introduction - Page 1

Introduction

© 2004 Hewlett-Packard Development Company, L.P.The information contained herein is subject to change without not ice

Page 6: Tips and Tricks for HP-UX Certificationdbmanagement.info/Books/MIX/HP_unix_book_for_certification_hp_unix...• Pass the HP-UX System Administration Exam. Tips and Tricks for HP -UX

Tips and Tricks for HP-UX Certification Introduction - Page 2

page 2

Agenda

12:00 – 1:00 – Intro/Fundamentals1:00 – 1:10 – Break1:10 – 2:40 – System Admin2:40 – 2:50 – Break2:50 – 4:00 – Network Admin4:00 – 4:30 – Test Review/Q&A

Page 7: Tips and Tricks for HP-UX Certificationdbmanagement.info/Books/MIX/HP_unix_book_for_certification_hp_unix...• Pass the HP-UX System Administration Exam. Tips and Tricks for HP -UX

Tips and Tricks for HP-UX Certification Introduction - Page 3

page 3

Why get Certified?

• Recognition from peers• Becoming the standard in the IT Industry• Technical competence• Marketability• Prerequisite for other HP exams§ Certified Advanced IT Professional

• More $$$$

Page 8: Tips and Tricks for HP-UX Certificationdbmanagement.info/Books/MIX/HP_unix_book_for_certification_hp_unix...• Pass the HP-UX System Administration Exam. Tips and Tricks for HP -UX

Tips and Tricks for HP-UX Certification Introduction - Page 4

page 4

Seminar Overview

• To provide a sampling of topics that might appear on the HP-UX Certified (3H0-002) exam. It is recommended that you attend the HP Education classes prior to taking the HP-UX exam.

• The seminar is designed for HP-UX System & Network Administrators and intended for all experience levels

• Sample exams will be provided• Pass the HP-UX System Administration Exam

Page 9: Tips and Tricks for HP-UX Certificationdbmanagement.info/Books/MIX/HP_unix_book_for_certification_hp_unix...• Pass the HP-UX System Administration Exam. Tips and Tricks for HP -UX

Tips and Tricks for HP-UX Certification Introduction - Page 5

page 5

HP Education certification path

• Fundamentals of the UNIX System• HP-UX System & Network Administration I• HP-UX System & Network Administration II

• To Register for HP Education Classes:§ http://www.hp.com/education§ Telephone: 1-800-HPCLASS

Page 10: Tips and Tricks for HP-UX Certificationdbmanagement.info/Books/MIX/HP_unix_book_for_certification_hp_unix...• Pass the HP-UX System Administration Exam. Tips and Tricks for HP -UX

Tips and Tricks for HP-UX Certification Introduction - Page 6

page 6

Strategies for passing the exam

• Buy the HP-UX System Administration book:§ HP Certified: HP-UX System Administration

o 1/e by Rehman, Rafeeq Published in May, 2000 by Prentice Hall PTR (ECS Professional) Copyright 2000, 832 pp.Cloth ISBN 0-13-018374-1 Cost: $ 59.99

§ Discounted Website: www.bookpool.com• Review chapter/sample test questions

from the book and provided exams• Use all of your time and RELAX

Page 11: Tips and Tricks for HP-UX Certificationdbmanagement.info/Books/MIX/HP_unix_book_for_certification_hp_unix...• Pass the HP-UX System Administration Exam. Tips and Tricks for HP -UX

Tips and Tricks for HP-UX Certification Introduction - Page 7

page 7

Registration & test makeup

• 80 questions – Multiple Choice§ (20) Fundamentals of Unix§ (30) System Administration§ (30) Network Administration

o Passing score (Overall) – 70%o Passing score (section) – 50%

• Registration for the HP-UX Exam (3H0-002):§ Sylvan Prometric: 1-800-755-EXAM§ http://www.2test.com

• $100 fee

Page 12: Tips and Tricks for HP-UX Certificationdbmanagement.info/Books/MIX/HP_unix_book_for_certification_hp_unix...• Pass the HP-UX System Administration Exam. Tips and Tricks for HP -UX

Tips and Tricks for HP-UX Certification Introduction - Page 8

page 8

After passing the exam

• HP will provide you with a:§ Certificate of accomplishment§ Gold Pin with Certified IT Professional label§ Diskette with logos to be used for correspondence§ Certified Newsletters

Page 13: Tips and Tricks for HP-UX Certificationdbmanagement.info/Books/MIX/HP_unix_book_for_certification_hp_unix...• Pass the HP-UX System Administration Exam. Tips and Tricks for HP -UX

Tips and Tricks for HP-UX Certification Part #1 - Page #1

HPCS Technical On-line Seminar Program

Part 1:

Fundamentals (20)

Page 14: Tips and Tricks for HP-UX Certificationdbmanagement.info/Books/MIX/HP_unix_book_for_certification_hp_unix...• Pass the HP-UX System Administration Exam. Tips and Tricks for HP -UX

Tips and Tricks for HP-UX Certification Part #1 - Page #2

page 2

Part 1: topics covered

• Basic commands• Working with files and directories• Environment variables• Input/output redirection/pipes• Using the vi editor• Regular expressions• File permissions & file system hierarchy• Working with the POSIX shell • Shell programming

Page 15: Tips and Tricks for HP-UX Certificationdbmanagement.info/Books/MIX/HP_unix_book_for_certification_hp_unix...• Pass the HP-UX System Administration Exam. Tips and Tricks for HP -UX

Tips and Tricks for HP-UX Certification Part #1 - Page #3

page 3

Getting Started

• The 2 most commonly used standards for UX systems: § Berkeley Software Distribution (BSD) § AT&T System V Release 4 (SVR4) – HP-UX

• Kernel:§ Piece of software that handles all the communications

between user software and computer hardware. The core of the operating system.

• Shell§ Command interpreter. Takes user commands, interprets

them, takes the necessary action to execute them, and provides the output of these commands to the user. Considered the primary interaction of the user.

Page 16: Tips and Tricks for HP-UX Certificationdbmanagement.info/Books/MIX/HP_unix_book_for_certification_hp_unix...• Pass the HP-UX System Administration Exam. Tips and Tricks for HP -UX

Tips and Tricks for HP-UX Certification Part #1 - Page #4

page 4

Unix Shells

• POSIX:§ Default HP-UX shell (/usr/bin/sh)

• KORN:§ Has more features than Bourne & C shells (/usr/bin/ksh)

• C:§ Uses C language for shell programming (/usr/bin/csh)

• Bourne:§ The oldest and most widely used shell (/usr/old/bin/sh)§ Is the only shell that does not keep its command history, does

not allow file name completion; command aliases, line editing, nor job control

§ Available on all UX platforms• Other shells:§ Restricted - /usr/bin/rsh§ Key - /usr/bin/keysh

Page 17: Tips and Tricks for HP-UX Certificationdbmanagement.info/Books/MIX/HP_unix_book_for_certification_hp_unix...• Pass the HP-UX System Administration Exam. Tips and Tricks for HP -UX

Tips and Tricks for HP-UX Certification Part #1 - Page #5

page 5

HP-UX Login/Out

Login/Logout:1. Enter username at login (@ the shell/command prompt)2. Next, enter a password3. A prompt will then appear4. The exit command will logout of the system

Types of prompts:# - superuser prompt$ - common user prompt

• After login, a user is placed in the /home directory by default. • This is created at the time of creating the user.§ Example: /home/ryan

Page 18: Tips and Tricks for HP-UX Certificationdbmanagement.info/Books/MIX/HP_unix_book_for_certification_hp_unix...• Pass the HP-UX System Administration Exam. Tips and Tricks for HP -UX

Tips and Tricks for HP-UX Certification Part #1 - Page #6

page 6

The passwd command

• The passwd command is used for changing and setting user passwords and is prompted after login.

• Rules: § 6-8 characters long§ Any character after the 8th character is ignored§ Must be a combination of characters and numbers § At least 2 characters must be letters§ One character must be a number or special character

such as (-) dash, (_) underscore, or (*) asterisk

• After a password is assigned, the passwd command will change it. When changing a password, the new password prompt appears, and another prompt appears to the user to re -enter the new password again.A message that the password has been changed will be displayed.

Page 19: Tips and Tricks for HP-UX Certificationdbmanagement.info/Books/MIX/HP_unix_book_for_certification_hp_unix...• Pass the HP-UX System Administration Exam. Tips and Tricks for HP -UX

Tips and Tricks for HP-UX Certification Part #1 - Page #7

page 7

Shell startup files

• After login, two startup files are created. Both are invoked when a user logs into the system.§ /etc/profile - System startup file. Used for tasks

common to all users. Ex. Setting your time zone (TZ)§ $ HOME/.profile – “Dot Profile” or User startup file. Are

customized for every user. Placed in a users home directory.

• UID – is a unique number associated with the name of each user. A root user (Superuser) has a UID of 0. After login, HP-UX commands can be entered.

• Types of commands:§ Intrinsic – Commands built into the UX shell. Ex. cd§ Extrinsic – Commands stored as separate files. Ex. ls

Page 20: Tips and Tricks for HP-UX Certificationdbmanagement.info/Books/MIX/HP_unix_book_for_certification_hp_unix...• Pass the HP-UX System Administration Exam. Tips and Tricks for HP -UX

Tips and Tricks for HP-UX Certification Part #1 - Page #8

page 8

HP-UX basic commands

• date – Includes time. Changed by the superuser only.• pwd – (Print working directory) Tells which directory you are in• uname – a – Tells hostname and HP-UX version• banner – Prints banners, ex. Banner hello• man – Man pages and getting help, ex. Man cal, man man• cal;date – Shows multiple commands on one line. Using a (;) will

show the calendar and date• clear – Clears terminal screen• esc-K – Repeats the last command• alias – Represents a different name for a UX command. Creates

a command alias.§ ex. alias dir=ls§ dir will function the same as the ls command

Page 21: Tips and Tricks for HP-UX Certificationdbmanagement.info/Books/MIX/HP_unix_book_for_certification_hp_unix...• Pass the HP-UX System Administration Exam. Tips and Tricks for HP -UX

Tips and Tricks for HP-UX Certification Part #1 - Page #9

page 9

Screenshot 1: Basics

Page 22: Tips and Tricks for HP-UX Certificationdbmanagement.info/Books/MIX/HP_unix_book_for_certification_hp_unix...• Pass the HP-UX System Administration Exam. Tips and Tricks for HP -UX

Tips and Tricks for HP-UX Certification Part #1 - Page #10

page 10

More HP-UX commands

• history – Command recalls commands entered. Is saved in the .sh_history default file which is kept in a users home directory.§ Examples:

o # history –3 -> recalls the last 3 commandso # history 350 354 -> lists commands 350-354o # r 350 -> issues command #350o dateo Wed Jan 14 22:33:17 EDT 2002

• whoami – Identifies who is logged in• who – Tells login names of all users logged into the system,

login time and terminal line they are using• w – Tells how long the system has been up, what the current

time is and what logged in users are doing

Page 23: Tips and Tricks for HP-UX Certificationdbmanagement.info/Books/MIX/HP_unix_book_for_certification_hp_unix...• Pass the HP-UX System Administration Exam. Tips and Tricks for HP -UX

Tips and Tricks for HP-UX Certification Part #1 - Page #11

page 11

Screenshot #2: Basics

Page 24: Tips and Tricks for HP-UX Certificationdbmanagement.info/Books/MIX/HP_unix_book_for_certification_hp_unix...• Pass the HP-UX System Administration Exam. Tips and Tricks for HP -UX

Tips and Tricks for HP-UX Certification Part #1 - Page #12

page 12

File naming & commands

• File naming rules:§ 256 characters max§ Letters A-Z, a-z§ numbers 0-9§ Unix is case sensitive§ Special names not allowed§ Combo of letters, #s and special characters (+, -, ., _ )

• cat – Command is used for creating and displaying files. § Ex. # cat > newfile

o This is just a test.o <ctrl – D> will end text entryo #

• more - Command displays contents of text files one page of text at a time. The page command can also do this.

Page 25: Tips and Tricks for HP-UX Certificationdbmanagement.info/Books/MIX/HP_unix_book_for_certification_hp_unix...• Pass the HP-UX System Administration Exam. Tips and Tricks for HP -UX

Tips and Tricks for HP-UX Certification Part #1 - Page #13

page 13

File linking with ln

• File linking (ln)§ File links are created using the ln command and are used

to access a single file with multiple file names.§ By default, the ln command creates a hard link.§ Hard links can be created only within a filesystem.§ Soft links are created using the –s option.§ Soft links can link directories and used between file

systems. o Ex: # ln –s /sbin/init.d/myscript /home/alberto/myscript

Page 26: Tips and Tricks for HP-UX Certificationdbmanagement.info/Books/MIX/HP_unix_book_for_certification_hp_unix...• Pass the HP-UX System Administration Exam. Tips and Tricks for HP -UX

Tips and Tricks for HP-UX Certification Part #1 - Page #14

page 14

File name completion

• File name completion§ Is used when you are typing commands with long file

names. Use the ESC key twice to assist.§ Example:

o $ lso always ant betao $ cat b ESC ESCo $ cat beta

Note: If two or more files start with the samecharacters use “ESC =“ to see your choices.

Page 27: Tips and Tricks for HP-UX Certificationdbmanagement.info/Books/MIX/HP_unix_book_for_certification_hp_unix...• Pass the HP-UX System Administration Exam. Tips and Tricks for HP -UX

Tips and Tricks for HP-UX Certification Part #1 - Page #15

page 15

Working with directories

• mkdir – command creates directories• rmdir – command removes directories.§ -r option with rm will remove an entire directory and all contents

without a warning message to the user• ls – Command lists files and directories. § a option lists hidden files. § l option is a long listing§ A option shows an ordinary file§ F option shows files and directories with a /

example: mydir/ test ryan§ ld option lists the current directory’s permissions

Note: If a user is greeted with the “>” prompt, they will need to complete their current command line.

Page 28: Tips and Tricks for HP-UX Certificationdbmanagement.info/Books/MIX/HP_unix_book_for_certification_hp_unix...• Pass the HP-UX System Administration Exam. Tips and Tricks for HP -UX

Tips and Tricks for HP-UX Certification Part #1 - Page #16

page 16

Moving around in HP-UX

“ . “ – dot character references the current directory“ .. “ – dot dot references the parent directory of the current

directory

Moving around example:# pwd -> /home/jason# cd . -> or /home/jason# cd ../jason -> or cd /home/jason# pwd -> /home/jason# cd ../.. -> /

Path names: absolute – start with the “/” symbol ex) /home/jasonrelative – start from the current directory ex) ../jason

Page 29: Tips and Tricks for HP-UX Certificationdbmanagement.info/Books/MIX/HP_unix_book_for_certification_hp_unix...• Pass the HP-UX System Administration Exam. Tips and Tricks for HP -UX

Tips and Tricks for HP-UX Certification Part #1 - Page #17

page 17

Copying and moving files

• cp§ Command copies files from one destination to the other

cp myfile anotherfile -> copies files both in same directory cp /etc/profile myprofile -> copies from different dir to currentcp /etc/profile . -> copies from different dir to currentcp file1 file2 /tmp -> copies 2 files to /tmp

• mv§ Command is used for moving and renaming files

mv myfile newfile -> renames the file myfile to newfilemv myfile /tmp/myfile -> moves myfile into /tmpmv file1 file2 /tmp -> moves 2 files into /tmp

• file§ Command is used to find a file type

o Example: file /etc/profile -> ascii text file

Page 30: Tips and Tricks for HP-UX Certificationdbmanagement.info/Books/MIX/HP_unix_book_for_certification_hp_unix...• Pass the HP-UX System Administration Exam. Tips and Tricks for HP -UX

Tips and Tricks for HP-UX Certification Part #1 - Page #18

page 18

Screenshot #3: Basics

Page 31: Tips and Tricks for HP-UX Certificationdbmanagement.info/Books/MIX/HP_unix_book_for_certification_hp_unix...• Pass the HP-UX System Administration Exam. Tips and Tricks for HP -UX

Tips and Tricks for HP-UX Certification Part #1 - Page #19

page 19

Using wildcards

• Wildcards - are shortcuts that refer to many characters.

• Options:§ ? – matches only a single character§ * - matches 0 or more characters§ []- matches a range of characters

• Examples:§ ls * -> file file01 file010 wow ryan dba§ ls file0? -> file01§ ls file0* -> file01 file010§ ls [f,w]* -> file file01 file010 wow -> start with f or w§ ls [f-w]* -> file file01 file0101 ryan wow -> files f thru w

Page 32: Tips and Tricks for HP-UX Certificationdbmanagement.info/Books/MIX/HP_unix_book_for_certification_hp_unix...• Pass the HP-UX System Administration Exam. Tips and Tricks for HP -UX

Tips and Tricks for HP-UX Certification Part #1 - Page #20

page 20

Searching & finding files

• grep§ Command is used to search a pattern in files.§ Examples:

o # grep ryan /etc/passwd -> lists all Ryan’s on the system o # grep –i “ RYAN” /etc/passwd -> case insensitive matcho # grep –v ryan /etc/passwd -> lists all lines that do not match o # grep –c ryan /etc/passwd -> lists # lines containing the string

• find§ Command searches for files on the system.§ Example: To find all files that start with pro in the /etc directory

and all of its subdirectorieso # find /etc –name pro*o /etc/profileo /etc/protocols

• Quotes can be used with the find command

Page 33: Tips and Tricks for HP-UX Certificationdbmanagement.info/Books/MIX/HP_unix_book_for_certification_hp_unix...• Pass the HP-UX System Administration Exam. Tips and Tricks for HP -UX

Tips and Tricks for HP-UX Certification Part #1 - Page #21

page 21

Screenshot #4: Basics

Page 34: Tips and Tricks for HP-UX Certificationdbmanagement.info/Books/MIX/HP_unix_book_for_certification_hp_unix...• Pass the HP-UX System Administration Exam. Tips and Tricks for HP -UX

Tips and Tricks for HP-UX Certification Part #1 - Page #22

page 22

Screenshot #5: Basics

Page 35: Tips and Tricks for HP-UX Certificationdbmanagement.info/Books/MIX/HP_unix_book_for_certification_hp_unix...• Pass the HP-UX System Administration Exam. Tips and Tricks for HP -UX

Tips and Tricks for HP-UX Certification Part #1 - Page #23

page 23

File handling commands

• Head and Tail§ Commands list the first (head) or last (tail) number of lines in a

file. Default is 10 lines§ Examples:

o # head –n 7 /etc/passwd – list first 7 lines of fileo # tail /etc/passwd – lists the last 10 lines of /etc/passwd

• wc§ Command is used for counting characters.§ Examples:

o # wc /etc/profileo 111 465 3280 /etc/profileo # wc – l /etc/profile -> 111 lineso # wc – w /etc/profile -> 465 wordso # wc – c /etc/profile -> 3280 characters

Page 36: Tips and Tricks for HP-UX Certificationdbmanagement.info/Books/MIX/HP_unix_book_for_certification_hp_unix...• Pass the HP-UX System Administration Exam. Tips and Tricks for HP -UX

Tips and Tricks for HP-UX Certification Part #1 - Page #24

page 24

Screenshot #6: Basics

Page 37: Tips and Tricks for HP-UX Certificationdbmanagement.info/Books/MIX/HP_unix_book_for_certification_hp_unix...• Pass the HP-UX System Administration Exam. Tips and Tricks for HP -UX

Tips and Tricks for HP-UX Certification Part #1 - Page #25

page 25

Using variables

• Types of Variables: § Environment (global)§ Shell (local)

• Variable rules:§ Spacing: NO spaces

o #VAR7=“HPUX os” Not #VAR7= “HPUX os”§ A variable name can not start with numbers

o #7var=hpux – NO§ Variables are case sensitive§ Use the $ sign when displaying variables, Not when

assigning or exporting themo # echo $VAR7 -> HPUX os

§ Export variables to make visible for child processes

Page 38: Tips and Tricks for HP-UX Certificationdbmanagement.info/Books/MIX/HP_unix_book_for_certification_hp_unix...• Pass the HP-UX System Administration Exam. Tips and Tricks for HP -UX

Tips and Tricks for HP-UX Certification Part #1 - Page #26

page 26

Variables continued

• The set command lists all variables known to your current shell.The list changes system to system. The unset command is used for removing variables.§ Example:

o $ NAME=“Ryan Hay”echo $NAME -> Ryan Hay

o # unset NAMEo # echo $NAME -> sh: NAME: Parameter not set

• Single & Double quotes - Used when assigning variables containing multiple words

• Curly Brackets – Separate variables from the rest of the text• Backquote (`) – Character is used when assigning output of a

command to a variable§ Example:

o #VAR7=`hostname` Optional Method: #VAR7=$(hostname)o #echo $VAR7 -> HP-UX Hostname

Page 39: Tips and Tricks for HP-UX Certificationdbmanagement.info/Books/MIX/HP_unix_book_for_certification_hp_unix...• Pass the HP-UX System Administration Exam. Tips and Tricks for HP -UX

Tips and Tricks for HP-UX Certification Part #1 - Page #27

page 27

Single vs. double quotes

-> $NAME Junior echo $Name

-> Junior is added to NAME using ‘ ’$ NAME=‘$NAME Junior’

-> Ryan Hay Juniorecho $NAME

-> Junior is added NAME using “ ”$ NAME=“$NAME Junior”

-> Ryan Hay7 (Using Curly Brackets)echo ${NAME}7

-> sh: NAME7: Parameter not set.echo $NAME7

-> Ryan Hayecho $NAME

-> using single quotes$ NAME=‘Ryan Hay’

-> Ryan Hayecho $NAME

-> using double quotes$ NAME=“Ryan Hay”

-> sh: Hay: not found.echo $NAME

$ NAME=Ryan Hay

Notice the difference? Anything inside single quotes is taken as is!

Example:

Page 40: Tips and Tricks for HP-UX Certificationdbmanagement.info/Books/MIX/HP_unix_book_for_certification_hp_unix...• Pass the HP-UX System Administration Exam. Tips and Tricks for HP -UX

Tips and Tricks for HP-UX Certification Part #1 - Page #28

page 28

Environment variables

• Environment variables are predefined and standard variables that many HP-UX commands use. To display the value of a predefined variable, echo the variable name. Example: # echo $HOME§ PATH – most commonly used. It contains the command

search path or name of directories where your shell searches for a command when you issue it. It is usually set up through the system startup file.

§ HOME – contains the path of the users home directory.§ SHELL – shows the absolute path of your login shell. § TERM – contains name or type of your terminal. § PS1 – contains primary command prompt string§ PS2 – secondary command prompt string. § MANPATH – where man looks

Page 41: Tips and Tricks for HP-UX Certificationdbmanagement.info/Books/MIX/HP_unix_book_for_certification_hp_unix...• Pass the HP-UX System Administration Exam. Tips and Tricks for HP -UX

Tips and Tricks for HP-UX Certification Part #1 - Page #29

page 29

Exporting shell variables

-> returns to parent sh again$ exit

-> Ryan Hay$ echo $NAME

-> starts child shell again$ sh

-> export var from parent$ export NAME

-> returns us to parent sh$ exit

$

-> variable empty in child$ echo $NAME

-> starts a child shell$ sh

-> Ryan Hay$ echo $NAME

$ NAME=“Ryan Hay”

Can be done so they are available in the child processes. The export command is used.Example:

Page 42: Tips and Tricks for HP-UX Certificationdbmanagement.info/Books/MIX/HP_unix_book_for_certification_hp_unix...• Pass the HP-UX System Administration Exam. Tips and Tricks for HP -UX

Tips and Tricks for HP-UX Certification Part #1 - Page #30

page 30

Input/Output redirection

• Redirection symbols:§ > = stdout§ < = stdin§ >> = append symbol§ 2>&1 = Redirection of both stdout and stderr to the

same location• File descriptors: are numbers that reference open files§ Stdin 0 (<)§ Stdout 1 (>)§ Stderr 2 (2>) -> ex) ll xyz 2>abc

Page 43: Tips and Tricks for HP-UX Certificationdbmanagement.info/Books/MIX/HP_unix_book_for_certification_hp_unix...• Pass the HP-UX System Administration Exam. Tips and Tricks for HP -UX

Tips and Tricks for HP-UX Certification Part #1 - Page #31

page 31

I/O redirecting rules

• Rules:§ Redirecting symbol does not need to be spaced

o cat file1 >file3 -> file3 contents are replaced with file1 info - file1 is still there

o cat file1>> file3 -> appends file1 to original contents of file3

§ Redirection can be done to deviceso cat file1 > /dev/console

• Examples:§ cat file1 file2 > file3 -> 2 files sent to 1 file§ mail ryan < file1 -> stdin file is sent to email§ sort <unsorted >sorted 2>error

• The order in which input, output, and error files appear can be changed– This example sorts a file unsorted and sends output to a file named

sorted redirected to an error file named error

Page 44: Tips and Tricks for HP-UX Certificationdbmanagement.info/Books/MIX/HP_unix_book_for_certification_hp_unix...• Pass the HP-UX System Administration Exam. Tips and Tricks for HP -UX

Tips and Tricks for HP-UX Certification Part #1 - Page #32

page 32

Using pipes

• Use of pipes:§ Send output of 1 command to the input of another§ Can be used with redirection symbols§ Can be used when stdin redirection is used in a

command§ It is possible to redirect stdin, stdout, stderr at the

same time§ Pipes can be used as filters to modify output§ Example:

# who | grep jasonjason pts/tc Oct 30 15:44

§ What is the tee command?

• Tee – It takes its input from stdin and writes the same thing to stdout as well as to another file at the same time. It is known as a T-Junction.

• # who | tee testfile• testfile will now contain the same info as the who command

Page 45: Tips and Tricks for HP-UX Certificationdbmanagement.info/Books/MIX/HP_unix_book_for_certification_hp_unix...• Pass the HP-UX System Administration Exam. Tips and Tricks for HP -UX

Tips and Tricks for HP-UX Certification Part #1 - Page #33

page 33

Using the cut command

• cut – is used for extracting words & characters.§ Example: To extract the first 8 characters from every line

in the /etc/passwd file. # cat /etc/passwd | cut –c 1-8root:nQkdaemon:*roy:*:10

§ Example: To extract the first word of each line and throw away the rest of the information from the who command.

# who | cut –f 1 –d “ “ <-make sure space is w/in “ “jasonryan

• The rest of the information of the who command is stripped Example 2.

Page 46: Tips and Tricks for HP-UX Certificationdbmanagement.info/Books/MIX/HP_unix_book_for_certification_hp_unix...• Pass the HP-UX System Administration Exam. Tips and Tricks for HP -UX

Tips and Tricks for HP-UX Certification Part #1 - Page #34

page 34

Vi editor

• Modes used in the vi editor§ Command (Esc key once or twice)

o Used to issue commands§ Last Line (press : key) – ex command mode, ex

commands are used and these are echoed at the last line of your screen

§ Insert/Input (press i for insert) – text entry mode.o wq! – saves your changeso q! – quits without savingo Look at some basic vi commands!

Page 47: Tips and Tricks for HP-UX Certificationdbmanagement.info/Books/MIX/HP_unix_book_for_certification_hp_unix...• Pass the HP-UX System Administration Exam. Tips and Tricks for HP -UX

Tips and Tricks for HP-UX Certification Part #1 - Page #35

page 35

Position specifiers

• Position Specifiers specify the position of text within a line or file.§ Options:

o ^hpux – matches the word hpux at the start of the lineo hpux$ - matches the word hpux at the end of the lineo ^hpux$ - specific matcho ^$ - matches a blank lineo \̂ ̂- matches a ^ at the beginning of a lineo \$$ - matches a $ at the end of a lineo \ - used for escaping position specifiers

Page 48: Tips and Tricks for HP-UX Certificationdbmanagement.info/Books/MIX/HP_unix_book_for_certification_hp_unix...• Pass the HP-UX System Administration Exam. Tips and Tricks for HP -UX

Tips and Tricks for HP-UX Certification Part #1 - Page #36

page 36

Meta characters

• Meta Characters are used within regular expressions.§ Options:

o * - matches any number of characters, including zeroo . – matches any character, one at a timeo [ ] – range of characterso \< - matches at the beginning of the wordo \> - matches at the end of the wordo \<\> - matches a complete wordo \ - used for escaping meta characters

Page 49: Tips and Tricks for HP-UX Certificationdbmanagement.info/Books/MIX/HP_unix_book_for_certification_hp_unix...• Pass the HP-UX System Administration Exam. Tips and Tricks for HP -UX

Tips and Tricks for HP-UX Certification Part #1 - Page #37

page 37

Examples

• Lists all users on a system starting w/ an “r”: # grep ^r /etc/passwd

• Searches all lines in a file that end with ryan:# grep ryan$ myfile

• If you want to search for the $ char in a file:# grep \$

• In a file, matches every line containing an s, any character, e.

# grep s.e myfile • Matches case insensitive match of the word this in a

file:# grep [Tt]his myfile

Page 50: Tips and Tricks for HP-UX Certificationdbmanagement.info/Books/MIX/HP_unix_book_for_certification_hp_unix...• Pass the HP-UX System Administration Exam. Tips and Tricks for HP -UX

Tips and Tricks for HP-UX Certification Part #1 - Page #38

page 38

Screenshot #7: Basics

Page 51: Tips and Tricks for HP-UX Certificationdbmanagement.info/Books/MIX/HP_unix_book_for_certification_hp_unix...• Pass the HP-UX System Administration Exam. Tips and Tricks for HP -UX

Tips and Tricks for HP-UX Certification Part #1 - Page #39

page 39

File permissions

• Types of users§ Owner, Group, Others

• Types of file permissions§ (-) no permission§ (r) read permission – (4)§ (w) write permission – (2)§ (x) execute permission – (1)

• First character shows file types§ (-) ordinary file§ (d) directory§ ( l) symbolic/soft link§ ( c ) character device file§ ( b ) block device file§ ( p ) named pipe

Page 52: Tips and Tricks for HP-UX Certificationdbmanagement.info/Books/MIX/HP_unix_book_for_certification_hp_unix...• Pass the HP-UX System Administration Exam. Tips and Tricks for HP -UX

Tips and Tricks for HP-UX Certification Part #1 - Page #40

page 40

Modifying file permissions

• chmod – is used for modification§ (u) – user/owner of file§ (g) – group membership of a file§ (o) – others (not owner or member of group)§ (a) – all users

• Symbols used to modify file permissions§ (+) – to grant a permission§ (-) – to revoke a permission§ (=) – to assign a permission, regardless of the

previous permission

Page 53: Tips and Tricks for HP-UX Certificationdbmanagement.info/Books/MIX/HP_unix_book_for_certification_hp_unix...• Pass the HP-UX System Administration Exam. Tips and Tricks for HP -UX

Tips and Tricks for HP-UX Certification Part #1 - Page #41

page 41

File permission examples

• Examples:§ chmod u+x file1

o Grants execute permission to the owner§ chmod o-w file1

o Revokes write permission of other users§ chmod 777 file1

o rwx permission for all§ chmod 650 file1

o rw for owner, rx for group, no permission for other users

Page 54: Tips and Tricks for HP-UX Certificationdbmanagement.info/Books/MIX/HP_unix_book_for_certification_hp_unix...• Pass the HP-UX System Administration Exam. Tips and Tricks for HP -UX

Tips and Tricks for HP-UX Certification Part #1 - Page #42

page 42

Permissions

• Directory permissions: 777 = default• File permissions: 666 = default§ umask -> verifies default file permissions§ umask 022 -> default

• chown – command is used for changing ownership.§ chown ryan file1 -> changes file1’s owner to ryan

• chgrp – command is used for changing the group. § chgrp root file1 -> changes file1’s group to root§ chown ryan:root file1 -> changes owner & group in 1 step

• Useful Commands:§ newgrp – used to change to another group temporarily§ su – changes the user id temporarily (# su – ryan) See Notes

§ id – displays the current user and group IDs

• su – ryan will switch you to user ryan and load his environment.

Page 55: Tips and Tricks for HP-UX Certificationdbmanagement.info/Books/MIX/HP_unix_book_for_certification_hp_unix...• Pass the HP-UX System Administration Exam. Tips and Tricks for HP -UX

Tips and Tricks for HP-UX Certification Part #1 - Page #43

page 43

Other useful commands

• setuid and setgid§ When set, anyone who executes that program gets the

privileges of the owner.§ Security Risk.§ Used when you want to execute a program with higher

privileges.§ Shown with an s.

o Ex) chmod u+s file1; chmod g+s file1 or chmod 4555 file1o Or you can use octal numbers 4 = setuid and 2 = setgid

• Sticky Bit§ Any file present with the sticky bit set can only be deleted by the

owner of the file.§ If set, users can use that area as a public area for file sharing.§ Shown with a t.

o Ex) chmod u+t file1

Page 56: Tips and Tricks for HP-UX Certificationdbmanagement.info/Books/MIX/HP_unix_book_for_certification_hp_unix...• Pass the HP-UX System Administration Exam. Tips and Tricks for HP -UX

Tips and Tricks for HP-UX Certification Part #1 - Page #44

page 44

HP-UX file systems - dynamic

• Dynamic – file systems change§ / - root directory – is the top level dir in the tree

structure§ /dev – contains character (rdsk) and block (dsk)

device files§ /etc – system configuration files§ /home – contains home directories of all system users§ /stand – where the hpux kernel exists /vmunix§ /tmp – temporary files§ /var – for log, spool, & temporary files created by

applications

Page 57: Tips and Tricks for HP-UX Certificationdbmanagement.info/Books/MIX/HP_unix_book_for_certification_hp_unix...• Pass the HP-UX System Administration Exam. Tips and Tricks for HP -UX

Tips and Tricks for HP-UX Certification Part #1 - Page #45

page 45

HP-UX file systems - static

• Static – file systems do NOT change§ /opt – contains applications§ /usr – contains system files

o /usr/bin – contains user commands, applications and utilities

§ /sbin – executable files needed at boot time o rc controls system startup & shutdown processes

Page 58: Tips and Tricks for HP-UX Certificationdbmanagement.info/Books/MIX/HP_unix_book_for_certification_hp_unix...• Pass the HP-UX System Administration Exam. Tips and Tricks for HP -UX

Tips and Tricks for HP-UX Certification Part #1 - Page #46

page 46

HP-UX file system commands

• which§ Is used to find out in which directory an executable file or

command is located; to find a command in the search patho # which ls -> /usr/bin/ls

• whereis§ Searches & locates source, binary, & man pages

o # whereis cat –cat: /sbin/cat /usr/bin/cat usr/share/man/man1.Z/cat.1

• lost + found§ Contains files without valid links.§ Each file system contains one lost & found directory per file

system.

• The lost and found directory is created by the fsck command

Page 59: Tips and Tricks for HP-UX Certificationdbmanagement.info/Books/MIX/HP_unix_book_for_certification_hp_unix...• Pass the HP-UX System Administration Exam. Tips and Tricks for HP -UX

Tips and Tricks for HP-UX Certification Part #1 - Page #47

page 47

Types of substitution

• Variable§ Name is used with the $ sign in the command line

o echo $HOME -> /home/ryan -> value of the variable is printed• Command§ Result of another command substituted at command

line o echo $(date) -> fri Sept 13 22:33:19 EDT 2002 or,o echo `date` -> fri Sept 13 22:33:19 EDT 2002

• Tilde§ A ~ replaces variables

o ~/ is replaced by the HOME variableo ~+ is replaced by the PWD variableo ~– is replaced by the OLDPWD variable

–Example: cd ~/ -> /home/ryan

Page 60: Tips and Tricks for HP-UX Certificationdbmanagement.info/Books/MIX/HP_unix_book_for_certification_hp_unix...• Pass the HP-UX System Administration Exam. Tips and Tricks for HP -UX

Tips and Tricks for HP-UX Certification Part #1 - Page #48

page 48

Job control

• A job is a running process in memory§ Allows the movement of jobs from the foreground to the

background, puts jobs in a wait state, suspends running jobs, and restarts suspended jobs.

• Foreground and Background Jobs:§ Foreground (fg) jobs – user can interact with running

programs, can’t issue other commands until job is finished§ Background (bg) jobs – other jobs can be run

simultaneously. Put “&” symbol at the end of the command prompt. Once a job starts in the background, the shell prints the job id and PID

#ll /usr > myfile & [1] 2343

Page 61: Tips and Tricks for HP-UX Certificationdbmanagement.info/Books/MIX/HP_unix_book_for_certification_hp_unix...• Pass the HP-UX System Administration Exam. Tips and Tricks for HP -UX

Tips and Tricks for HP-UX Certification Part #1 - Page #49

page 49

Using the jobs command

• jobs - lists foreground & background jobs$ jobs [1] + stopped vi myfile[2] – Running vi ryanfile

§ (+) sign shows that this is the current job§ (-) sign shows which job is scheduled to be run next after the

current job§ (-l) option shows the PID of all jobs

• Suspending a foreground job is done by pressing the CTRL-Z keys or using the susp value in the stty –a output.

• As soon as you suspend a foreground job, it goes into a stopped state.§ All suspended jobs can be resumed with the foreground (fg)

command.§ The same command is used to bring bg jobs to the fg.

Page 62: Tips and Tricks for HP-UX Certificationdbmanagement.info/Books/MIX/HP_unix_book_for_certification_hp_unix...• Pass the HP-UX System Administration Exam. Tips and Tricks for HP -UX

Tips and Tricks for HP-UX Certification Part #1 - Page #50

page 50

Job control syntax

• Moving foreground jobs to the background§ jobs

[1] + stopped vi myfile[2] - stopped vi ryanfile

§ bg %2[1] + stopped vi myfile[2] - running vi ryanfile

• Bringing background jobs to the foreground§ fg %2

[1] + stopped vi myfile[2] – stopped vi ryanfile

Page 63: Tips and Tricks for HP-UX Certificationdbmanagement.info/Books/MIX/HP_unix_book_for_certification_hp_unix...• Pass the HP-UX System Administration Exam. Tips and Tricks for HP -UX

Tips and Tricks for HP-UX Certification Part #1 - Page #51

page 51

Job control

• There is no direct way to stop a running job.§ An alternate method is to bring a bg job into the fg

and then suspend it. • Waiting for background jobs to finish§ wait %2§ Note: if you want to stop the wait command, just press

the enter key

Page 64: Tips and Tricks for HP-UX Certificationdbmanagement.info/Books/MIX/HP_unix_book_for_certification_hp_unix...• Pass the HP-UX System Administration Exam. Tips and Tricks for HP -UX

Tips and Tricks for HP-UX Certification Part #1 - Page #52

page 52

Shell programming

• ./<script name> -> will execute a script or • sh <script name>• Command line arguments§ Are stored in variables showing the position of the argument in

the command line.o $0 shows the command itselfo $1 shows 1st command line argumento $2 shows 2nd command line argumento ${10} shows 10th command line argumento $# shows total number of command line argumentso $* shows a space separated list of command line arguments

• echo command§ Displays text on screen.§ Escape characters are used with this command. ie. \n, \a

Page 65: Tips and Tricks for HP-UX Certificationdbmanagement.info/Books/MIX/HP_unix_book_for_certification_hp_unix...• Pass the HP-UX System Administration Exam. Tips and Tricks for HP -UX

Tips and Tricks for HP-UX Certification Part #1 - Page #53

page 53

Basic programming example

Example: # cat colorprogecho There are $# command line argumentsecho They are $*echo The first command line argument is $1

Output:# ./colorprog red green yellow blue orange blackThere are 6 command line argumentsThey are red green yellow blue orange blackThe first command line argument is red

Page 66: Tips and Tricks for HP-UX Certificationdbmanagement.info/Books/MIX/HP_unix_book_for_certification_hp_unix...• Pass the HP-UX System Administration Exam. Tips and Tricks for HP -UX

Tips and Tricks for HP-UX Certification Part #1 - Page #54

page 54

Using the shift command

• Shift command§ Moves command line arguments 1 position left.§ The first argument is lost when you use the shift

command.§ You can specify the # of arguments to be shifted.

Example:# cat colorprogecho There are $# command line argumentsecho They are $*echo shifting two argumentsshift 2echo There are $# command line argumentsecho They are $*

Page 67: Tips and Tricks for HP-UX Certificationdbmanagement.info/Books/MIX/HP_unix_book_for_certification_hp_unix...• Pass the HP-UX System Administration Exam. Tips and Tricks for HP -UX

Tips and Tricks for HP-UX Certification Part #1 - Page #55

page 55

Shift command output

Example Output:# ./colorprog red green yellow blue orange blackThere are 6 command line argumentsThey are red green yellow blue orange blackShifting two argumentsThere are 4 command line argumentsThey are yellow blue orange black

Page 68: Tips and Tricks for HP-UX Certificationdbmanagement.info/Books/MIX/HP_unix_book_for_certification_hp_unix...• Pass the HP-UX System Administration Exam. Tips and Tricks for HP -UX

Tips and Tricks for HP-UX Certification Part #1 - Page #56

page 56

Using the Read command

• Read command§ Takes one line of input from the user and assigns it to a

variable. Example:

# cat colorprogecho “Please enter your favorite color:”read colorecho The color you entered was:$color

Output:# ./colorprogPlease enter your favorite color: blue [input from the user]The color you entered was: blue

Page 69: Tips and Tricks for HP-UX Certificationdbmanagement.info/Books/MIX/HP_unix_book_for_certification_hp_unix...• Pass the HP-UX System Administration Exam. Tips and Tricks for HP -UX

Tips and Tricks for HP-UX Certification Part #1 - Page #57

page 57

Exit codes

• When a program terminates its execution, it returns a result code to the shell that shows the programs termination or exit status§ Exit code 0 = successful execution§ Exit code not = 0 returns abnormal termination§ echo $? – verifies an exit code

Example:$ lsabc cat colorprog

$ echo $? -> 0$ mvusage: mv [-f] [-I] [-e warning]

$ echo $? -> 1

Page 70: Tips and Tricks for HP-UX Certificationdbmanagement.info/Books/MIX/HP_unix_book_for_certification_hp_unix...• Pass the HP-UX System Administration Exam. Tips and Tricks for HP -UX

Tips and Tricks for HP-UX Certification Part #1 - Page #58

page 58

Using the Test command

• Test command§ Is used to evaluate expressions and generate a return

code (true (0) or false (1)). Performs tests on integers, strings and files.

§ Numeric Operatorso -eq (equality check)o -ne (not equal)o -lt (less than)o -gt (greater than)o -le (less than or equal to)

§ String operatorso [string1 = string2] – determines string equivalenceo [string1 !=string2] – determines string nonequivalence

• Most commonly used with the if and while constructs to provide conditional flow control.

• May use [ ] Square brackets for syntax.$ test “ABC” = “abc” or $ [ “ABC” = “abc” ]

Page 71: Tips and Tricks for HP-UX Certificationdbmanagement.info/Books/MIX/HP_unix_book_for_certification_hp_unix...• Pass the HP-UX System Administration Exam. Tips and Tricks for HP -UX

Tips and Tricks for HP-UX Certification Part #1 - Page #59

page 59

Branching & loops

• Branching:§ if – then – fi

o An action is performed only if a TRUE value is found§ if – then – else – fi

o Is used when you want to perform one of 2 actions§ case

o Is used when you want to branch to multiple program segments. o esac ends case.

• Loops:§ while – do – done

o Loop executes as long as condition remains True§ until – do – done

o Loop continues to execute as long as condition is False§ for – do – done

o Loop continues to execute as long as all list elements are processed

Page 72: Tips and Tricks for HP-UX Certificationdbmanagement.info/Books/MIX/HP_unix_book_for_certification_hp_unix...• Pass the HP-UX System Administration Exam. Tips and Tricks for HP -UX

Tips and Tricks for HP-UX Certification Part #1 - Page #60

page 60

Using the Break command

• Discontinues execution of a loop immediately and transfers control to the command following the done keyword or breaks out from the current loop and then continues on.

Example:while truedoecho “Please enter a name of the file:”read FILENAMEif [ ! –f $FILENAME ]then

echo “Sorry, this is not the filename we were looking for”break

ficat $FILENAMEdoneecho “GOODBYE”

Page 73: Tips and Tricks for HP-UX Certificationdbmanagement.info/Books/MIX/HP_unix_book_for_certification_hp_unix...• Pass the HP-UX System Administration Exam. Tips and Tricks for HP -UX

Tips and Tricks for HP-UX Certification Part #1 - Page #61

page 61

Using the Continue command

§ When encountered, skips the remaining part of the loop and transfers the control to the start of the loop for the next iterationExample:While Truedoecho “guess a number from 1 to 10 or type ‘q’ to quit: “

read guesscase $guess inq) banner bye; exit;;7) banner correct; break;;*) banner wrong; continue;;esac

donebanner God Job!exit

Page 74: Tips and Tricks for HP-UX Certificationdbmanagement.info/Books/MIX/HP_unix_book_for_certification_hp_unix...• Pass the HP-UX System Administration Exam. Tips and Tricks for HP -UX

Tips and Tricks for HP-UX Certification Part #1 - Page #62

page 62

Screenshot #8: Programming

Page 75: Tips and Tricks for HP-UX Certificationdbmanagement.info/Books/MIX/HP_unix_book_for_certification_hp_unix...• Pass the HP-UX System Administration Exam. Tips and Tricks for HP -UX

Tips and Tricks for HP-UX Certification Part #1 - Page #63

page 63

Using the Sleep command

• Is used to suspend execution for a certain amount of time in seconds.§ Will print files every 5 seconds in whatever directory

you are in.Example:

for FILENAME in *do

ll $FILENAMEsleep 5

done

Page 76: Tips and Tricks for HP-UX Certificationdbmanagement.info/Books/MIX/HP_unix_book_for_certification_hp_unix...• Pass the HP-UX System Administration Exam. Tips and Tricks for HP -UX

Tips and Tricks for HP-UX Certification Part #1 - Page #64

page 64

Additional commands

• exit§ Completely terminates the program with optionally

specified exit codes• let§ Performs both arithmetic & logic operations.§ Can be replaced with (( )) parenthesis.§ Let “C=A+B” or ((C=A+B))

Page 77: Tips and Tricks for HP-UX Certificationdbmanagement.info/Books/MIX/HP_unix_book_for_certification_hp_unix...• Pass the HP-UX System Administration Exam. Tips and Tricks for HP -UX

Tips and Tricks for HP-UX Certification Part #2 - Page 1

© 2003 Hewlett-Packard Development Company, L.P.The information contained herein is subject to change without not ice

HPCS Technical On-line Seminar Program

Part 2:

System Admin (30)

Page 78: Tips and Tricks for HP-UX Certificationdbmanagement.info/Books/MIX/HP_unix_book_for_certification_hp_unix...• Pass the HP-UX System Administration Exam. Tips and Tricks for HP -UX

Tips and Tricks for HP-UX Certification Part #2 - Page 2

page 2

Part 2: topics covered

• SAM (System Administration Manager)• System startup and shutdown• Software and patch management• Reconfiguring the HP-UX kernel• Devices, physical paths and peripheral devices• File systems and LVM (Logical Volume Manager)• User and group management• Dealing with HP-UX processes• Printing on HP-UX• Memory and swap space management• Backup and recovery and automating jobs

Page 79: Tips and Tricks for HP-UX Certificationdbmanagement.info/Books/MIX/HP_unix_book_for_certification_hp_unix...• Pass the HP-UX System Administration Exam. Tips and Tricks for HP -UX

Tips and Tricks for HP-UX Certification Part #2 - Page 3

page 3

System Administration Manager

• SAM for short§ Available in text and graphical interfaces.§ Invoked with menus using the tab and arrow keys§ Can build own functional areas by customizing sam§ Can not be used for troubleshooting§ Samlog_viewer is the utility for viewing the sam log

file§ By default, only root is allowed to use SAM§ Can grant/allow others restricted access with sam -r

Page 80: Tips and Tricks for HP-UX Certificationdbmanagement.info/Books/MIX/HP_unix_book_for_certification_hp_unix...• Pass the HP-UX System Administration Exam. Tips and Tricks for HP -UX

Tips and Tricks for HP-UX Certification Part #2 - Page 4

page 4

Installing HP-UX

• Interrupting the boot starts the process of installation• Main Menu of Commands will be listed after the interrupt. § Boot, Path, SEArch

• Searches for potential boot devices:§ Random Access Media -> shows disks and cdrom§ Sequential Access Media -> tape drives

• Main Menu: Enter command or menu > search or SEA• Main Menu: Enter command or menu > Boot <Path

Number>• Interact with ISL (Y or N) ? > N• Go through installation and other options using the TAB

key

• Search lists all bootable devices attached to system– Toshiba CD-ROM Device would be your initial boot/install device

Page 81: Tips and Tricks for HP-UX Certificationdbmanagement.info/Books/MIX/HP_unix_book_for_certification_hp_unix...• Pass the HP-UX System Administration Exam. Tips and Tricks for HP -UX

Tips and Tricks for HP-UX Certification Part #2 - Page 5

page 5

The set_parms command

• set_parms§ Is used for the initial configuration of the system such as

setting the system date, hostname, IP and time zone.• Rules:§ Length of an HP-UX hostname is 64 character maximum§ Hostname may contain letters, #s, -s, and _ characters§ Uppercase letters are not recommended§ Must start with a letter

Example:To set the time zone only, use:

# set_parms timezone# set_parms initial -> will go through all steps

Page 82: Tips and Tricks for HP-UX Certificationdbmanagement.info/Books/MIX/HP_unix_book_for_certification_hp_unix...• Pass the HP-UX System Administration Exam. Tips and Tricks for HP -UX

Tips and Tricks for HP-UX Certification Part #2 - Page 6

page 6

Init process and run levels

• Init Process: § After startup, reads the initdefault parameter from the

/etc/inittab configuration file to set run level (Default 3)§ Initializes kernel data structures using /sbin/ioinitrc§ Runs /sbin/bcheckrc§ Runs /sbin/rc & brings your system to the default run level

• Run Levels:§ The init command can change runlevels. ex) init 3§ Run level 3 - network, NFS exports and CDE are started§ Run level 2 - multi-user; most system daemons and

services are started§ Run levels s, S and 1 are single user mode§ who –r command determines the current system run level§ Review the 9 Run Levels (0, s, S, 1, 2, 3, 4, 5, 6)

• Do not use init S from a higher run level to go into single-user mode. Will not terminate certain system activities and does not bring the system into single user mode. Use the shutdown command.

Page 83: Tips and Tricks for HP-UX Certificationdbmanagement.info/Books/MIX/HP_unix_book_for_certification_hp_unix...• Pass the HP-UX System Administration Exam. Tips and Tricks for HP -UX

Tips and Tricks for HP-UX Certification Part #2 - Page 7

page 7

Adding a program to run at boot

• Know the general steps:§ Execution Script

o Installed under /sbin/init.d/ directory (Ex. /sbin/init.d/cron)o Four major cmd line arguments (start_msg, stop_msg, start & stop)

§ Sequencer Directory o Represents a particular run level for the execution scripto Examples: /sbin/rc2.d/S730cron ->

/sbin/rc1.d/K270cron ->

§ Configuration Fileso Files used for setting execution script variables, options and to enable

programo Installed under /etc/rc.config.d/ directory (Ex. /etc/rc.config.d/cron)

• Shows cron will be started in rl2. The number 730 is the sequence number. A script having a sequence number less than 730 will be executed earlier than cron

Page 84: Tips and Tricks for HP-UX Certificationdbmanagement.info/Books/MIX/HP_unix_book_for_certification_hp_unix...• Pass the HP-UX System Administration Exam. Tips and Tricks for HP -UX

Tips and Tricks for HP-UX Certification Part #2 - Page 8

page 8

System shutdown

• Review your Shutdown command§ -r -> reboots the system after shutdown§ -h -> halts the system after shutdown§ -y -> does not require interactive response shutdown. § If in single user mode, it is safe to use the reboot

command§ Remember: Reboot command KILLS processes

instead of gracefully terminating them.§ The /etc/shutdown.allow file shows which users are

allowed to execute the shutdown command.

• What level will “shutdown” command take you to? S or 1?

Page 85: Tips and Tricks for HP-UX Certificationdbmanagement.info/Books/MIX/HP_unix_book_for_certification_hp_unix...• Pass the HP-UX System Administration Exam. Tips and Tricks for HP -UX

Tips and Tricks for HP-UX Certification Part #2 - Page 9

page 9

Software Distributor (SD-UX)

• What is Software Distributor?

§ Installing (swinstall)§ Removing (swremove)§ Listing (swlist)§ Verifying (swverify)§ Copying (swcopy)§ Packaging (swpackage)§ Configuring (swconfig)§ Distributing (swreg)

• Swinstall – Install software packages• Swremove – remove installed sw; also remove from a depot• Swlist – List installed sw or sw in a depot• Swverify – verify integrity of installed sw• Swcopy – Copy sw components to a sw depot• Swpackage – package sw in a depot• Swconfig – configure installed software• Swreg – Make sw depot visible to other systems on network

Page 86: Tips and Tricks for HP-UX Certificationdbmanagement.info/Books/MIX/HP_unix_book_for_certification_hp_unix...• Pass the HP-UX System Administration Exam. Tips and Tricks for HP -UX

Tips and Tricks for HP-UX Certification Part #2 - Page 10

page 10

Software packaging structures

§ Filesetso A collection of files and control scripts.o One fileset can belong to only one product

§ Subproductso Logically related filesetso A fileset may be a member of many subproducts

§ Products o Superset of filesets and/or subproducts

§ Bundleso Contain filesets which may belong to different productso Can have parts of different products

§ Software depotso Place where filesets, products, and bundles are stored.

Directory (default: /var/spool/sw), cd-rom, tape, network

Page 87: Tips and Tricks for HP-UX Certificationdbmanagement.info/Books/MIX/HP_unix_book_for_certification_hp_unix...• Pass the HP-UX System Administration Exam. Tips and Tricks for HP -UX

Tips and Tricks for HP-UX Certification Part #2 - Page 11

page 11

SD-UX commands

• swinstall§ Command is used for installing software § swagentd - Is the daemon that controls the software installation

process. It starts swagent responsible for sw management tasks.§ Install log file (/var/adm/sw/swinstall.log)

o Where swinstall activities are loggedo The file contains labels with ERRORS, WARNINGS and NOTES.

§ Installed products database (IPD)o Contains a list of installed software. /var/adm/sw/products

• swremove§ Command is used for removing software§ Log file - /var/adm/sw/swremove.log

• swlist§ Command lists installed software§ Without any options, it lists bundles and products not contained in a

bundle.• Review the other SD-UX commands

• swinstall –s /CDROM – installs software from CD• swinstall –s /dev/rmt/0m – installs software from tape• 10.20 or earlier a mount point will need to be created

– Done through the use of a TUI or GUI – use TAB key

Page 88: Tips and Tricks for HP-UX Certificationdbmanagement.info/Books/MIX/HP_unix_book_for_certification_hp_unix...• Pass the HP-UX System Administration Exam. Tips and Tricks for HP -UX

Tips and Tricks for HP-UX Certification Part #2 - Page 12

page 12

Patch management

• HP-UX Patches:§ Add new functionality, add support for new hardware, fix bugs

in OS and applications§ Types of patches:§ PHCO – command§ PHKL – kernel§ PHSS – subsystem§ PHNE – network

• Patches are distributed as shar files§ Example: sh PHCO_15520§ 2 files are extracted when unshared - .text and .depot

• Creating a patch depot:§ swcopy –s PHCO_15520.depot PHCO_15220 @

/var/spool/sw

• When installing patches from an HP cdrom and are not sure which patches to install use:

– Manage patch selection (11.00 or greater)– Match what target has (10.X)

Page 89: Tips and Tricks for HP-UX Certificationdbmanagement.info/Books/MIX/HP_unix_book_for_certification_hp_unix...• Pass the HP-UX System Administration Exam. Tips and Tricks for HP -UX

Tips and Tricks for HP-UX Certification Part #2 - Page 13

page 13

HP-UX kernel configuration steps

1. Change the directory to /stand/build # cd /stand/build

2. Create kernel parameter system file from running system# /usr/lbin/sysadm/system_prep –s system

3. Edit the system file# vi system

4. Build the new kernel# /usr/sbin/mk_kernel –s ./system

5. Backup the old kernel and system files# mv /stand/system /stand/system.prev # mv /stand/vmunix /stand/vmunix.prev

6. Install the new kernel# mv /stand/build/system /stand/system# mv /stand/build/vmunix_test /stand/vmunix

7. Reboot the system # shutdown –r 0

• For HP-UX 11.X

• 1- # cd /stand/build• 2- # /usr/lbin/sysadm/system_prep –v –s system• 3- # kmsystem –S /stand/build/system (To view kernel modules)• # kmsystem –S /stand/build/system –c Y driver_name• 4- # /usr/sbin/mk_kernel –s ./system• 5- # kmupdate• 6- # mv /stand/system /stand/system.prev; mv system /stand/system• 7- # shutdown –r now

• Recall that SAM can also be used to regenerate the kernel

Page 90: Tips and Tricks for HP-UX Certificationdbmanagement.info/Books/MIX/HP_unix_book_for_certification_hp_unix...• Pass the HP-UX System Administration Exam. Tips and Tricks for HP -UX

Tips and Tricks for HP-UX Certification Part #2 - Page 14

page 14

Booting from the old kernel

• Sometimes you cannot boot from the new kernel

§ If so, restart the system§ Interrupt the autoboot process by pressing any key§ At the prompt:

o main menu: enter command or menu > boot pri§ Interact with ISL (Y or N) > Y§ ISL -> hpux /stand/vmunix.prev§ After reboot, you can restore the old kernel or make changes

to correct the problem with the new kernel

• To boot in single user mode:– Isl-> hpux –is /stand/vmunix

Page 91: Tips and Tricks for HP-UX Certificationdbmanagement.info/Books/MIX/HP_unix_book_for_certification_hp_unix...• Pass the HP-UX System Administration Exam. Tips and Tricks for HP -UX

Tips and Tricks for HP-UX Certification Part #2 - Page 15

page 15

Device adapters and HW paths

• Types of Device Adapters§ SCSI – (Small Computer System Interface)

o Controller (default) address-- 7 (Highest Priority), 0 (Lowest Priority) o FW/SCSI – 0 to 15: 7 (Highest Priority), 8 (Lowest Priority)

§ Multiplexer (mux)o Connects serial devices to the system i.e. Printers, modems, terminals

§ LAN cardo Card used to connect to LAN – Ethernet & IEEE 802.3

• Hardware Paths§ Indicates the location of a device in your system§ Example: 8/12.5.0 – represents a scsi disk connected to the system

o 8 – represents a bus in the systemo 12 – is the address of the SCSI adapter on the buso 5 – SCSI ido 0 – logical unit number

Page 92: Tips and Tricks for HP-UX Certificationdbmanagement.info/Books/MIX/HP_unix_book_for_certification_hp_unix...• Pass the HP-UX System Administration Exam. Tips and Tricks for HP -UX

Tips and Tricks for HP-UX Certification Part #2 - Page 16

page 16

Device Files

• Key points to remember:§ Describes the HW path of the device§ Directory: /dev plus sub-directories§ HP-UX communicates to all devices using device files§ Commands to keep in mind:

o ioscan -- Command lists device files, HW paths, drivers, class card instances and devices

o lsdev -- Command lists the drivers configured into your system.

o diskinfo – describes the characteristics of a disk device

• During the boot process, HP-UX probes ALL devices and executes /sbin/ioinitrc scripts that create new device files if needed.

• Hierarchical devices directory• /dev/dsk – Block device files for disks• /dev/rdsk – Raw or Character device files for disks• /dev/vg00 – Device files for vg00• /dev/rmt – Device files for tape drives

Page 93: Tips and Tricks for HP-UX Certificationdbmanagement.info/Books/MIX/HP_unix_book_for_certification_hp_unix...• Pass the HP-UX System Administration Exam. Tips and Tricks for HP -UX

Tips and Tricks for HP-UX Certification Part #2 - Page 17

page 17

Major and Minor Numbers

• Major and Minor numbers: § Major #s – represent kernel drivers built into the kernel. All

devices of the same type have the same major number because the same driver is used for all of them. LVM device files have major# 64.

§ Minor #s – show device driver specific info and may be things such as physical location of the device. It’s a 6 digit hexadecimal number. # ll /dev/rmt/0m -> refers to a specific tape cartridge/formatcrw–rw–rw- 2 bin bin 212 0x030000 Sep 30 2002

/dev/rmt/0mcrw–rw- rw- 2 bin bin 212 0x030080 Oct 3 2002

/dev/rmt/0mb

Page 94: Tips and Tricks for HP-UX Certificationdbmanagement.info/Books/MIX/HP_unix_book_for_certification_hp_unix...• Pass the HP-UX System Administration Exam. Tips and Tricks for HP -UX

Tips and Tricks for HP-UX Certification Part #2 - Page 18

page 18

The SCSI file naming convention

• SCSI Format: c#t#d# [miscellaneous] example: c0t1d0§ c = instance # of adapter card, NOT device itself§ t = target address of device on scsi bus§ d = device number or lun# – usually 0

• Disk devices: 2 device files (char and block)§ Every disk drive has character and block device files

attached to it.§ Example: /dev/dsk/c2t4d0

/dev/rdsk/c2t4d0• Tape devices:§ Example: /dev/rmt/c4t1d0BESTnb

• Shows the tape device is attached to an adapter having instance number 4 with target number 1 and lun 0 with the highest capacity format used BEST. This will also include data compression if it is supported by the device. The character “n” shows that the tape will not be rewound at the end of the operation. The “b” character shows that the tape drive will follow the Berkeley style instead of AT&T.

Page 95: Tips and Tricks for HP-UX Certificationdbmanagement.info/Books/MIX/HP_unix_book_for_certification_hp_unix...• Pass the HP-UX System Administration Exam. Tips and Tricks for HP -UX

Tips and Tricks for HP-UX Certification Part #2 - Page 19

page 19

Listing installed devices

• Using the ll command$ ll /dev/rmt/0m*crw-rw-rw- 2 bin bin 212 0x030000 Nov 13 2002 /dev/rmt/0mcrw-rw-rw- 2 bin bin 212 0x0300c0 Nov 13 2002 /dev/rmt/0mnb

• Using the ioscan command – the (-u) option shows usable devices$ ioscan –funC diskClass I H/W Path Driver S/W State H/W Type Description===========================================disk 16 10/0.2.0 sdisk CLAIMED DEVICE SEAGATE ST34371W

/dev/dsk/c1t2d0 /dev/rdsk/c1t2d0• Using lssf – command displays characteristics of device files

$ lssf /dev/rmt/c4t1d0BESTnstape card instance 4 SCSI target 1 SCSI LUN 0 at&t norewind best density available at address 10/8.1.0 dev/rmt/c4t1d0BESTn

Page 96: Tips and Tricks for HP-UX Certificationdbmanagement.info/Books/MIX/HP_unix_book_for_certification_hp_unix...• Pass the HP-UX System Administration Exam. Tips and Tricks for HP -UX

Tips and Tricks for HP-UX Certification Part #2 - Page 20

page 20

Methods of creating device files

• Autoconfiguration:§ Kernel probes hardware at boot§ Initiates init process§ Starts /etc/ioinitrc script§ Calls ioinit command§ Checks devices against /etc/ioconfig file and kernel§ Executes insf for new devices

• Using insf:§ Creates device files for new devices without a reboot

o Example: insf –C tape -> creates device files for tape drives

§ Remember the insf –e option

• If you accidentally remove an existing device file and need to add again, use the –e option.

• Example:– insf –H 8/16/5.2.0 –e (Add your device attached to HW path

8/16/5.2.0)

Page 97: Tips and Tricks for HP-UX Certificationdbmanagement.info/Books/MIX/HP_unix_book_for_certification_hp_unix...• Pass the HP-UX System Administration Exam. Tips and Tricks for HP -UX

Tips and Tricks for HP-UX Certification Part #2 - Page 21

page 21

Methods of creating device files (cont.)

• Using mksf:§ Used to create device files if the system already

knows about the device. It has an assigned instance #o Example: mksf –H 2.4.0 –r

–Creates a char type raw device file for a disk attached at hw address 2.4.0

• Using mknod§ Command creates char and block dev files. Need to

specify major and minor #s at command line.o Example: mknod /dev/rmt/0m c 212 0x030080

–Creates char dev files for tape drive with major (212) and minor(ox030080) numbers

• Using SAM

• Keep in mind the major steps when adding a new device to your Server:– 1- Check if driver is built into the kernel or add driver and

reconfigure kernel– 2- Shutdown system, turn off system and install device– 3- Reboot– 4- HP-UX kernel will probe the new device and install device files

during startup– 5- Use ioscan to verify added device, device files and driver. If not

use manual process.

Page 98: Tips and Tricks for HP-UX Certificationdbmanagement.info/Books/MIX/HP_unix_book_for_certification_hp_unix...• Pass the HP-UX System Administration Exam. Tips and Tricks for HP -UX

Tips and Tricks for HP-UX Certification Part #2 - Page 22

page 22

Filesystems & LVM (cont.)

• Review § Whole-Disk and LVM

• LVM§ Physical Extent (PE) -- is the smallest amount of disk

space that can be allocated to a logical volume.o By default, a physical extent occupies 4 mb of disk

space.§ Logical Extent (LE) – similar to a PE. A pointer in

kernel memory to a PE on a physical volume.

• A logical volume may have some LE on one disk and some on another disk. Thus, a Logical Volume can span multiple disk drives.

Page 99: Tips and Tricks for HP-UX Certificationdbmanagement.info/Books/MIX/HP_unix_book_for_certification_hp_unix...• Pass the HP-UX System Administration Exam. Tips and Tricks for HP -UX

Tips and Tricks for HP-UX Certification Part #2 - Page 23

page 23

LVM Commands

• Review§ pvdisplay§ vgdisplay§ lvdisplay§ pvcreate§ vgcreate§ lvcreate§ vgextend§ lvextend

• Remember that vgdisplay is very useful in finding out maximum values of LV, PV, PE/PV and alternate links.

• Pvdisplay– For listing physical volumes.– Lists the name of the vg, total # of physical extents, and free/allocated PEs.– Can use –v option for more detail such as logical Volumes.– Uses a block device file as its argument.– # pvdisplay /dev/dsk/c2t5d0

• Vgdisplay– For listing volume groups information.– Used for checking physical extent sizes when creating lvol’s from a particular vg.– Used to find out a list of all logical/physical volumes that belong to a certain

volume group.– File system mount points are not listed via vgdisplay.– # vgdisplay /dev/vg00

• Important Notes:

• By default, 255 logical volumes can be created in a volume group.• The pvcreate –f /dev/rdsk/c2t5d0 will force the creation of a PV.• The mediainit command will format and analyze the integrity of a disk. Normally all

disks are formatted and it is not necessary to– run mediainit. You need to use a raw device file as its argument.–– lvdisplay– For listing logical volumes information.– Can use –v option for more detail such as physical Volumes.– # lvdisplay /dev/vg00/lvol4

Page 100: Tips and Tricks for HP-UX Certificationdbmanagement.info/Books/MIX/HP_unix_book_for_certification_hp_unix...• Pass the HP-UX System Administration Exam. Tips and Tricks for HP -UX

Tips and Tricks for HP-UX Certification Part #2 - Page 24

page 24

Creating Volume Groups

• Creating a physical volume :§ # pvcreate /dev/rdsk/c2t5d0

o Note: Used for creating a boot strap area with the –B option.

• Create a directory in /dev with the group name.o # mkdir /dev/vg03

• Create the group special file in this directory.–Example: To create a group special file for group vg03

# mknod /dev/vg03/group c 64 0x030000• Create a volume group using the vgcreate command

o # vgcreate /dev/vg03 /dev/dsk/c2t5d0• Create a logical volume using the lvcreate command

o # lvcreate –L 800 –n myvolume vg03

• Each /dev/*/group file minor number needs to be unique; there can only be one /dev/vg03/group c 64 0x030000 (the 0x030000 minor number for this major number must be unique; there is nothing to prevent you from creating a duplicate [say /dev/vgmickey/group c 64 0x030000] and overwriting the volume group information on vg03.

• Review the LVM Major and Minor #:– # ll /dev/vg03– 64 0x030000 group– 64 0x030001 lvol1– 64 0x030002 lvol2

Page 101: Tips and Tricks for HP-UX Certificationdbmanagement.info/Books/MIX/HP_unix_book_for_certification_hp_unix...• Pass the HP-UX System Administration Exam. Tips and Tricks for HP -UX

Tips and Tricks for HP-UX Certification Part #2 - Page 25

page 25

Screenshot #9: Sys Admin

Page 102: Tips and Tricks for HP-UX Certificationdbmanagement.info/Books/MIX/HP_unix_book_for_certification_hp_unix...• Pass the HP-UX System Administration Exam. Tips and Tricks for HP -UX

Tips and Tricks for HP-UX Certification Part #2 - Page 26

page 26

LVM Data Structures

• LVM Data Structure contains:§ PVRA (Phys Volume Reserve Area)

o Created by pvcreate command and contains physical volume information

§ VGRA (Volume Group Reserve Area)o Created by the vgcreate command and contains the volume

group status area (VGSA) and volume group descriptor area (VGDA), which contains device driver information used for the vg.

§ Bad block relocation area (BBRA)o An area at the end of the disk used by LVM whenever a

physical defect is seen on the phys volume.o This area is created by the pvcreate command

Page 103: Tips and Tricks for HP-UX Certificationdbmanagement.info/Books/MIX/HP_unix_book_for_certification_hp_unix...• Pass the HP-UX System Administration Exam. Tips and Tricks for HP -UX

Tips and Tricks for HP-UX Certification Part #2 - Page 27

page 27

File Systems

• A file system is divided into 2 major parts:§ User area

o Contains actual user data (data that you store in files)§ Metadata area

o Contains file system structural information partitioned as:– Superblock

• Contains info about file system type, size, pointers

– Inodes

• Keeps records of file attributes, such as owner and group of file, file permissions, type of file, number of hard links associated with the file, time and date stamps and file size. Has pointers to file data area.

– Directory area -- keeps records of filenames & related Inode #s.

• Directory Area: Ex. When you use the cat command to display the contents of a file, HP-UX goes to the directory area to find the inodenumber assoc. with the file. It then locates the inode and it gets a pointer to the data area of the file. After that, it displays the contents of that area on your terminal screen.

Page 104: Tips and Tricks for HP-UX Certificationdbmanagement.info/Books/MIX/HP_unix_book_for_certification_hp_unix...• Pass the HP-UX System Administration Exam. Tips and Tricks for HP -UX

Tips and Tricks for HP-UX Certification Part #2 - Page 28

page 28

File System Types

• HFS (High Performance File System)§ Is used for the /stand mount point where the HP-UX

kernel is stored.• JFS (Journaled File System)§ HPUX version of the Veritas Journaled File System

(VxFS)• NFS (Network File System)§ Is used for mounting file systems over the network

from a file server. • CDFS (CD-ROM File System)

continued on next slide

Page 105: Tips and Tricks for HP-UX Certificationdbmanagement.info/Books/MIX/HP_unix_book_for_certification_hp_unix...• Pass the HP-UX System Administration Exam. Tips and Tricks for HP -UX

Tips and Tricks for HP-UX Certification Part #2 - Page 29

page 29

HFS - High Performance File System

• HFS is considered the legacy file system for HP-UX§ It is still in use for the /stand directory

§ HFS Superblock§ Occupies the first 8 kbytes of all HFS file systems§ The superblock contains pointers to the metadata area§ HFS contains more than one copy of the superblock§ HFS redundant superblock copies are recorded in /var/adm/sbtab

§ HFS Block§ Is the minimum data read in one read request§ The default HFS block size is 8 kbytes§ Default Range 4 –64 max

• HFS Fragment§ The smallest unit of data that can be allocated to a file.§ HFS blocks are divided into fragments

• HFS is easy to manage, but you can not reduce its size

• I recommend viewing the /var/adm/sbtab file.– Note the first address = to 16.

Page 106: Tips and Tricks for HP-UX Certificationdbmanagement.info/Books/MIX/HP_unix_book_for_certification_hp_unix...• Pass the HP-UX System Administration Exam. Tips and Tricks for HP -UX

Tips and Tricks for HP-UX Certification Part #2 - Page 30

page 30

JFS – Journaled File System

• JFS is the HP-UX version of Veritas Journaled File System (vxfs)

• Advantages of JFS vs. HFS:§ JFS has faster recovery features§ JFS creates inodes dynamically§ Multiple copies of the superblock are kept, but not in a file§ All metadata updates are recorded in the JFS Intent log for

recovery purposes• HP OnlineJFS (Advanced JFS)§ Is an extension of the base JFS§ File systems can managed online without unmounting§ This is an optional product that must be purchased

separately

• JFS also divides the file system in BLOCKS• Default BLOCK size is 1 KB• EXTENTS consist of a group of BLOCKS

Page 107: Tips and Tricks for HP-UX Certificationdbmanagement.info/Books/MIX/HP_unix_book_for_certification_hp_unix...• Pass the HP-UX System Administration Exam. Tips and Tricks for HP -UX

Tips and Tricks for HP-UX Certification Part #2 - Page 31

page 31

Creating a new file system

• The newfs command:§ newfs –F vxfs /dev/vg03/rlvol4

o Creates a newfs on /dev/vg03/lvol4§ newfs –F hfs –b 2048 /dev/vg01/rlvol1

o Creates an HFS file system with block size of 2kbytes• Create a mount point:§ # mkdir /apps

• Mount the new file system § # mount –F vxfs /dev/dsk/lvol4 /apps

• For automatic mounting at startup add an entry to /etc/fstab§ /dev/vg03/lvol4 /apps vxfs delaylog 0 2

• Review the /etc/fstab file entries• /etc/default/fs

– contains the default filesystem type for file system creation.– The fstyp command

• Note: During he boot process, the /sbin/init.d/localmount script is executed.

Page 108: Tips and Tricks for HP-UX Certificationdbmanagement.info/Books/MIX/HP_unix_book_for_certification_hp_unix...• Pass the HP-UX System Administration Exam. Tips and Tricks for HP -UX

Tips and Tricks for HP-UX Certification Part #2 - Page 32

page 32

Managing a file system

• Extending volume groups:# pvcreate /dev/rdsk/c0t3d0# vgextend vg03 /dev/dsk/c0t3d0

• Extending logical volumes:# lvextend –L 800 /dev/vg03/lvol4

• Extending a file system:# extendfs –F vxfs /dev/vg03/lvol4

o Filesystem must first be unmounted before using.o If using HFS, use hfs instead of vxfs

• Use fsadm for extending a file system using Online JFS:# fsadm –F vxfs –b 819200 /extra§ There is no need to unmount the file system to extend it

• Alternate way of using fsadm:– # fsadm –F vxfs –b 800M /extra

Page 109: Tips and Tricks for HP-UX Certificationdbmanagement.info/Books/MIX/HP_unix_book_for_certification_hp_unix...• Pass the HP-UX System Administration Exam. Tips and Tricks for HP -UX

Tips and Tricks for HP-UX Certification Part #2 - Page 33

page 33

Additional file system commands

For your review:• fsck§ To check and repair HFS and JFS file systems.§ Before running manually, you must un-mount a file

system.# fsck –F vxfs /dev/vg02/rlvol3

• fuser• Command checks to see if a file system is currently in use. • # fuser /home

• mount –v• Command lists mounted file systems.

• bdf• Lists mounted file systems and file system usage.

• fuser - Can be used for any file or mounted file system to see the active users/processes accessing a given file.

• To terminate processes that are using /home do the following– # fuser –ku –c /home

• Review the umount command– # umount –aF vxfs does what?

Page 110: Tips and Tricks for HP-UX Certificationdbmanagement.info/Books/MIX/HP_unix_book_for_certification_hp_unix...• Pass the HP-UX System Administration Exam. Tips and Tricks for HP -UX

Tips and Tricks for HP-UX Certification Part #2 - Page 34

page 34

User and group management

• Creating/Deleting/Modifying Users: § useradd <option> <name>§ userdel –r <name>

o Deletes a usero The –r option deletes the users home directory

§ usermod is used to modify user attributes such as: id and shello To close a user acct on specific date:

– usermod –e 10/13/99 boota

Page 111: Tips and Tricks for HP-UX Certificationdbmanagement.info/Books/MIX/HP_unix_book_for_certification_hp_unix...• Pass the HP-UX System Administration Exam. Tips and Tricks for HP -UX

Tips and Tricks for HP-UX Certification Part #2 - Page 35

page 35

The password and group file

• Fields in /etc/passwd:Login name: encrypt passwd: UID: GroupID: IDString: /HOME: Sh

• The /etc/group file contains 4 fields separated by colonsGroup Name:Group Password:Group ID:Group ListExample: Sys::3:root,uucp

• Manipulating Users and Groups:§ groupadd - used to add a group§ groupdel – used to delete a group§ groupmod – used to modify group name or id§ useradd – used to add users§ userdel – used to delete users§ usermod – used to modify users§ What is /etc/skel?

• REMEMBER: A nobody user has a UID of –2 with minimum access rights.

• To edit the the /etc/passwd file use the vipw command to put a lock on the file.

• To verify the consistency of the /etc/passwd file use the pwckcommand. After a new user is created, an entry is created in the/etc/passwd file

– Alberto:*:1225:20::/home/alberto:/sbin/sh§ The /etc/passwd file contains 7 fields

– Each field is separated by a colon– The 5th field, or ID String field is optional– An asterisk ‘ * ‘ in the second column indicates a user password has not

been assigned and its disable– The password is encrypted and it is known only to the USER

• /etc/skel– Directory contains the default configuration files for new users.– These files are copied to the newly created home dir of a user when

the useradd command is executed with the –m option.

• * User startup files:– .exrc– .cshrc– .login– .profile

Page 112: Tips and Tricks for HP-UX Certificationdbmanagement.info/Books/MIX/HP_unix_book_for_certification_hp_unix...• Pass the HP-UX System Administration Exam. Tips and Tricks for HP -UX

Tips and Tricks for HP-UX Certification Part #2 - Page 36

page 36

HP-UX processes

• Every process is assigned a unique identification number called the Process ID (PID)

• A process that creates another process is the PARENTand its ID is the Parent Process ID (PPID)

• Use the ps –ef command to list process attributes.• A process is considered to be in 5 states: running,

sleeping, ready to run, stopped, zombie• An & symbol is used for adding programs to run in the

background.

• During System startup, swapper is created with PID 0. The swapper process initiates the init process with PID 1.The init process is responsible for using the FORK system call to create other processes.

Page 113: Tips and Tricks for HP-UX Certificationdbmanagement.info/Books/MIX/HP_unix_book_for_certification_hp_unix...• Pass the HP-UX System Administration Exam. Tips and Tricks for HP -UX

Tips and Tricks for HP-UX Certification Part #2 - Page 37

page 37

Screenshot #10: Sys Admin

Page 114: Tips and Tricks for HP-UX Certificationdbmanagement.info/Books/MIX/HP_unix_book_for_certification_hp_unix...• Pass the HP-UX System Administration Exam. Tips and Tricks for HP -UX

Tips and Tricks for HP-UX Certification Part #2 - Page 38

page 38

Signals and the kill command

• Signals are used to send information to a process or to handle an exception. Signals are sent using the killcommand.

• Review the kill commandkill [-signal] PID

• nohup§ Command executes another command with the hang up

and quit signals ignored, useful if a process should stay running after logging out of terminal.

• What signal is sent by default?– SIGTERM (15)

Page 115: Tips and Tricks for HP-UX Certificationdbmanagement.info/Books/MIX/HP_unix_book_for_certification_hp_unix...• Pass the HP-UX System Administration Exam. Tips and Tricks for HP -UX

Tips and Tricks for HP-UX Certification Part #2 - Page 39

page 39

Process nice value examples

• What is a nice value?§ Default Value = 20

• Examples:§ To run a program at a nice value of 25 (lower)

# nice - 5 myprog § To run a program at a nice value of 15 (higher)

# nice - - 5 myprog§ To run a program with a nice priority of 5 (higher)

# nice - - 15 myprog§ To run a program with a nice value of 29 (lower & background)

# nice - 5 myprog &§ To run the vi editor at a nice level of 30 instead of 20

# nice vi

• Used as a factor in calculating how fast a process regains priority.• The command ps –efl will list nice values• Nice Value ranges 0-39; 0 highest priority; 39 lowest priority• Default is 20• Init runs with a nice 20, all process inherits nice value from parent.• The nice command can be used by non root users to specify a lower

nice value by increasing the number– Without options, the default nice value is 10.– “&” sign

• Is used for running programs in the background• Adds by default a value of 4• Meaning the program will run at a nice level of 24 instead of 20

– A single negative (-) symbol is used when lowering a priority.– A double negative (--) symbol is used when raising a priority

Page 116: Tips and Tricks for HP-UX Certificationdbmanagement.info/Books/MIX/HP_unix_book_for_certification_hp_unix...• Pass the HP-UX System Administration Exam. Tips and Tricks for HP -UX

Tips and Tricks for HP-UX Certification Part #2 - Page 40

page 40

Screenshot #11: Nice Values

Page 117: Tips and Tricks for HP-UX Certificationdbmanagement.info/Books/MIX/HP_unix_book_for_certification_hp_unix...• Pass the HP-UX System Administration Exam. Tips and Tricks for HP -UX

Tips and Tricks for HP-UX Certification Part #2 - Page 41

page 41

Other process commands

• renice command changes nice values for running processes.§ Example: to change background program from 24 to 25 with

PID 5116# renice –n 5 5116**renice cmd determines with respect to the default of 20**

• timex§ Calculates the time used by a command

• trap§ Captures signals and takes an action if a particular signal is

received§ A trap, if set, will execute a specific command or other script§ Example

–Trap l̀s /etc’ INT –CNTL C will execute the ls /etc command and list the /etc directory

Page 118: Tips and Tricks for HP-UX Certificationdbmanagement.info/Books/MIX/HP_unix_book_for_certification_hp_unix...• Pass the HP-UX System Administration Exam. Tips and Tricks for HP -UX

Tips and Tricks for HP-UX Certification Part #2 - Page 42

page 42

HP-UX print commands

• lp• cancel• lpadmin• lpmove• enable/disable• accept/reject

• lpstat• lpalt• lpsched• lpana• lpfence

• *If no destination printer is specified, the spooler system checks for a LPDEST environment variable. In case this variable is not present the default queue is checked. If there is no default queue and the LPDEST variable is not defined, an error message is printed.

• Lp command– Command is used for sending a print request– You can send requests to a printer or class– For example, to print the /etc/hosts file to the LJ4 printer:

# lp –dLJ4 /etc/hostsRequest ID is LJ4-345 (1 file)• LJ4 is the printer name and the 345 is a sequence number• -d option specifies a destination printer name*

• cancel– Command is used to cancel a print requests

# cancel LJ4-345• lpadmin

– Used for adding, modifying and deleting printers.– Adding: # lpadmin –plaser –mhplj4 –v/dev/ lp– Deleting: # lpadmin –xlaser

• lpmove– Command is used for moving print jobs*

Examples: – To move print job LJ4-345 to printer hp01

# lpmove LJ4-345 hp01– To move all print jobs from printer (hp01) to (hp03)

# lpmove hp01 hp03 continued on next page

Page 119: Tips and Tricks for HP-UX Certificationdbmanagement.info/Books/MIX/HP_unix_book_for_certification_hp_unix...• Pass the HP-UX System Administration Exam. Tips and Tricks for HP -UX

Tips and Tricks for HP-UX Certification Part #2 - Page 43

continued from previous page

• Enabling & Disabling Printers– Determines whether a printer will print requests sent to a queue

Example: To enable and disable printer hp03# enable hp03# disable hp03

– The –c option will cancel all requests on the designated printer.§ Accepting and rejecting print requests

– Determines whether a user can send a request to a printer queue– Command to temporarily disconnect a printer for maintenance

Examples:# accept hp03# reject –r “hp03 is temporarily out of order” hp03

• lpstat– Command is used to check current printer status

• lpsched daemon– It is invoked by the /sbin/rc script at boot time– If the –v and –a options are used, it writes its log data in the /var/adm/lp

directory– Stopping the print scheduler: /usr/sbin/lpshut– Restarting the print scheduler: /usr/sbin/lpsched

• lpalt– Command is used for modifying print requests– Uses the same lp command options

Example: To modify print request LJ4-345 to 3 copies# lpalt LJ4345 –n3

• lpana• Command is used to check print spooler performance

• Fence priority– Determines the minimum priority that a print job must carry to be

printed– The lpfence command is used

• Example: To set a fence priority of 5 with printer hp03, use thefollowing:

# lpfence hp03 5– After making this change, any job sent to the printer that has a

priority lower than 5 will sit in the print queue and will never be printed.

Page 120: Tips and Tricks for HP-UX Certificationdbmanagement.info/Books/MIX/HP_unix_book_for_certification_hp_unix...• Pass the HP-UX System Administration Exam. Tips and Tricks for HP -UX

Tips and Tricks for HP-UX Certification Part #2 - Page 44

page 44

Swap space management

• Types of Swap:§ Device

o Disk area or logical volume used exclusively for SWAP*o With LVM, you can use an entire logical volume as device swapo After creating swap space, use the swapon command on the

designated logical volume or disk to enable it§ File System

o Swap area that coexists with other filesystems and can be configured dynamically.

§ Primaryo Is the swap space available at boot time

§ Secondaryo File system swap is always secondary swap, you can also use device

swap. o The swapinfo command

• For the WHOLE DISK or disk area approach, if you are using a swap area of 200mbs at the end of disk device c2t5d0 and rest of it for a file system, the newfs command can reserve this space as follows:

# newfs –R 200 /dev/rdsk/c2t5d0• When using LVM, create a separate logical volume for device SWAP.

# lvcreate –L 200 –n swaplv –C y –r n /dev/vg03• /etc/fstab entry samples

/dev/vg03/swaplv . swapdefaults 0 0 (Device Swap

using LVM)/dev/dsk/c2t5d0 . swap

defaults 0 0 (Device Swap Whole-Disk)

. /hpswap swapfs lim=200 0 0(File system swap)

When the system boots, the /sbin/init.d/swap_start script is executed in run level 1 to execute the swapon command

continued on next page

Page 121: Tips and Tricks for HP-UX Certificationdbmanagement.info/Books/MIX/HP_unix_book_for_certification_hp_unix...• Pass the HP-UX System Administration Exam. Tips and Tricks for HP -UX

Tips and Tricks for HP-UX Certification Part #2 - Page 45

continued from previous page

• swapon– Command is used for creating/enabling swap space.

• Using LVM– Example: On logical volume swaplv in volume group vg03

# swapon /dev/vg03/swaplv• Using Whole-Disk

– Example: Want to use the c2t5d0 disk# swapon /dev/dsk/c2t5d0

– If using whole-disk approach, use a –e option for leaving space at the end of the disk# swapon –e /dev/dsk/c2t5d0

– If you want to create swap with a priority 3: # swapon –p 3 /dev/dsk/c2t5d0

• To create file system swap mounted on /hpswap dir: – # swapon –l 200M /hpswap -> command puts a max 200mb on the

swap area directory /hpswap/paging• To activate swap at boot time, its information must be entered in the

/etc/fstab file*– swapon –a will activate all swap entries in this file

Page 122: Tips and Tricks for HP-UX Certificationdbmanagement.info/Books/MIX/HP_unix_book_for_certification_hp_unix...• Pass the HP-UX System Administration Exam. Tips and Tricks for HP -UX

Tips and Tricks for HP-UX Certification Part #2 - Page 46

page 46

Methods of backup

§ cpio§ dump/restore§ vxdump/vxrestore§ pax§ tar – Supported across Unix platforms§ fbackup/frecover – HP-UX only; and files larger than 2 gb§ dd – used to copy raw data from one place to the other§ Ignite-UX – remember make_recovery

NOTE: data backed up with one method can NOT be restored with another method

• Make sure you know the difference between tar and fbackup.– See Chapter 23 page 443 of the “HP Certified Book” by Rafeeq Ur

Rehman

Page 123: Tips and Tricks for HP-UX Certificationdbmanagement.info/Books/MIX/HP_unix_book_for_certification_hp_unix...• Pass the HP-UX System Administration Exam. Tips and Tricks for HP -UX

Tips and Tricks for HP-UX Certification Part #2 - Page 47

page 47

Using fbackup and frecover

• Types of backups§ Full and Incremental

• Using fbackup and frecover• Use graph files –g option and the –u option for

incremental backups§ Example: To create a tape backup using a graph file

at level 2# fbackup –v –g gfile –u –2 –f /dev/rmt/0m

NOTE: If there is no previous backup (levels 0 or 1), this will be your first full backup!

Example: Restoring data from a tape drive# frecover –xvf /dev/rmt/0m –g gfile

– Example: To backup the /etc directory and exclude the /etc/lp on the tape drive:

# fbackup –v –f /dev/rmt/0m –i /etc –e /etc/lp– The –i option is used to include files or directories– The –e option is used to exclude some subdirectories– The –f option is the device used for backup

– # frecover –x –v -f /dev/rmt/0m -> restores data from tape driveUse the –r option if you want to recover everything

• When using the fbackup command with the –u option, it updates the /var/adm/fbackupfiles/dates.The dates file will be created or appended ONLY if the subdirectory /var/adm/fbackupfiles already exists.

• Sample gfile:i /etci /homei /var/spool/croni /var/maile /etc/lp

Page 124: Tips and Tricks for HP-UX Certificationdbmanagement.info/Books/MIX/HP_unix_book_for_certification_hp_unix...• Pass the HP-UX System Administration Exam. Tips and Tricks for HP -UX

Tips and Tricks for HP-UX Certification Part #2 - Page 48

page 48

Automating jobs using cron

• Cron daemon§ Serves 2 types of jobs: cron and at jobs

o crontab commando at command

• cron daemon is started at boot time at run level 2§ It reads the crontab and at files created in the

/var/spool/cron directory at startup and schedules the programs for a given time

• cron daemon is stopped at run level 1§ cron startup script is /sbin/init.d/cron start§ To enable/disable cron, modify /etc/rc.config.d/cron file

from 1 to 0.

Page 125: Tips and Tricks for HP-UX Certificationdbmanagement.info/Books/MIX/HP_unix_book_for_certification_hp_unix...• Pass the HP-UX System Administration Exam. Tips and Tricks for HP -UX

Tips and Tricks for HP-UX Certification Part #2 - Page 49

page 49

Automating jobs

• Granting and denying access to users: § /var/adm/cron/cron.allow and cron.deny

Only the root user can use cronXX (empty)

Only the root user can use cronX (empty)

Only those users listed in cron.allow can use cron

XX

Only those users listed in cron.allow can use cron

X

All users can use cronX (empty)

All users except those in cron.deny can use cronX

Only the root user can use cron

Effect on User.deny.allow

• The same rules apply for at - at.allow and at.deny

Page 126: Tips and Tricks for HP-UX Certificationdbmanagement.info/Books/MIX/HP_unix_book_for_certification_hp_unix...• Pass the HP-UX System Administration Exam. Tips and Tricks for HP -UX

Tips and Tricks for HP-UX Certification Part #2 - Page 50

page 50

Format of crontab file

• crontab file contains scheduled jobs.§ The crontab file contains 6 fields and is located in

/var/spool/cron/crontabs.• Fields:§ Minute hour date month day of week command

• Crontab entries § Multiple values can be entered; are separated by a ,§ An asterisk (*) shows all values§ A hash symbol (#) is considered a comment§ Options: syntax: crontab <option>

o -l option will list the contents of the crontab fileo -e option is used for editing and submitting a cron fileo -r option is used for removing all your scheduled cron jobs

§ Log files are created in /var/adm/cron/log

• Executing the crontab command:# crontab mycrontabIf you are logged in as user1 and have created a mycrontab file in your home directory, this command will create a file with the name of user1 under the /var/spool/cron/crontabs directory.

Page 127: Tips and Tricks for HP-UX Certificationdbmanagement.info/Books/MIX/HP_unix_book_for_certification_hp_unix...• Pass the HP-UX System Administration Exam. Tips and Tricks for HP -UX

Tips and Tricks for HP-UX Certification Part #2 - Page 51

page 51

Crontab examples

• Examples: § To copy the /etc/passwd file to /etc/passwd.bak on the first

and sixteenth days of every month at 1:30 pm30 13 1,16 * * /usr/bin/cp /etc/passwd /etc/passwd.bak

§ Entries in the cron file showing execution every weekday at 6:30pm?

30 18 * * 1-5 <command>

§ Entries in the cron file showing execution every 10 minutes, every hr, every day?

0,10,20,30,40,50 * * * * <command>

§ Entries every Mon – Wed – Fri at 6:30pm?30 18 * * 1,3,5 <command>

Page 128: Tips and Tricks for HP-UX Certificationdbmanagement.info/Books/MIX/HP_unix_book_for_certification_hp_unix...• Pass the HP-UX System Administration Exam. Tips and Tricks for HP -UX

Tips and Tricks for HP-UX Certification Part #2 - Page 52

page 52

Screenshot #12: Sys Admin

Page 129: Tips and Tricks for HP-UX Certificationdbmanagement.info/Books/MIX/HP_unix_book_for_certification_hp_unix...• Pass the HP-UX System Administration Exam. Tips and Tricks for HP -UX

Tips and Tricks for HP-UX Certification Part #2 - Page 53

page 53

Using the at command

• Used to execute a job at a specified time only onceExample:We want to execute a script in /home/alberto/myscript

$ at –t 10101310 (see notes for more examples)/home/alberto/myscriptCTRL-DJob 934018720.a at Wed Oct 10th 13:10:00 2003$

A record of spooled at jobs is created in the directory: /var/spool/cron/atjobs

• Listing and deleting jobs:§ at –l -> lists current jobs§ at –r 945018720.a -> removes the job

• More examples:– # at 1210 Dec 08– # at 12:10 Dec 08– # at 12:10am tomorrow– # at now + 1 day– # at now + 10 minutes

Page 130: Tips and Tricks for HP-UX Certificationdbmanagement.info/Books/MIX/HP_unix_book_for_certification_hp_unix...• Pass the HP-UX System Administration Exam. Tips and Tricks for HP -UX

Tips and Tricks for HP-UX Certification Part #2 - Page 54

Page 131: Tips and Tricks for HP-UX Certificationdbmanagement.info/Books/MIX/HP_unix_book_for_certification_hp_unix...• Pass the HP-UX System Administration Exam. Tips and Tricks for HP -UX

Tips and Tricks for HP-UX Certification Part #3 - Page 1

© 2003 Hewlett-Packard Development Company, L.P.The information contained herein is subject to change without notice

HPCS Technical On-line Seminar Program

Part 3:

Networking (30)

Page 132: Tips and Tricks for HP-UX Certificationdbmanagement.info/Books/MIX/HP_unix_book_for_certification_hp_unix...• Pass the HP-UX System Administration Exam. Tips and Tricks for HP -UX

Tips and Tricks for HP-UX Certification Part #3 - Page 2

page 2

Part 3: topics covered

• Basic concepts• Network components and topologies• TCP/IP protocol• Netmasks and subnetting• Configuring LAN interface adapters• ARPA/Berkeley services• Host name resolution and DNS• Configuring and managing NIS and NFS• HP-UX Automounter• NTP (Network Time Protocol)

Page 133: Tips and Tricks for HP-UX Certificationdbmanagement.info/Books/MIX/HP_unix_book_for_certification_hp_unix...• Pass the HP-UX System Administration Exam. Tips and Tricks for HP -UX

Tips and Tricks for HP-UX Certification Part #3 - Page 3

page 3

Basic networking concepts

• Local & Wide Area Networks (LAN/WAN)§ Standards in the modern computer enterprise§ LANs cover a limited distance§ WANs cover larger geographical distances and usually connect LANs

o WAN examples: Internet, ATM Machines• Protocol§ A set of rules and regulations that govern communication between 2

computers attached to a network• Host§ Or node, is a computer attached to the network

• Physical Medium§ Is the communication medium that connects devices in a network§ It is the cabling involved: coaxial, TP, fiber, satellite links, and

microwaves in wireless LANS.• Network Interface Adapter§ Is installed inside a computer§ It is used to connect a computer to a physical medium.

Page 134: Tips and Tricks for HP-UX Certificationdbmanagement.info/Books/MIX/HP_unix_book_for_certification_hp_unix...• Pass the HP-UX System Administration Exam. Tips and Tricks for HP -UX

Tips and Tricks for HP-UX Certification Part #3 - Page 4

page 4

Basic networking concepts

• Bandwidth§ Data transfer capacity of the physical medium§ The greater the bandwidth the faster the data transfer

• Client§ Is a system or a user program that requests a service from

a host on a network• Server§ Is a host or software program that responds to a request

from a client• Route§ Is a data communication path between a source and

destination host on a network

Page 135: Tips and Tricks for HP-UX Certificationdbmanagement.info/Books/MIX/HP_unix_book_for_certification_hp_unix...• Pass the HP-UX System Administration Exam. Tips and Tricks for HP -UX

Tips and Tricks for HP-UX Certification Part #3 - Page 5

page 5

OSI Model – 7 layers

• Layer 7 – Application§ Provides user interface to the network

Example: telnet, ftp, rlogin – “What the user runs”• Layer 6 – Presentation§ Provides data format conversion

Example: ASCII vs. EBCDIC - “Translator” • Layer 5 – Session§ Establishes, manages and terminates a communication

sessionExample: Socket - “Terminal Emulator”

• Layer 4 – Transport§ Used for reliable data transfer b/w source & destination

Example: TCP - “Software Error Correction”

“ Please Do Not Throw Sausage Pizza Away!”

Page 136: Tips and Tricks for HP-UX Certificationdbmanagement.info/Books/MIX/HP_unix_book_for_certification_hp_unix...• Pass the HP-UX System Administration Exam. Tips and Tricks for HP -UX

Tips and Tricks for HP-UX Certification Part #3 - Page 6

page 6

OSI Model – 7 layers (cont.)

• Layer 3 – Network§ Assigns network addresses and routing information to

hostsExample: Routers - “ Addressing Scheme”

• Layer 2 - Data link§ Error free data transfer over physical mediums§ Divided into logical link and medium access

Example: Mac addresses, switches, bridges - “Hardware Error Correction”

• Layer 1 – Physical§ Converts frames from DLL and converts them into

electrical signals of 0s and 1sExample: Cabling, transceivers, repeaters, hubs –“Physical Cabling”

Page 137: Tips and Tricks for HP-UX Certificationdbmanagement.info/Books/MIX/HP_unix_book_for_certification_hp_unix...• Pass the HP-UX System Administration Exam. Tips and Tricks for HP -UX

Tips and Tricks for HP-UX Certification Part #3 - Page 7

page 7

Peer protocols and network topologies

• Peer protocols§ Are layers having the same layer number on both the source and

destination hosts in the OSI protocol stack§ These 2 layers communicate with each other to acknowledge the

accurate transfer of data• Interfaces§ Are the rules and regulations that govern data transfer between 2

adjacent layers in the OSI model• Network Topologies:§ Bus

o Hosts are connected to a common bus, usually a cable.§ Star

o Hosts are connected to a central place, a hub.§ Ring

o Hosts are connected in a ring structure, data is transferred host to host in the order defined in the ring.

§ Hybrid§ A combination of different topologies.

• Peer Protocols Ex. The transport layers on the sending and receiving side of data are responsible for end to end data error detectionand recovery process.

Page 138: Tips and Tricks for HP-UX Certificationdbmanagement.info/Books/MIX/HP_unix_book_for_certification_hp_unix...• Pass the HP-UX System Administration Exam. Tips and Tricks for HP -UX

Tips and Tricks for HP-UX Certification Part #3 - Page 8

page 8

Network hardware components

• Network Cables§ Coaxial

o BNC connectors connect them, terminators end signals§ Twisted Pair

o Commonly used cat3 (10mb/s) or cat5 (100mb/s)§ Fiber Optic

o Excellent reliability for data transfer. $$$$.• Cable Connectors§ BNC

o Used with coaxial cable. A BNC connector is built into the network interface adapter.

§ LAN-TPo Used with twisted pair. The socket is built into the network interface

adapter.§ AUI

o Attachment unit interface is a 15 pin connector used to connect a network interface adapter to a thin or thick coaxial, twisted pair, or fiber optic cable with the help of a transceiver.

Page 139: Tips and Tricks for HP-UX Certificationdbmanagement.info/Books/MIX/HP_unix_book_for_certification_hp_unix...• Pass the HP-UX System Administration Exam. Tips and Tricks for HP -UX

Tips and Tricks for HP-UX Certification Part #3 - Page 9

page 9

Network hardware components (cont.)

• Transceiver§ Acts as medium attachment unit (MAU) and its function is to connect a

network interface adapter with a particular type of cable• Repeaters

• Physical layer device used to regenerate signals• Hubs

• Connect a number of hosts• A hub also functions as a repeater. Multiport repeater.

• Bridges• Connect LAN segments allowing data to be transmitted without collisions

• Switches§ Multiport bridge.

• Routers§ Connect LANs and WANs§ Filters and routes traffic§ A router can perform all tasks of a bridge and switch

• Gateway• Is a router that connects 2 dissimilar networks

Example: Connecting a Novell Netware LAN to a TCP/IP network

Page 140: Tips and Tricks for HP-UX Certificationdbmanagement.info/Books/MIX/HP_unix_book_for_certification_hp_unix...• Pass the HP-UX System Administration Exam. Tips and Tricks for HP -UX

Tips and Tricks for HP-UX Certification Part #3 - Page 10

page 10

MAC addresses and access methods

• MAC addresses are unique hexadecimal address assigned to each network interface adapter

• MACs are used with all network types• Every adapter installed in a system has its own unique MAC• A host has as many MAC addresses as the number of network

adapters installed§ To check your MAC address, use the lanscan command

• Access methods refer to the physical transmission medium and the data sent over it.§ CSMA/CD – (Carrier sense multiple access with collision detection)

o Checks the medium before starting the transmissiono Not used in token ring

§ Token passingo Uses a data frame as the token is passed from one host to the other

Page 141: Tips and Tricks for HP-UX Certificationdbmanagement.info/Books/MIX/HP_unix_book_for_certification_hp_unix...• Pass the HP-UX System Administration Exam. Tips and Tricks for HP -UX

Tips and Tricks for HP-UX Certification Part #3 - Page 11

page 11

Network types

• Ethernet and IEEE 802.3§ Are basically the same network standards§ Both can coexist on a network segment§ 10base2 Ethernet – “ Thin Ethernet “

o 10mbits per secondo Cable segment is 185 meters with up to 4 repeaterso Coaxial cable

§ 10base5 Ethernet – “ Thick Ethernet ”o 10mbits per secondo Cable segment is 500 meters

§ 10baseTo 10mbits per secondo Cable segment is 100 meters

Page 142: Tips and Tricks for HP-UX Certificationdbmanagement.info/Books/MIX/HP_unix_book_for_certification_hp_unix...• Pass the HP-UX System Administration Exam. Tips and Tricks for HP -UX

Tips and Tricks for HP-UX Certification Part #3 - Page 12

page 12

Network types (cont.)

• 100baseT – “Fast Ethernet”o 100 mbits per secondo Cable segment is 100 meterso Cat5 twisted pair cables are used

• Token ring and IEEE 802.5§ A data token is passed from one host to another in

the network in a pre-defined sequence§ Considered a physically connected star topology

• FDDI§ Fiber optic cabling

Page 143: Tips and Tricks for HP-UX Certificationdbmanagement.info/Books/MIX/HP_unix_book_for_certification_hp_unix...• Pass the HP-UX System Administration Exam. Tips and Tricks for HP -UX

Tips and Tricks for HP-UX Certification Part #3 - Page 13

page 13

TCP/IP protocol

• Transmission Control Protocol/Internet Protocol§ Is the most widely used network protocol in the world§ This is a 5 layer protocol where the lower four layers of the

protocol stack resemble the OSI model• Application§ Is the Application, Presentation and Session layers of the OSI

Model§ Transport – same as the OSI§ Network – “”§ Data link –””§ Physical –””

• Involves IP addressing - 5 classes: A,B,C,D,E§ A – range from 1 – 127§ B – range from 128 – 191§ C – range from 192 – 255

Page 144: Tips and Tricks for HP-UX Certificationdbmanagement.info/Books/MIX/HP_unix_book_for_certification_hp_unix...• Pass the HP-UX System Administration Exam. Tips and Tricks for HP -UX

Tips and Tricks for HP-UX Certification Part #3 - Page 14

page 14

Assigning IP addresses

• The first IP address (the smallest IP address) in your network is the network number or network addressExample: If you are using a class C network address 192.168.4.0 do not assign up address 192.168.4.0 to any host

• The last IP address in your network (the largest IP address) is the broadcast address§ This should not be assigned to any host§ 192.168.4.255 is the broadcast

• You should devise an IP address assignment scheme to ensure that no IP addresses are duplicates in your network

• If a host has multiple network interface adapters, a unique IP must be assigned to each one§ Multiple IP addresses can be assigned to a single network interface adapter

• IP address 127.0.0.1 is the Loopback Address§ It is used for test purposes§ A data packet sent at this address is received by the host itself

Page 145: Tips and Tricks for HP-UX Certificationdbmanagement.info/Books/MIX/HP_unix_book_for_certification_hp_unix...• Pass the HP-UX System Administration Exam. Tips and Tricks for HP -UX

Tips and Tricks for HP-UX Certification Part #3 - Page 15

page 15

IP addressing and terminology

• Netmask tells your system which bits in your IP address are network bits and which are host bits. To determine your netmask write a 1 in each network bit and a “0“ in each of the remaining bits§ Class A = 255.0.0.0§ Class B = 255.255.0.0§ Class C = 255.255.255.0

§ Broadcast§ Sends a packet to all of the nodes on a hosts network§ To formulate the broadcast, set all IP host bits to 1

§ Network Address§ Every host must know which network it is connected to§ This is a special address used by routers and other network devices to reference

an entire network of hosts§ It is formulated by setting all IP host bits to “0”

824C

1616B

248A

Host BitsNetwork BitsClass

Page 146: Tips and Tricks for HP-UX Certificationdbmanagement.info/Books/MIX/HP_unix_book_for_certification_hp_unix...• Pass the HP-UX System Administration Exam. Tips and Tricks for HP -UX

Tips and Tricks for HP-UX Certification Part #3 - Page 16

page 16

IP breakdown

• Classes:§ A – range from 1 – 127§ B – range from 128 – 191§ C – range from 192 – 255

213.1.231.0213.1.231.255255.255.255.0213.1.231.45

124.0.0.0124.255.255.255255.0.0.0124.132.12.5

167.12.0.0167.12.255.255255.255.0.0167.12.132.5

Network AddressBraodcastNetmaskIP

Octet format: 128 64 32 16 8 4 2 1

• You will be given questions providing the netmask§What is the broadcast?§What is the network address?§Vice versa?

Page 147: Tips and Tricks for HP-UX Certificationdbmanagement.info/Books/MIX/HP_unix_book_for_certification_hp_unix...• Pass the HP-UX System Administration Exam. Tips and Tricks for HP -UX

Tips and Tricks for HP-UX Certification Part #3 - Page 17

page 17

TCP/IP Examples

• Lets look at some TCP/IP examples!

Page 148: Tips and Tricks for HP-UX Certificationdbmanagement.info/Books/MIX/HP_unix_book_for_certification_hp_unix...• Pass the HP-UX System Administration Exam. Tips and Tricks for HP -UX

Tips and Tricks for HP-UX Certification Part #3 - Page 18

page 18

Subnetting

• Divides a large network IP address space into several smaller and more manageable subnets. As a rule, the subnet portion of the IP address as defined by the mask may not have all 0s or 1s.

• Example: A network 192.6.12.0 is divided into 6 subnets. The netmask is 255.255.255.224. What are the subnet addresses?§ 1st Subnet - 11000000 . 00000110 . 00001100 . 001 00000

o Subnet address = 192.6.12.32§ 2nd Subnet – 11000000 . 00000110 . 00001100 . 010 00000

o Subnet address = 192.6.12.64§ 3rd Subnet - 11000000 . 00000110 . 00001100 . 011 00000

o Subnet address = 192.6.12.96§ 4th Subnet – 11000000 . 00000110 . 00001100 . 100 00000

o Subnet address = 192.6.12.128§ 5th Subnet - 11000000 . 00000110 . 00001100 . 101 00000

o Subnet address = 192.6.12.160o 6th Subnet - 11000000 . 00000110 . 00001100 . 110 00000

o Subnet address = 192.6.12.192

Page 149: Tips and Tricks for HP-UX Certificationdbmanagement.info/Books/MIX/HP_unix_book_for_certification_hp_unix...• Pass the HP-UX System Administration Exam. Tips and Tricks for HP -UX

Tips and Tricks for HP-UX Certification Part #3 - Page 19

page 19

Subnetting cont

• What would happen if you wanted 7 subnets?§ You guessed it:

We will need to borrow an additional host bit!7 subnets11000000 . 00000110. 00001100. 01110000

o 192.6.12.112 – Indicates new IP address

15 subnets11000000 . 00000110 . 00001100. 01111000

o 192.6.12.120 – Indicates new IP address

Page 150: Tips and Tricks for HP-UX Certificationdbmanagement.info/Books/MIX/HP_unix_book_for_certification_hp_unix...• Pass the HP-UX System Administration Exam. Tips and Tricks for HP -UX

Tips and Tricks for HP-UX Certification Part #3 - Page 20

page 20

Subnetting example

• Example:

• What is the broadcast address if subnetted?§ We do not touch the subnet bits at all. Sets all host bits to 1§ Formula: Convert host bits and add subnet bit value to get broadcast

o 192.168.4. 000 00000 – Subnet=0 plus Host=31o 192.168.4. 010 00000 – Subnet=64 plus Host=31o 192.168.4. 100 00000 – Subnet=128 plus Host=31o 192.168.4. 110 00000 – Subnet=192 plus Host=31

192.168.4.223255.255.255.224192.168.4.192

192.168.4.159255.255.255.224192.168.4.128

192.168.4.95 255.255.255.224192.168.4.64

192.168.4.31255.255.255.224192.168.4.0

BroadcastNetmaskNetwork Address

Page 151: Tips and Tricks for HP-UX Certificationdbmanagement.info/Books/MIX/HP_unix_book_for_certification_hp_unix...• Pass the HP-UX System Administration Exam. Tips and Tricks for HP -UX

Tips and Tricks for HP-UX Certification Part #3 - Page 21

page 21

Class B subnetting examples

Determining the number of hosts (subnetted)?• IF you have a netmask 255.255.252.0, how many hosts can you have in a

subnet? Answer: 1022 11111111 . 11111111 . 111111 00.00000000§ To determine this, you will need to separate the 0’s and add up the numbers:§ 512 + 256+128+64+32+16+8+4+2+1 Note: There are 256 hosts (includes the

generic network address & broadcast) possible – 2 bits. 1024 – 2 = 1022

216382255.255.255.252214

621022255.255.255.192610

126510255.255.255.12879

254254255.255.255.088

510126255.255.254.097

409414255.255.240.0124

163822255.255.192.0142

655340255.255.0.0160

# Hosts# SubnetsNetmaskHost BitsSubnet Bits

Page 152: Tips and Tricks for HP-UX Certificationdbmanagement.info/Books/MIX/HP_unix_book_for_certification_hp_unix...• Pass the HP-UX System Administration Exam. Tips and Tricks for HP -UX

Tips and Tricks for HP-UX Certification Part #3 - Page 22

page 22

Class C subnetting examples

Determining the number of subnets?You have a class A network and you want to configure over 2000 subnets and over

8000 hosts. Which subnet mask do you need? Answer: 255.255.224.0255. __ __ __ __ __ __ __ __ . __ __ __ __ __ __ __ __. 0 = < 2000 Subnets255.255. __ __ __ __ __ __ __ __ . __ __ __ __ __ __ __ __ = < 8000 Hosts

4 2 1 5 2 128 64 32 16 8 4 2 10 0 0 1 59 4 2 2 66 8 4

262255.255.255.25236

630255.255.255.24835

1414255.255.255.240 44

306255.255.255.22453

622255.255.255.19262

2540255.255.255.080

# Hosts# SubnetsNetmaskHost BitsSubnet Bits

Page 153: Tips and Tricks for HP-UX Certificationdbmanagement.info/Books/MIX/HP_unix_book_for_certification_hp_unix...• Pass the HP-UX System Administration Exam. Tips and Tricks for HP -UX

Tips and Tricks for HP-UX Certification Part #3 - Page 23

page 23

IP routes

• Routing protocols (used for Dynamic Routes)§ Routing information protocol (RIP)§ Open shortest path first protocol (OSPF)§ Border gateway protocol (BGP)§ Exterior gateway protocol (EGP)

• Address Resolution Protocol (ARP)§ Takes the destination IP address as input and gives the destination

MAC address as output.§ HP-UX kernel maintains a special data structure in memory known as

the ARP cache, which contains a mapping of IP addresses to MAC addresses

§ The arp –a command displays the arp cache.• Reverse Address Resolution Protocol (RARP) – where you

already know the MAC and want to find out the IP address corresponding to that MAC address

• You should reserve the first working IP address in your network for the router– 192.168.4.1 should be reserved for the router

Page 154: Tips and Tricks for HP-UX Certificationdbmanagement.info/Books/MIX/HP_unix_book_for_certification_hp_unix...• Pass the HP-UX System Administration Exam. Tips and Tricks for HP -UX

Tips and Tricks for HP-UX Certification Part #3 - Page 24

page 24

Routing information

• netstat§ Command is used for displaying routes (netstat –rn), listing IP

addresses assigned to Network Adapters, number the incoming and outgoing data packets, displaying opened ports and connected sockets and for verification that network adapters are functioning

§ Does NOT determine the state of IP Forwarding.§ Types of Routes: Static or dynamic§ A Router = A gateway when defining routes§ The route command defines routes§ Route entries are configured in the /etc/rc.config.d/netconf file

• Creating a route§ Create a route for the network 195.123.6.0 and it’s gateway is

195.123.7.1?o Answer: route 195.123.6.0 195.123.7.1 0

Page 155: Tips and Tricks for HP-UX Certificationdbmanagement.info/Books/MIX/HP_unix_book_for_certification_hp_unix...• Pass the HP-UX System Administration Exam. Tips and Tricks for HP -UX

Tips and Tricks for HP-UX Certification Part #3 - Page 25

page 25

Routing (cont.)

• Creating a route through a router/gateway§ Add a new gateway to connect to a network 15

through a router IP address 145.10.23.1?o Answer: route add net 15.0.0.0 145.10.23.1 1

• Default routes§ Route add default 192.168.2.1 1§ Route –f will delete an entire routing table

• Deleting a route§ Route delete net 192.168.4.0 192.168.2.1

• 1 denotes the hop “hop count” parameter. This should be set to 0 for hosts on your local network or 1 if the route requires hops across one or more gateways. This is optional when deleting routes.

Page 156: Tips and Tricks for HP-UX Certificationdbmanagement.info/Books/MIX/HP_unix_book_for_certification_hp_unix...• Pass the HP-UX System Administration Exam. Tips and Tricks for HP -UX

Tips and Tricks for HP-UX Certification Part #3 - Page 26

page 26

Network troubleshooting

• Internet Control Message Protocol (ICMP) is used for network monitoring and troubleshooting purposes§ Ping command

o Ctrl-C stops the commando Default data packet size is 64 bytes

• TCP and UDP protocols§ Transmission Control Protocol (TCP)

o Is designed for reliable data transfero Connection-oriented.

§ User Datagram Protocol (UDP)o Unreliable data transfero Connection-less.

Page 157: Tips and Tricks for HP-UX Certificationdbmanagement.info/Books/MIX/HP_unix_book_for_certification_hp_unix...• Pass the HP-UX System Administration Exam. Tips and Tricks for HP -UX

Tips and Tricks for HP-UX Certification Part #3 - Page 27

page 27

Ports and sockets

• Ports and Sockets§ Port numbers are used while sending data to a

particular application on another host§ Port numbers are listed in the /etc/services file§ The netstat –a command displays opened ports and

connected sockets§ Important Port Numbers:

o ftp – port# 21o telnet – port# 23o DNS – port# 53

§ Socket is a combination of an IP address and port number

Page 158: Tips and Tricks for HP-UX Certificationdbmanagement.info/Books/MIX/HP_unix_book_for_certification_hp_unix...• Pass the HP-UX System Administration Exam. Tips and Tricks for HP -UX

Tips and Tricks for HP-UX Certification Part #3 - Page 28

page 28

Using lanadmin & ndd

• lanadmin§ Is used for interface adapter administration§ Displays and clears the lan adapter statistics

o The statistics include inbound and outbound bytes since the last statistics clearing, different types of errors, types of packets, and so on

§ Resets a network interface§ Does NOT display routes

• ndd§ Command is used to fine tune TCP/IP protocol

parameters.The command is used for in-depth troubleshooting and fine tuning.

• Displays and changes the physical address of a station• Displays and changes the max transfer unit (mtu)

– The mtu shows the max number of bytes that can be transferred in 1 packet.

• Displays and changes the speed setting– This can’t be done on all adapters.

Page 159: Tips and Tricks for HP-UX Certificationdbmanagement.info/Books/MIX/HP_unix_book_for_certification_hp_unix...• Pass the HP-UX System Administration Exam. Tips and Tricks for HP -UX

Tips and Tricks for HP-UX Certification Part #3 - Page 29

page 29

Screenshot #13: Networking

Page 160: Tips and Tricks for HP-UX Certificationdbmanagement.info/Books/MIX/HP_unix_book_for_certification_hp_unix...• Pass the HP-UX System Administration Exam. Tips and Tricks for HP -UX

Tips and Tricks for HP-UX Certification Part #3 - Page 30

page 30

Using ifconfig, lanscan and linkloop

• ifconfig§ Command is used for:

o Assigning the IP address to a network interfaceo Displaying the configured IP address of a network interfaceo Assigning the IP address to a virtual network interface

– # ifconfig lan0• lanscan§ Command lists information for all LAN interface cards on the system

including: H/W path, MAC address, H/W state (UP or DOWN), card instance number and MAC type.

• linkloop§ Command tests the physical and data link layers (1 and 2) § Linkloop requires device file /dev/dlpi and kernel driver dlpi§ If you are unable to linkloop a critical server on your LAN, then you

can conclude that your lan card has lost physical connectivity to the server. # linkloop 0x0060b007c179

Page 161: Tips and Tricks for HP-UX Certificationdbmanagement.info/Books/MIX/HP_unix_book_for_certification_hp_unix...• Pass the HP-UX System Administration Exam. Tips and Tricks for HP -UX

Tips and Tricks for HP-UX Certification Part #3 - Page 31

page 31

Screenshot #14: Networking

Page 162: Tips and Tricks for HP-UX Certificationdbmanagement.info/Books/MIX/HP_unix_book_for_certification_hp_unix...• Pass the HP-UX System Administration Exam. Tips and Tricks for HP -UX

Tips and Tricks for HP-UX Certification Part #3 - Page 32

page 32

ARPA/Berkeley services

• What are they?§ ARPA services include:

o Remote login using telnet o File transfer using ftpo Network time protocol (NTP)o Dynamic routing using gated

§ Berkeley services include: o Remote login using rlogino Remote copy using rcpo Remote execution using remsho SENDMAIL – email.o Remote printing

• Are the most widely used network applications on HP-UX networks or any other modern UX platform.

• ARPA services are commonly used with the Internet and are available with other OS’s

• Berkeley services are mostly available on UX systems only– Berkeley commands start with the letter “ r “ and are considered to

be less secure than ARPA– Collectively, these services are called Internet services and are

invoked by the inetd daemon

Page 163: Tips and Tricks for HP-UX Certificationdbmanagement.info/Books/MIX/HP_unix_book_for_certification_hp_unix...• Pass the HP-UX System Administration Exam. Tips and Tricks for HP -UX

Tips and Tricks for HP-UX Certification Part #3 - Page 33

page 33

Using ftp and telnet

• ftp§ Command is used for transferring files from one system to

another over a network§ After establishing a connection, the ftp> prompt is

displayed§ Review the options (get,put,quit,help)

• telnet§ Command is used to remote login to a UNIX system§ The command is used on the client side while the telnetd

daemon runs as a server process on the HP-UX server§ The exit command will log out.

– get• Command is used for file download

– put• Command is used to send a file from your local system to a

remote system– quit

• Is used for ending an ftp session– help

• Is used for finding out specific commands

Page 164: Tips and Tricks for HP-UX Certificationdbmanagement.info/Books/MIX/HP_unix_book_for_certification_hp_unix...• Pass the HP-UX System Administration Exam. Tips and Tricks for HP -UX

Tips and Tricks for HP-UX Certification Part #3 - Page 34

page 34

Using rlogin, rcp and remsh

• rlogin§ Is used for remote login§ Like telnet, it needs the remote system name as its argument§ rlogin hp10

• rcp§ Is used for remote copy§ The syntax is similar to the cp command§ Example: To copy the /etc/passwd file from a remote system hp10 to

the current directoryrcp hp10:/etc/passwd

• remsh§ Command is used for remote command execution§ The result of the command is displayed on a local terminal screen§ Example: To show a listing of the /etc directory of remote system hp10

remsh hp10 11 /etc

Page 165: Tips and Tricks for HP-UX Certificationdbmanagement.info/Books/MIX/HP_unix_book_for_certification_hp_unix...• Pass the HP-UX System Administration Exam. Tips and Tricks for HP -UX

Tips and Tricks for HP-UX Certification Part #3 - Page 35

page 35

ARPA/Berkeley configuration files

• /etc/inetd.conf contains the list of services inetd listens for and the daemon it launches when the connection is made

• /var/adm/inetd.sec file is used to provide an added layer of security to the inetd daemon

• /etc/services file lists service names and ports/protocols used with these services

• /etc/hosts.equiv (hosts equivalency) file is used to allow or deny access for specific services

• $HOME/.rhosts§ User defined file used to allow or deny incoming network

requests§ This file is read after /etc/hosts.equiv file.

Page 166: Tips and Tricks for HP-UX Certificationdbmanagement.info/Books/MIX/HP_unix_book_for_certification_hp_unix...• Pass the HP-UX System Administration Exam. Tips and Tricks for HP -UX

Tips and Tricks for HP-UX Certification Part #3 - Page 36

page 36

Host and user equivalencies

• Host equivalency§ Is where all users of a system are allowed to access

services on another system§ Is enabled by the system administrator on the server

system - /etc/hosts.equiv file• A (+) symbol matches every host and a (-) symbol

means access for all users on that system is denied.• User equivalency§ Enable users of one system to remotely access

another system§ Is done through the .rhosts file

Page 167: Tips and Tricks for HP-UX Certificationdbmanagement.info/Books/MIX/HP_unix_book_for_certification_hp_unix...• Pass the HP-UX System Administration Exam. Tips and Tricks for HP -UX

Tips and Tricks for HP-UX Certification Part #3 - Page 37

page 37

User equivalency examples

• Examples:§ User A grants permission to a remote user ryan from

any system to log in as User A on the local system without a password

+ ryan§ User A Allows access to user ryan from host myhp

onlymyhp ryan

§ User B from System A is denied login to System A but User C can login from all systems as User C

A –B+ C

Page 168: Tips and Tricks for HP-UX Certificationdbmanagement.info/Books/MIX/HP_unix_book_for_certification_hp_unix...• Pass the HP-UX System Administration Exam. Tips and Tricks for HP -UX

Tips and Tricks for HP-UX Certification Part #3 - Page 38

page 38

Host name resolution

• IP’s are used by systems to communicate, hostnames were introduced to make identifying systems easier§ Multiple host names can be used for one IP address§ Name Resolution Methods§ /etc/hosts file – contains 1 line for each host to IP address

mappingo An entry can not start with a space character

o NIS – Network Information Serviceo Developed by SUNo Keeps a central db of hosts and users and uses a flat name space

that uses a master NIS servero DNS – Domain Name Server

o Involves a machine on a network that keeps a record of local host names within its zone of authority

– DNS• gethostbyname( ) – used to map a host name to an IP• gethostbyaddr( ) – used to map an IP to a hostname

Page 169: Tips and Tricks for HP-UX Certificationdbmanagement.info/Books/MIX/HP_unix_book_for_certification_hp_unix...• Pass the HP-UX System Administration Exam. Tips and Tricks for HP -UX

Tips and Tricks for HP-UX Certification Part #3 - Page 39

page 39

DNS

• Name space is a tree like structure starting with top level domain namesExample: edu, com, org separated by a “ . “ dot character

• Local domain names are kept in the /etc/resolv.conf file§ Only 3 server addresses may be configured

• 3 name servers:§ Primary

o Maintains data about hosts in the domain and pointers to delegated servers responsible for zones inside the domain

o Secondaryo Used as a backup server in case a primary server fails

o Cachingo Does not have local data fileso Used only to look up host names and distribute load in large

networks where several clients are resolving host names

Page 170: Tips and Tricks for HP-UX Certificationdbmanagement.info/Books/MIX/HP_unix_book_for_certification_hp_unix...• Pass the HP-UX System Administration Exam. Tips and Tricks for HP -UX

Tips and Tricks for HP-UX Certification Part #3 - Page 40

page 40

Configuring the primary DNS

Steps to Configure a Primary DNS:1. Register your own domain name2. Create a list of host names in /etc/hosts file3. Create a directory /etc/named.data & change to this directory (cd)4. Create a file named param that will be used by hosts_to_named to

create DNS data files5. Run hosts_to_named to create server configuration and data files

hosts_to_named –f param6. Download the db.cache file from the internet & copy it into the

/etc/named.data directory7. Modify the /etc/rc.config.d/namesvrs file so that named process

starts at boot time. Change the value of the NAMED variable to 1.8. Start the DNS server

/sbin/init.d/named start

Page 171: Tips and Tricks for HP-UX Certificationdbmanagement.info/Books/MIX/HP_unix_book_for_certification_hp_unix...• Pass the HP-UX System Administration Exam. Tips and Tricks for HP -UX

Tips and Tricks for HP-UX Certification Part #3 - Page 41

page 41

Configuring the secondary DNS

Steps to Configure the Secondary DNS:1. Create a /etc/named.data directory2. Copy the boot.sec file as /etc/named.boot from the primary name

server.3. Copy db.127.0.0 & db.cache from the primary server to the

/etc/named.data dir. The db.127.0.0 file is used to resolve the loopback address. The db.cache file is required so the name server can find the root level name server.

4. If you want to create local disk db files, download the remaining files from the /etc/named.data directory on the primary server to the local /etc/named.data directory

5. Update the /etc/rc.config.d/namesvrs file to start named at boot time. The value of the named variable should be changed to 1.

6. Start named using the /sbin/init.d/named start command

Page 172: Tips and Tricks for HP-UX Certificationdbmanagement.info/Books/MIX/HP_unix_book_for_certification_hp_unix...• Pass the HP-UX System Administration Exam. Tips and Tricks for HP -UX

Tips and Tricks for HP-UX Certification Part #3 - Page 42

page 42

Configuring the DNS client

Steps for configuring the DNS Client:1. Create the /etc/resolv.conf file listing DNS server and

domain names.2. Modify the /etc/nsswitch.conf. The /etc/nsswitch.conf

file controls which service will be used for a particular type of information and in what order.

3. Modify /etc/hosts4. Modify .rhosts, /etc/hosts.equiv

Page 173: Tips and Tricks for HP-UX Certificationdbmanagement.info/Books/MIX/HP_unix_book_for_certification_hp_unix...• Pass the HP-UX System Administration Exam. Tips and Tricks for HP -UX

Tips and Tricks for HP-UX Certification Part #3 - Page 43

page 43

Using nslookup

• nslookup§ Command is used for testing and resolving a host

name§ The host name to be resolved is provided on the

command line§ The command first contacts the DNS server in

/etc/resolv.conf file and displays an IP address corresponding to the host

§ Can be used with Reverse Name Resolution

Page 174: Tips and Tricks for HP-UX Certificationdbmanagement.info/Books/MIX/HP_unix_book_for_certification_hp_unix...• Pass the HP-UX System Administration Exam. Tips and Tricks for HP -UX

Tips and Tricks for HP-UX Certification Part #3 - Page 44

page 44

Host name and DNS review

• The hosts_to_named command is run on the primary name server§ Running the hosts_to_named command is NOT required when

configuring a host as a secondary or slave DNS name server• /etc/named.boot is the configuration file used by named at

boot time• /etc/resolv.conf is a file on a client machine used for listing

available name servers• Entries in DNS database files are called resource records• When ping command is used, which IP will these packets be

sent to?Answer: only the first line -> 192.168.2.1

§ If there are 2 entries in the /etc/hosts file192.168.2.1 hp01192.168.4.5 hp01

Page 175: Tips and Tricks for HP-UX Certificationdbmanagement.info/Books/MIX/HP_unix_book_for_certification_hp_unix...• Pass the HP-UX System Administration Exam. Tips and Tricks for HP -UX

Tips and Tricks for HP-UX Certification Part #3 - Page 45

page 45

NIS

• Is based on the domain concept§ Each host on a network may be a part of one domain only§ Data files about hosts and users are maintained on the NIS master

server§ Text files are converted into dbm format with the help of the ypmake

program and are commonly called NIS maps§ Each map consists of 2 files ending with .pag and .dir.

Example: /etc/passwd file is converted into passwd.byname.dir and passwd.byname.pag.

• NIS Domain is a single word and is used to group a number of hosts on a network§ Any host may be a member of only 1 domain although multiple NIS

domains can exist on a single physical network§ Domain names are set in the /etc/rc.config.d/namesvrs file with the

help of the NIS_Domain variable or by using the domainnamecommand at any time

Page 176: Tips and Tricks for HP-UX Certificationdbmanagement.info/Books/MIX/HP_unix_book_for_certification_hp_unix...• Pass the HP-UX System Administration Exam. Tips and Tricks for HP -UX

Tips and Tricks for HP-UX Certification Part #3 - Page 46

page 46

NIS server and client functions

• NIS Roles:§ Master NIS Server

o Keeps NIS maps§ Slave NIS Server

o Depends on information provided by the NIS Mastero Slave servers keep the same copy of NIS maps as the master and

they also update their maps from time to time using the ypxfrcommand

§ NIS Client gets system and user information from one of the NIS serversExample: During the login process, the client machine contacts an NIS server for user name and password verification

§ Configuring NIS involves at least 1 master and 1 or more clients• yp = yellow pages§ All commands begin with this§ /var/yp is the default location for NIS maps

Page 177: Tips and Tricks for HP-UX Certificationdbmanagement.info/Books/MIX/HP_unix_book_for_certification_hp_unix...• Pass the HP-UX System Administration Exam. Tips and Tricks for HP -UX

Tips and Tricks for HP-UX Certification Part #3 - Page 47

page 47

NIS processes

• Server NIS processes are started at run level 2 using the /sbin/init.d/nis.server script

• Client processes are started at /sbin/init.d/nis.client• Both scripts use variables in the /etc/rc.config.d/namesvrs

file§ A server may be either a master NIS server or a slave NIS

server, but NOT both§ To enable a server, variables should be set to 1 for

NIS_MASTER_SERVER or NIS_SLAVE_SERVER§ If a host is configured as the master NIS server, it must also be

an NIS client at the same time• NIS Daemons§ portmap - 10.20 § rpcbind - 11.00

Page 178: Tips and Tricks for HP-UX Certificationdbmanagement.info/Books/MIX/HP_unix_book_for_certification_hp_unix...• Pass the HP-UX System Administration Exam. Tips and Tricks for HP -UX

Tips and Tricks for HP-UX Certification Part #3 - Page 48

page 48

NIS commands and roles

• ypserv – NIS server daemon§ Listens to incoming requests and responds to them after consulti ng NIS

maps§ ypbind – NIS client daemon§ Runs on all hosts taking part in the NIS domain. ypbind communicates

with ypserv§ rpc.yppasswd – Runs only on NIS master servers§ This daemon updates the password file thus updating maps and pushes

these maps to all slave servers§ ypxfrd – Master and slave NIS servers§ Transfers maps between master and slave servers from the ypxfr

command§ rpc.updated – Master NIS§ Provides a secure mechanism to update NIS source files on the master

NIS server§ keyserv – Runs on all machines§ Part of secure RPC and is used to keep encryption keys for all logged in

users

Page 179: Tips and Tricks for HP-UX Certificationdbmanagement.info/Books/MIX/HP_unix_book_for_certification_hp_unix...• Pass the HP-UX System Administration Exam. Tips and Tricks for HP -UX

Tips and Tricks for HP-UX Certification Part #3 - Page 49

page 49

NIS utilities

• ypcat§ Displays NIS maps

• ypinit• Builds and installs NIS map files• Used for configuring the master NIS server

• ypmake§ Rebuilds NIS tables• Updates NIS maps on the Master

• yppush§ Initiates ypxfr command on slave• Transfers to master• Is used to have slaves update their files

• ypmatch§ Matches and lists particular values in NIS tables

Page 180: Tips and Tricks for HP-UX Certificationdbmanagement.info/Books/MIX/HP_unix_book_for_certification_hp_unix...• Pass the HP-UX System Administration Exam. Tips and Tricks for HP -UX

Tips and Tricks for HP-UX Certification Part #3 - Page 50

page 50

NIS utilities (cont.)

• ypset§ Binds NIS clients to particular NIS servers

• ypwhich§ Shows host names of NIS servers§ yppasswd§ Changes a passwd on a client§ rpcinfo§ Used for troubleshooting§ Used to verify if an NIS server is running and responding to

client’s requests§ rpcinfo verifies if a service is registered with portmap or rpcbind§ It contacts the rpcbind or portmap daemons and displays all

registered services

Page 181: Tips and Tricks for HP-UX Certificationdbmanagement.info/Books/MIX/HP_unix_book_for_certification_hp_unix...• Pass the HP-UX System Administration Exam. Tips and Tricks for HP -UX

Tips and Tricks for HP-UX Certification Part #3 - Page 51

page 51

Configuring an NIS master

Steps for Configuring an NIS Master:1. Add /var/yp to root’s PATH variable2. Collect the ASCII configuration files

a. They should be up to date3. Create the NIS domain name using the domainname command

a. # domainname florida4. Run the ypinit –m command to configure the server as the master5. Edit the /etc/rc.config.d/namesvrs file

a. It should contain:1. NIS_MASTER_SERVER=12. NIS_CLIENT=13. NIS_DOMAIN=florida

6. After finishing this process, you can reboot the system or run the following commands.

a. /sbin/init.d/nis.server startb. /sbin/init.d/nis.client start

• Step 4: This builds and installs databases. A series of questions will then be asked.

Page 182: Tips and Tricks for HP-UX Certificationdbmanagement.info/Books/MIX/HP_unix_book_for_certification_hp_unix...• Pass the HP-UX System Administration Exam. Tips and Tricks for HP -UX

Tips and Tricks for HP-UX Certification Part #3 - Page 52

page 52

Configuring an NIS slave

Steps for configuring an NIS Slave:1. Create an NIS domain name using the domainname

commanda. # domainname research

2. Run ypinit –s to configure the slavea. # ypinit –s master_server or slave_server

3. Edit the /etc/rc.config.d/namesvrs filea. It should contain:

1. NIS_SLAVE_SERVER=12. NIS_CLIENT=13. NIS_DOMAIN=florida

4. After finishing this process, you can reboot the system or run the following commands

a. /sbin/init.d/nis.server startb. /sbin/init.d/nis.client start

Page 183: Tips and Tricks for HP-UX Certificationdbmanagement.info/Books/MIX/HP_unix_book_for_certification_hp_unix...• Pass the HP-UX System Administration Exam. Tips and Tricks for HP -UX

Tips and Tricks for HP-UX Certification Part #3 - Page 53

page 53

Configuring an NIS client

Steps for configuring an NIS Client:1. Use the domainname command to set an NIS domain

name2. Edit the /etc/rc.config.d/namesvrs file containing:

a. NIS_CLIENT=1b. NIS_DOMAIN=florida

3. After finishing this process, you can either reboot your system or run the following command

a. /sbin/init.d/nis.client start

Page 184: Tips and Tricks for HP-UX Certificationdbmanagement.info/Books/MIX/HP_unix_book_for_certification_hp_unix...• Pass the HP-UX System Administration Exam. Tips and Tricks for HP -UX

Tips and Tricks for HP-UX Certification Part #3 - Page 54

page 54

NFS

• NFS is used to share files and directories over a network§ When used in combination with NIS, it facilitates users logging in from

any machine on the network and finding the same environment, home directories and mailboxes

• Remote mount process§ NFS Server processes are started on the server machine

o Done by running the /sbin/init.d/nfs.core and /sbin/init.d/nfs.server scripts at boot time

§ The shared directories are located in the /etc/exports file and are exported using exportfso This command is executed at boot time

§ NFS client processes are running on the client machineo These are started with the help of the /sbin/init.d/nfs.core and

nfs.client scripts are invoked at run level 2§ Remote file system names and mount points are present in the

/etc/fstab file

Page 185: Tips and Tricks for HP-UX Certificationdbmanagement.info/Books/MIX/HP_unix_book_for_certification_hp_unix...• Pass the HP-UX System Administration Exam. Tips and Tricks for HP -UX

Tips and Tricks for HP-UX Certification Part #3 - Page 55

page 55

NFS daemons and roles

• portmap –10.20 daemon§ Converts RPC program numbers into port numbers; Client/server

• rpcbind – 11.00 daemon§ Same functionality as portmap

• rpc.statd§ For crash recovery functions; Client/server

• rpc.lockd§ File locking for NFS servers and clients

• nfsd§ The NFS server daemon

• rpc.pcnfsd§ Used with pcnfs§ Not required if all clients are UNIX machines; Server

• rpc.mountd§ Keeps record of mounted and exported file systems; Server

• biod§ Used to handle buffer cache in asynchronous I/O on NFS clients; Client

Page 186: Tips and Tricks for HP-UX Certificationdbmanagement.info/Books/MIX/HP_unix_book_for_certification_hp_unix...• Pass the HP-UX System Administration Exam. Tips and Tricks for HP -UX

Tips and Tricks for HP-UX Certification Part #3 - Page 56

page 56

NFS “Things to Know”

• After HP-UX 10.30, NFS version 3 has been used by default§ NFS Version 3 has more advantages over Version 2§ NFS versions 2 and 3 are both supported on HP-UX 11.00

• Entries of all remotely mounted file systems and remote NFS clients are present in the /etc/rmtab§ Entries of all mounted file systems are stored in /etc/mnttab file

• A system can act as an NFS Client and Server at the same time• A system can export a single file, directory, or file system• If a directory is exported, all of the directory tree under this

directory is automatically exported§ NFS file systems are exported (on a default HP-UX installation)

at run level 3• Using NFS, a server exports and a client mounts file systems and

or directories

Page 187: Tips and Tricks for HP-UX Certificationdbmanagement.info/Books/MIX/HP_unix_book_for_certification_hp_unix...• Pass the HP-UX System Administration Exam. Tips and Tricks for HP -UX

Tips and Tricks for HP-UX Certification Part #3 - Page 57

page 57

NFS review

• nfsstat§ Command displays NFS activity on a host§ By default, it displays information about the client, server, and RPC

§ showmount§ Command is used for viewing exported and mounted file systems and

listing remotely mounted file systems• The following daemons should be started in order:

inetd, rpcbind, nfsd• RPC services are listed with the rpcinfo command• File systems in /etc/exports are exported at boot time with the

help of the exportfs command§ If you want to export these manually, without rebooting after making a

change, use the exportfs –a command§ The command reads the /etc/exports file and copies these entries to

the /etc/xtab file§ The /etc/xtab file contains a list of currently exported NFS Server file

systems

Page 188: Tips and Tricks for HP-UX Certificationdbmanagement.info/Books/MIX/HP_unix_book_for_certification_hp_unix...• Pass the HP-UX System Administration Exam. Tips and Tricks for HP -UX

Tips and Tricks for HP-UX Certification Part #3 - Page 58

page 58

NFS review (cont.)

• NFS.server scripts start at run level 3, NFS.core and NFS.client scripts start at run level 2

• A stale file handle with NFS indicates that a client has a directory mounted which is no longer available on the server

• An NFS mounted tape can not be used for a patch depot• If a file system is exported as “ /home –

rw=hp1:hp2,root=hp1 “ then users on system hp1 have read and write access

• If you exported /tmp via NFS, what can be mounted on a client?§ Any files/directories under /tmp as long as they are not on

a different filesystem

Page 189: Tips and Tricks for HP-UX Certificationdbmanagement.info/Books/MIX/HP_unix_book_for_certification_hp_unix...• Pass the HP-UX System Administration Exam. Tips and Tricks for HP -UX

Tips and Tricks for HP-UX Certification Part #3 - Page 59

page 59

HP-UX automounter

• HP-UX Automounter is considered an additional service to an nfs client§ Mounts remote file systems only when needed§ If a mounted file system is not accessed for a specified period of time, it is

automatically unmounted§ The automount daemon keeps this process transparent from the user

• Automatically mounts and unmounts NFS mount points on demand• Automounter maps (4)§ Master

o Read by automounter at startup time§ Direct

o Contains local mount points and corresponding filesystems exported by an NFS server

§ Indirecto Provides a reference directory for local mount points

§ Special§ Mounts all exported file systems from an NFS server under a directory in /net

• Automounter is started by the nfs.client script in /sbin/init.d at run level 2§ Configuration info is read from /etc/rc.config.d/nfsconf

Page 190: Tips and Tricks for HP-UX Certificationdbmanagement.info/Books/MIX/HP_unix_book_for_certification_hp_unix...• Pass the HP-UX System Administration Exam. Tips and Tricks for HP -UX

Tips and Tricks for HP-UX Certification Part #3 - Page 60

page 60

NTP

• Network time protocol (NTP) is used to synchronize a system clock with a reliable time source§ Comes bundled with HP-UX§ The xntpd daemon is responsible for the

synchronization of time§ The daemon uses a configuration file /etc/ntp.conf

• 3 types of time sources§ Clock from a GPS or Radio Broadcast

o Most reliable sources§ Internet§ Clock from local machine on the LAN

o Least accurate

• Can get a list of ntp servers www.ntp.org

Page 191: Tips and Tricks for HP-UX Certificationdbmanagement.info/Books/MIX/HP_unix_book_for_certification_hp_unix...• Pass the HP-UX System Administration Exam. Tips and Tricks for HP -UX

Tips and Tricks for HP-UX Certification Part #3 - Page 61

page 61

NTP terminology

• NTP Definitions:§ Server

o Any host that provides time to other systemso The server gets time from one of the 3 time sources

§ Cliento Gets info from server

o Peero Where 2 or more systems act as peers if they use time sources of = reliability or

stratum level§ Stratum level

o Is an indication of the accuracy of a reference time sourceo Stratum levels are numbered 1-15, where 1 is the most accurate and 15 least

• NTP Commands:o ntpdate command can be used to sync your clock with one or more

servers at any given timeo Done through cron

o ntpq command is used to view the status of NTPo Used to query NTP servers and clients

Page 192: Tips and Tricks for HP-UX Certificationdbmanagement.info/Books/MIX/HP_unix_book_for_certification_hp_unix...• Pass the HP-UX System Administration Exam. Tips and Tricks for HP -UX

Tips and Tricks for HP-UX Certification Part #3 - Page 62

page 62

NTP process

• The ntp daemon process is started at boot time§ Startup operation of ntp is controlled by the xntpd

variable in the /etc/rc.config.d/netdaemons file• At start time, xntpd reads its configuration file

/etc/ntp.conf and configures itself§ /etc/init.d/xntpd start

o Starts the NTP daemon process

Page 193: Tips and Tricks for HP-UX Certificationdbmanagement.info/Books/MIX/HP_unix_book_for_certification_hp_unix...• Pass the HP-UX System Administration Exam. Tips and Tricks for HP -UX

Tips and Tricks for HP-UX Certification Part #3 - Page 63

page 63

Additional information

• Check out the other HP Certification Programs§ Advanced HP-UX§ Openview§ Hardware

• Contact your local ASC or HP Education if interested in obtaining Feedback Forms/Additional Topics

Thank You for attending our Seminar!

Good Luck!

Page 194: Tips and Tricks for HP-UX Certificationdbmanagement.info/Books/MIX/HP_unix_book_for_certification_hp_unix...• Pass the HP-UX System Administration Exam. Tips and Tricks for HP -UX

Tips and Tricks for HP-UX Certification Part #3 - Page 64

page 64

Test review – 10 questions

1. Which shell does not have the history feature?a. Bourneb. Kornc. Cd. POSIX

2. What command is used to list background running jobs?a. ls –bb. jobsc. bg –ld. bg

Page 195: Tips and Tricks for HP-UX Certificationdbmanagement.info/Books/MIX/HP_unix_book_for_certification_hp_unix...• Pass the HP-UX System Administration Exam. Tips and Tricks for HP -UX

Tips and Tricks for HP-UX Certification Part #3 - Page 65

page 65

Test Review (cont.)

3. What is the name of the LVM root volume group?a. Any name can be chosenb. vg00c. Rootd. vgroot

4. What command will run the program myprog with a nice priority of 5?

a. nice - - 5 myprogb. nice – 15 myprogc. nice - - 15 myprogd. nice –5 myprog

Page 196: Tips and Tricks for HP-UX Certificationdbmanagement.info/Books/MIX/HP_unix_book_for_certification_hp_unix...• Pass the HP-UX System Administration Exam. Tips and Tricks for HP -UX

Tips and Tricks for HP-UX Certification Part #3 - Page 66

page 66

Test Review (cont.)

5. How do you extend either HFS or Online JFS file systems?

a. lvextend, fsadmb. umount, extendfs, lvextend, mountc. umount, lvextend, extendfs, mountd. lvextend, umount, fsadm, mount

6. Which RPC daemon is used on HP-UX up to version 10.20?

a. portdb. rpcdc. portmapd. rpcbind

Page 197: Tips and Tricks for HP-UX Certificationdbmanagement.info/Books/MIX/HP_unix_book_for_certification_hp_unix...• Pass the HP-UX System Administration Exam. Tips and Tricks for HP -UX

Tips and Tricks for HP-UX Certification Part #3 - Page 67

page 67

Test Review (cont.)

7. Which network port is used by ftp?a. 25b. 23c. 28d. 21

8. How to configure a DNS Client?a. Edit /etc/named.bootb. Edit /etc/resolv.confc. Edit /etc/named.data/boot.secd. Edit /etc/nsswitch.conf

Page 198: Tips and Tricks for HP-UX Certificationdbmanagement.info/Books/MIX/HP_unix_book_for_certification_hp_unix...• Pass the HP-UX System Administration Exam. Tips and Tricks for HP -UX

Tips and Tricks for HP-UX Certification Part #3 - Page 68

page 68

Test Review (cont.)

9. You have a new gateway to connect to a network 15 through a router ip address 145.10.23.1. Which route statement is correct?

a. route add net 145.10.23.1 15.0.0.0 1b. route add net 145.10.23.1 15.0.0.0 0c. route add net 15.0.0.0 145.10.23.1 1d. route add net 15.0.0.0 145.10.23.1 0

10. After updating NIS maps on the master server, what command is used to have slaves update their files?

a. yppushb. ypupdatec. ypsyncd. ypbind

Page 199: Tips and Tricks for HP-UX Certificationdbmanagement.info/Books/MIX/HP_unix_book_for_certification_hp_unix...• Pass the HP-UX System Administration Exam. Tips and Tricks for HP -UX

HPCS Technical On-line Seminar Program

Appendix:

Questions

Page 200: Tips and Tricks for HP-UX Certificationdbmanagement.info/Books/MIX/HP_unix_book_for_certification_hp_unix...• Pass the HP-UX System Administration Exam. Tips and Tricks for HP -UX
Page 201: Tips and Tricks for HP-UX Certificationdbmanagement.info/Books/MIX/HP_unix_book_for_certification_hp_unix...• Pass the HP-UX System Administration Exam. Tips and Tricks for HP -UX

HP-UX Certification – Sample Exam

Test #1 1. On a Unix system, the primary interaction of a user is

with: a. Kernel b. Shell c. Device drivers d. File system

2. The rsh command on HP-UX can be used to:

a. Execute a remote command b. Log in and initiate a shell on a remote system c. This is a restricted shell on HP-UX d. Grant read only access to a system

3. Which shell does not have the history feature?

a. Bourne b. Korn c. C d. POSIX

4. The root user has user ID:

a. 0 b. 1 c. 100 d. the root user may have any user ID

5. What is the default history file in the HP-UX POSIX

shell? a. History b. $HOME/.history c. $HOME/.sh_history d. /etc/history

6. The alias command in the POSIX shell is used to:

a. Create a command alias b. Create a mail alias c. Create a shell alias d. Create a file system alias

7. You want to add a directory to the PATH variable for

all users of the POSIX shell. Which file will you modify?

a. /etc/profile b. $HOME/.profile of the root user c. /home/root/profile d. /etc/default

8. You use a command “cat > myfile”. What will be the

result of this command? a. Nothing happens and you will get the

command prompt back b. The file named myfile is overwritten and you

get the command prompt back c. The command waits for user input which is

appended to the file named myfile d. The command waits for user input which is

written to the file named myfile. The original contents of the file are deleted.

9. When you use the ll command, the first character of

each line in the output of the command shows the type of the file. The next nine characters show file access permissions for HP-UX users. What is the order of these access permissions?

a. Others,group,owner b. Owner,group,others c. Owner,others,group d. Group,owner,others

10. Which command do you use to list hidden files?

a. ls –h b. ls –l c. ls –a d. ls

11. You are in the /var/tmp directory and want to copy file

myfile from the /tmp directory to the current directory. Which command cannot be used for this purpose?

a. cp /tmp/myfile . b. cp /tmp/myfile /var/tmp c. cp ../../tmp/myfile /var/tmp d. cp /tmp/myfile ..

12. Which command will you use to count the number of

lines in a text file? a. wc b. ls c. lines d. cat

13. Which command displays the value of the HOME

variable? a. echo $HOME b. echo HOME c. echo ‘$HOME’ d. echo `$HOME ̀

Page 202: Tips and Tricks for HP-UX Certificationdbmanagement.info/Books/MIX/HP_unix_book_for_certification_hp_unix...• Pass the HP-UX System Administration Exam. Tips and Tricks for HP -UX

14. Pipes are used to: a. Redirect standard input b. Redirect standard output c. Redirect either standard input or standard

output but not both simultaneously d. Send output of one command to the input of

another command 15. Which mode is not used in vi editor?

a. Command b. Insert c. Preserve d. Last line

16. You want to search all lines in a file myfile that start

with the word “boota”. Which of the following commands will you use?

a. grep $boota myfile b. grep ^boota myfile c. grep boota^ myfile d. grep boota$ myfile

17. Which variable in a shell program is used to determine

the total number of command line arguments? a. $? b. $# c. $* d. ${10}

18. Which of the following is not a shell program control

structure? a. While-do-done b. Until-do-done c. Repeat-do-done d. If-then-fi

19. Which statement is not true?

a. SAM can be used in both text and graphic modes

b. SAM can be used to grant restricted access to users

c. SAM can be used for troubleshooting d. SAM can be used for routine system

administration tasks 20. The set_parms command is used to:

a. Set the hostname b. Set the timezone c. Set the IP address d. All of the above

21. What is the secondary system loader?

a. The hpux utility b. The init process c. PDC d. The /stand/system

22. HP-UX Software Distributor commands are used for: a. Installing and removing software b. Distributing software packages c. Verifying installed software d. All of the above

23. A software bundle contains:

a. Software depots b. Filesets that may belong to different products c. Filesets that may belong to only one product d. Filesets that belong to subproducts of only one

product 24. What is a file descriptor?

a. It is a number used to reference an open file b. It represents the inode number of a file c. It corresponds to a process table entry for a

process created by a file d. It is the number of a directory entry for the file

in a filesystem 25. Which of the following is not a label in the

swinstall.log file? a. ERROR b. WARNING c. CRITICAL d. NOTE

26. Which command is used to build a new HP-UX

kernel? a. mk_kernel b. make c. build d. make_vmunix

27. Three disks are attached to a SCSI adapter with device

numbers 6,1, and 15. Which of these has the highest priority?

a. 6 b. 1 c. 15 d. all disks have the same priority

28. Which statement is not true?

a. A major device number represents a kernel driver used for a device

b. All devices of the same type have the same major number

c. All devices of the same type have the same minor device number

d. A minor device number is a 6 digit hexadecimal number

Page 203: Tips and Tricks for HP-UX Certificationdbmanagement.info/Books/MIX/HP_unix_book_for_certification_hp_unix...• Pass the HP-UX System Administration Exam. Tips and Tricks for HP -UX

29. What is the major device number for LVM device files?

a. 64 b. 32 c. 128 d. 1

30. What is the default physical extent size used in LVM?

a. 4 mbytes b. 4 kbytes c. 16 mbytes d. 16 kbytes

31. Which step is required before adding a new disk to a

volume group? a. Create a physical volume b. Extend the logical volume c. Create a filesystem d. Extend the filesystem

32. What is the name for the default volume group?

a. default b. vg00 c. vgdefault d. There is no particular name for the default

group. Any group can be configured as the default volume group.

33. Which information is not displayed when the pvdisplay

command is used without any command line options? a. Name of the volume group to which the

physical volume is related b. Total number of physical extents c. Name of the filesystem created on the disk d. Allocated physical extents

34. What is the default number of the logical volumes in a

volume group? a. 15 b. 16 c. 255 d. 1024

35. A filesystem metadata area contains:

a. Superblock b. Inodes c. Directory area d. All of the above

36. Which statement is true? a. HFS keeps a record of all transactions in the

intent log b. JFS keeps a record of all transactions in the

intent log c. Both JFS and HFS keep a record of all

transactions in the intent log d. The JFS filesystem size cannot be modified

37. Which command can be used to display the filesystem

usage on HP-UX? a. df b. bdf c. rbdf d. All of the above

38. Which is not a standard state of any HP-UX process?

a. Running b. Sleeping c. Zombie d. Printing

39. Which command is used to cancel a print job?

a. cancel b. stop c. rm d. disable

40. Data backed up by the fbackup command is restored

by: a. The frecover command b. The frestore command c. The tar command d. It can be restored by any of the above

commands 41. The cron daemon is responsible for jobs submitted by:

a. The crontab utility only b. The at utility only c. The batch utility only d. All of the above

42. Fast Ethernet operates at which speed?

a. 10 mbits per second b. 100 mbits per second c. 155 mbits per second d. One gigabyte per second

43. The presentation layer in the OSI model is responsible

for: a. Data format conversion b. Establishing a network connection c. Routing d. Flow control

Page 204: Tips and Tricks for HP-UX Certificationdbmanagement.info/Books/MIX/HP_unix_book_for_certification_hp_unix...• Pass the HP-UX System Administration Exam. Tips and Tricks for HP -UX

44. Which statement is not true? a. A token ring network is physically connected

star topology b. A token ring network is physically connected

ring topology c. An Ethernet network may be connected in star

topology d. An Ethernet network may be connected in ring

topology 45. BNC connectors are used with:

a. Coaxial cable b. Category 3 coaxial cable c. Category 5 coaxial cable d. Fiber optic cable

46. Which of the following devices operates in layer 3 of

the OSI model? a. Repeater b. Router c. Hub d. Bridge

47. In which type of network is the MAC address used?

a. Ethernet b. Token ring c. FDDI d. All of the above

48. The application layer in TCP/IP protocol is equivalent

to which three OSI layers? a. Transport, network, presentation b. Presentation, application, transport c. Application, presentation, session d. Session, application, transport

49. What is the default subnet mask for the IP address

172.23.15.99? a. 255.255.255.0 b. 255.0.0.0 c. 255.255.0.0 d. 172.23.255.255

50. What is the loopback address for a host?

a. The first address on the network b. Any address ending with 0 c. 0.0.0.0 d. 127.0.0.1

51. Which protocol is used to map an IP address to a MAC

address? a. ARP b. RARP c. ICMP d. TFTP

52. Which file on HP_UX contains a list of standard port numbers for different applications?

a. /etc/hosts b. /etc/ports c. /etc/services d. /etc/protocols

53. The netstat command can be used to:

a. List the IP addresses assigned to network adapters

b. Display routes c. Number the incoming and outgoing data

packets d. All of the above

54. The standard telnet port address is:

a. 21 b. 23 c. 25 d. 80

55. The /var/adm/inetd.sec file is used for:

a. An added layer of security to the inetd daemon b. A secondary file for the inetd daemon which is

used if the primary file is not present c. A backup file for /etc/inetd.conf d. A secondary log file for the inetd daemon

56. Which of the following is not a hostname resolution

service? a. DNS b. NIS c. /etc/hosts database file d. /etc/resolv.conf file

57. Which configuration file is used by the DNS daemon

named at startup? a. /etc/named.conf b. /etc/named.boot c. /etc/resolv.conf d. /etc/nsswitch.conf

58. The default location for NIS maps is under which

directory? a. /var/yp b. /etc c. /etc/nis d. /var/nis

59. Which command is used to configure the master NIS

server? a. ypinit b. ypmake c. ypserv d. ypset

Page 205: Tips and Tricks for HP-UX Certificationdbmanagement.info/Books/MIX/HP_unix_book_for_certification_hp_unix...• Pass the HP-UX System Administration Exam. Tips and Tricks for HP -UX

60. What is not true about NFS? a. A system can act as NFS client and server at

the same time b. A system can export a single file, a directory,

or a filesystem c. A system can export a filesystem mounted

from another NFS server d. If a directory is exported, all of the directory

tree under this directory is automatically exported

61. Which of the following daemon is not a NFS daemon?

a. rpc.mountd b. biod c. rpc.lockd d. named

62. Which command is used to export filesystems

manually? a. exports b. exportfs c. showmount d. nfsstat

63. Which of the following is not an NFS Automounter

map? a. Direct b. Indirect c. Master d. Slave

64. What is the name of the NTP server daemon?

a. ntpd b. xntpd c. rpc.ntpd d. rpc.xntpd

Page 206: Tips and Tricks for HP-UX Certificationdbmanagement.info/Books/MIX/HP_unix_book_for_certification_hp_unix...• Pass the HP-UX System Administration Exam. Tips and Tricks for HP -UX

This page left blank intentionally.

Page 207: Tips and Tricks for HP-UX Certificationdbmanagement.info/Books/MIX/HP_unix_book_for_certification_hp_unix...• Pass the HP-UX System Administration Exam. Tips and Tricks for HP -UX

HP-UX Certification – Sample Exam

Test #2 1. On a system with a standard HP-UX installation, if the

user is greeted with the “>” they need to: a. Immediately log-off b. Reboot the system c. Complete their current command line d. Reset their password

2. A file may have more than one name. This is accomplished using which of the following commands?

a. dup b. ln c. alias d. fork

3. The default shell used in HP-UX 10.20 and above is the:

a. Korn b. C-shell c. Bourne d. Posix

4. VAR=$(date) is an example of: a. Variable substitution b. Command substitution c. Tilde substitution d. Alias substitution

5. By default, a command sends it’s output and error messages to:

a. The top and bottom of the screen b. File descriptors 1 and 2 respectively c. The screen and the syslog file d. The bit bucket, unless otherwise specified by

the user

6. Local networks or LANs are: a. Restricted to connecting systems in the same

building b. Rarely used by UNIX systems c. Only supported between devices from the

same vendor d. A standard in the modern computing enterprise

7. Job control refers to the shell’s ability to: a. Serialize multiple tasks b. Adjust the priority of running jobs c. Move a job from the foreground to the

background and vice-a-versa d. Repeat the same action over and over

8. The end of an “if” branch is indicated by the keyword: a. end b. fin c. endif d. fi

9. The tar command is used for: a. Printing the contents of a file b. Reformatting a file c. Making archive tapes d. Merging a file

10. Which of the following commands might be used to find all the lines in myfile that contain the string “hpux”?

a. find myfile –name hpux b. find myfile –string hpux c. search myfile hpux d. grep hpux myfile

11. The nice command allows a user to: a. Send “friendly” email messages to a group of

users b. Asks the system to be “nice” to the user’s

processes and give them preference c. Broadcast a greeting to all users as they log on d. Suggest to the operating system that the

process may be run at a weaker priority

12. What would the following file permissions mean? “rwxr-xr- -“

a. Read, write and execute permission for everyone

b. Read, write and execute permission for the file owner, read and execute permission for the group and only read permission for all others

c. The file owner is the only one who can execute the file

d. People who do not own the file and are not in it’s group, can only run it

13. If the device file for your CD-ROM is missing, (the

“ioscan –fn” command shows the H/W path exists, but there are no device files), whata command could you run, without rebooting the system, to create the device files?

a. mkcd –a b. insf –e c. lssf –e d. cdfs –a

Page 208: Tips and Tricks for HP-UX Certificationdbmanagement.info/Books/MIX/HP_unix_book_for_certification_hp_unix...• Pass the HP-UX System Administration Exam. Tips and Tricks for HP -UX

14. You want to create a new 200mb logical volume from the volume group vg00, using the default physical extent size. Instead of taking the default logical volume name, you want to name your logical volume “newlv”. What command would you use?

a. newlv –l 200 –n newlv /dev/vg00 b. lvcreate –L 200 –n newlv /dev/vg00 c. lvcreate –l 200 –n newlv vg00 d. mklv L 200 –n newlv vg00

15. Which of the following statements is TRUE for HP-UX 11 and above?

a. “/stand can be either hfs or vxfs if you have On-Line JFS

b. “/stand” must be vxfs, but “/” can be vxfs or hfs

c. “/stand and “/” must be hfs d. “/stand” must be hfs, but “/” can be vxfs

16. The file tht contains the default file systems type for file system creation is:

a. /etc/fstab b. /etc/filesystem c. /etc/default/fs d. /var/adm/sbtab

17. The ____ command will show currently mounted file systems, the total size of each system, the amount of space used from each file system and the amount of space available in each file system.

a. mount b. bdf c. du d. ll

18. Which of the following statements is FALSE? a. If cron.allow and cron.deny have entries,

cron.deny is ignored b. If there is no cron.allow and a cron.deny exists

with no entries, everyone can use cron c. If cron.allow is empty, only the super user

(root) can use cron d. There must be a cron.deny or cron.allow file

present on the system, in order to use cron

19. Your manager makes a request for you to create a script that will start a daemon at system boot. In what directory would you put this script and the corresponding file for the script?

a. /sbin/init.d , /etc/rc.config.d b. /sbin/rc , /etc/netconfig c. /sbin/startups, /etc/inittab d. /usr/sbin, /etc/rc.config.d

20. You are currently in the /stand/build directory building a new static kernel for an HP-UX 11.00 system. You have completed all the tasks to build the kernel. Which tasks, in order, must be performed to make the new kernel the running kernel and also preserve the old kernel?

Step 1: shutdown –ry 0 Step 2: mv /stand/system /stand/system.prev; mv system /stand/system Step 3: kmupdate Step 4: mv /stand/vmunix /stand/vmunix.prev; mv vmunix_test /stand/vmunix

a. Step 3, step 1 b. Step 3, step 2, step 1 c. Step 3, step 4, step 1 d. Step 4, step 1

21. If a user forgets their password, how can root find out what it was?

a. Look in /etc/passwd b. Nobody can find out what a password was,

once it has been encrypted c. Look in /secure/passwd d. Use the passwd command

22. A UID of zero indicates: a. A super user b. A deactivated user c. An invalid user d. A restricted user

23. The command lsdev is used to show block and character:

a. Minor numbers for all drivers configured into the kernel

b. Major numbers for all drivers c. Major numbers for all drivers configured into

the kernel d. Major numbers for all drivers currently in use

by system peripherals

24. When an update is made to a JFS file system mounted with the log option:

a. All the metadata updates are recorded in an intent log transation record, which is physically written to the intent log on the disk

b. Some metadata changes are written to disk immediately and others will be written to disk when a sync is issued

c. All the metadata and data updates are recorded in a single intent log transation record, which is then flushed out to disk in to the intent log

d. All the metadata changes are writeen only when a sync is issued

Page 209: Tips and Tricks for HP-UX Certificationdbmanagement.info/Books/MIX/HP_unix_book_for_certification_hp_unix...• Pass the HP-UX System Administration Exam. Tips and Tricks for HP -UX

25. The newfs command is used to create: a. HFS file systems only b. CDFS file systems c. A mirror copy of an existing file system d. HFS and JFS file systems

26. The program that runs automatically at the end of an install to establish the system date, hostname and IP address is:

a. /sbin/set_parms b. /etc/hosts c. /sbin/date d. /sbin/setboot

27. Besides the standard ioscan command, another command that could be used to identify which hardware address “goes with” which device file is:

a. lssf b. listsf c. lssspecial d. displaysf

28. What command would you use to check the physical extent size that will be used when you create logical volumes from the volume group “vgmyvol”?

a. vgshow /dev/vgmyvol b. pvdisplay /dev/vgmyvol c. lvdisplay /dev/vgmyvol d. vgdisplay /dev/vgmyvol

29. Which of the following statements is TRUE? a. Mounting a file system on a directory will

erase all fiels in that directory b. When creating a fiel system of type “hfs”, an

entry will be placed in /var/adm/sbtab c. The “unmount” command will unmount a fiel

system from a mount point d. The /etc/fstab file is no longer used in

HP-UX 11.0

30. You do not want the cron daemon to start at system boot. What action should you take?

a. Run the “unset cron” command b. Change the value of the CRON variable in

/sbin/init.d/cron from 1 to 0 c. Change the value of the CRON variable in

/etc/rc.config.d/cron from 1 to 0 d. Remove the /usr/sbin/cron executable

31. Which protocol maps IP addresses of remote nodes to their corresponding MAC addresses?

a. IP b. ARP c. TCP d. ICMP

32. Which type of access method is used by Ethernet and IEEE 802.3 networks?

a. Fiber Distributed Data Interface (FDDI) b. Demand Priority Protocol (100VG-AnyLAN) c. Carrier-Sense, Multiple-Access with Collision

Detection (CSMA/CD) d. Dynamic Host Configuration Protocol (DHCP)

33. The _____ command can be used to view the routing table on a system

a. route b. netroute c. netstat d. nfsstat

34. The default “netmask” for a class B network is: a. 127.0.0.1 b. 255.0.0.0 c. 0.255.255.255 d. 255.255.0.0

35. Using NFS, a server ____ and a client ____ file systems and/or directories:

a. exports; imports b. mounts; imports c. writes; receives d. exports; mounts

36. Which of the following is NOT an NIS command? a. ypinit b. ypmatch c. yphost d. ypmake

37. Which of the following daemons only runs on a NIS master server?

a. ypserv b. ypinit c. rpc.yppasswd d. ypxfrd

38. Three mechanisms available for converting hostnames to their corresponding IP addresses are:

a. NFS, UDP and DNS b. TCP, NIS and telnet c. DNS, NIS and /etc/hosts d. NIS,NFS and ICMP

Page 210: Tips and Tricks for HP-UX Certificationdbmanagement.info/Books/MIX/HP_unix_book_for_certification_hp_unix...• Pass the HP-UX System Administration Exam. Tips and Tricks for HP -UX

39. The file /var/adm/inetd.sec is used to: a. Provide an extra layer of security for

HP-UX systems b. Specify extra security for anonymous FTP

users c. Control access to the internet daemons

database d. Further control access to some internet daemon

services

40. Which of the following can NOT be determined from the netstat command?

a. State of IP-Forwarding b. Network interface status c. Active Socket connections d. Route table entries

41. Which of the following commands will reconfigure the DNS nameserver daemon (named)?

a. /sbin/init.d/named reconfig b. sig_named restart c. dns –q d. named restart

42. The maximum cable length of each 10BaseT segment is:

a. 10 meters b. 20 meters c. 100 meters d. 200 meters

43. Which of the following commands would allow you to determine the MAC (Ethernet) address of the local system’s NICs?

a. swlist b. ioscan c. lanscan d. ifconfig

44. If you are unable to linkloop a critical server on your local area network, what can you conclude?

a. Your routing tables are misconfigured b. Your netmask is misconfigured c. The server’s linkooped daemon died d. You LAN car has lost physical connectivity to

the server

45. At which run level would NFS file systems be exported (on a default HP-UX installation)?

a. One b. Two c. Three d. Four

46. The “automounter” or AutoFS services can be used to: a. Perform automatic load balancing among

alternate NFS servers b. Automatically mount and unmount NFS mount

points on demand c. Automatically mount CDs on the local host d. Automatically increase file system swap

47. When configuring a host as a secondary or slave DNS name server, which of the following steps is NOT required on the host?

a. Modify the /etc/rc.config.d/namesvrs file b. Run the hosts_to_named command c. Copy a boot configuration file from the

primary or master DNS server host d. Copy db.* files from the primary or master

DNS server

48. In DNS, how many server addresses may be configured through the /etc/resolv.conf file?

a. 2 b. 4 c. 5 d. 3

Page 211: Tips and Tricks for HP-UX Certificationdbmanagement.info/Books/MIX/HP_unix_book_for_certification_hp_unix...• Pass the HP-UX System Administration Exam. Tips and Tricks for HP -UX

HP-UX Certification – Sample Exam

Test 3 1. How to get help for a command?

a. help cal b. man cal c. ? cal d. grep cal

2. What are the possible steps to unmount a filesystem?

a. fuser –ku ; umount b. unmount c. stop ; umount d. kill ; umount

3. The default HP-UX shell is:

a. Vmunix shell b. C shell c. POSIX shell d. Default shell

4. Where is the default route entry present?

a. /etc/rc.config.d/netdaemons b. /etc/resolv.conf c. /etc/rc.config.d/route.conf d. /etc/rc.config.d/netconf

5. Each NIS map consists of two files ending with what?

a. .pag and .dir b. .dir and .fil c. .name and .addr d. .pri and .sac

6. How to assign the output of “date” and “cal”

commands to a variable? a. VAR=$(date ; cal ) b. VAR=$(date + cal) c. Date > VAR | cal >> VAR d. VAR=date;cal

7. What are the steps to extend mounted filesystem

having OnlineJFS? a. umount,lvextend,fsadm,mount b. umount,lvextend,extendfs,mount c. lvextend,extendfs d. lvextend,fsadm

8. What would be the steps to decrease the size of

secondary swap? a. swapoff, lvreduce, swapon b. lvreduce, swapon c. Can not reduce a secondary swap d. Comment the swap entry in fstab file , reboot,

lvreduce, swapon, modify fstab

9. Where is the list of the currently exported NFS –server filesystems?

a. /etc/fstab b. /etc/xtab c. /etc/exports d. /etc/nfstab

10. What command is used to count words in a file?

a. cw b. words c. wc d. count

11. What command is used to create a system archive

tape? a. make_archive b. system_archive c. make_recovery d. create_archive

12. Which protocol provides a MAC address for a given IP

address? a. ARP b. RARP c. RIP d. AMP

13. How the output result code of a script can be

displayed? a. $? b. ?$ c. $e d. $*

14. Which script starts the rpc daemon?

a. /sbin/init.d/nfs.core b. /sbin/init.d/nfs.client c. /sbin/init.d/nfs.server d. /sbin/init.d/net

15. How a DNS server can be also configured as a client?

a. Modify /etc/rc.config.d/namesvrs b. Modify /etc/named.boot c. No, it can not be configured d. Modify /etc/resolv.conf

16. Which file needs to be modified to prevent a remote

printing? a. /etc/rlp.conf b. /etc/inetd.conf c. /opt/hpnp/etc/rlp.conf d. /etc/rc.config.d/netconf

Page 212: Tips and Tricks for HP-UX Certificationdbmanagement.info/Books/MIX/HP_unix_book_for_certification_hp_unix...• Pass the HP-UX System Administration Exam. Tips and Tricks for HP -UX

17. How to retrieve the output of a question that was echoed by a script?

a. read b. retrieve c. get d. input

18. Where the .rhosts file is located?

a. /etc b. $RHOSTS c. $HOME d. /var

19. In what format are patches distributed?

a. Arc b. Shar c. Gzip d. Pat

20. Which syntax of the .rhosts and/or hosts.equiv files is

incorrect? a. –john b. + john c. john,bob,-jeff d. hpbox john

21. Which backup utility is mostly used on different UX

platforms? a. tar b. cpio c. dump d. fbackup

22. A filesystem is NFS exported as “/home –

rw=hp1:hp2,root=hp1” a. Users on hp1 system have read and write

access b. User hp1 has read and write access c. Root on hp1 system has read and write access d. User hp1 becomes root

23. What is the default run level at HP-UX 11.00?

a. 1 b. 2 c. 3 d. 4

24. Which one is not a name resolution service?

a. /etc/resolv b. NIS c. DNS d. /etc/hosts

25. What is a codeword used for? a. Install protected software from CDROM b. Keep users away from the system c. Keep hackers away from the system d. Filesystem permissions

26. Where the entries of all NFS remotely mounted file

systems are present? a. /etc/fstab b. /etc/nfstab c. /etc/mounts d. /etc/rmtab

27. What command is used to display info about device

file, besides ioscan command? a. devdisplay b. lssf c. dfinfo d. lsdev

28. At system startup, where the configuration scripts are

located? a. /etc/config.d b. /etc/rc.config.d c. /etc/config d. /etc/rc.start.d

29. How to find out a list of all physical volumes that

belong to a certain volume group? a. vgdisplay –v b. pvdisplay –v c. lvdisplay –v d. pvlist –v

30. When ioscan shows the devices but their device files

are missing, how to install these device files without a reboot?

a. mkdf –e b. dfcreate –a c. insf –e d. insf –A

31. What is the definition of a socket?

a. A combination of an IP address and MAC address

b. A combination of two ports c. A combination of an IP address and host name d. A combination of an IP address and port

number 32. What does the major number correspond to?

a. A driver built into the kernel b. Another name for an inode c. Roots UID d. System id

Page 213: Tips and Tricks for HP-UX Certificationdbmanagement.info/Books/MIX/HP_unix_book_for_certification_hp_unix...• Pass the HP-UX System Administration Exam. Tips and Tricks for HP -UX

33. What command can be used to match all occurrences of “net and “Net” as a whole word in a file?

a. grep ^[nN]et? b. grep \<[nN]et\> c. grep \{net,Net\} d. grep ‘^(net|Net)’

34. What is the network and broadcast addresses of a host

that has an IP address 17.10.128.7 with a netmask 255.255.128.0?

a. Network 17.10.128.0 and broadcast 17.10.159.255

b. Network 17.10.255.0 and broadcast 17.10.255.255

c. Network 17.10.128.0 and broadcast 17.10.255.255

d. Network 17.10.255.0 and broadcast 17.10.159.255

35. Which statement is not true about NFS?

a. NFS Server can be NFS Client at the same time

b. NFS Server can be NIS server at the same time c. NFS Mounted tape can be used for a patch

depot d. NFS communication between client and server

takes place through rpc’s 36. How to extend a mounted HFS filesystem?

a. lvextend, extendfs b. umount, lvextend, fsadm, mount c. umount, lvextend, extendfs, mount d. lvextend, fsadm

37. The chown command is used for what?

a. Change ownership b. Change system id c. Modify owners info d. Change owners login

38. What command is used to display the current group id?

a. grpid b. groupid c. grep id d. id

39. What the device file is when the ioscan output shows

h/w path 0/0/0/2.5.0 and its controller card instance number is 0?

a. /dev/rmt/c2t5d0 b. /dev/dsk/c2.5.0 c. /dev/dsk/c0t5d0 d. /dev/rmt/c0t5d0

40. Create a route for the network 195.124.7.0 and its gateway is195.124.9.1?

a. route 195.124.7.0 195.124.9.1 0 b. route 195.124.9.1 195.124.7.0 0 c. route 195.124.7.0 195.124.9.1 1 d. route 195.124.9.1 195.124.7.0 1

41. What task can NOT be performed by the lanadmin

command? a. Reset a network adapter b. Display routes c. Change the MTU d. Display simple network errors

42. What process is used to boot a user into single user

mode? a. ISL -> hpux b. ISL -> s c. ISL -> boot d. ISL -> su

43. Where a list of installed software is located at?

a. Installed products database b. /var/adm/sw/depot c. /opt/sw/product d. /var/spool/sw/depot

44. What run level do the NFS scripts start?

a. The nfs.server at runlevel 3, nfs.core and nfs.client at run level 2

b. The nfs.core at runlevel 2, nfs.client and nfs.server at run level 3

c. The nfs.core, nfs.client, and nfs.server at run level 2

d. The nfs.core, nfs.client, and nfs.server at run level 3

45. SAM is restricted to whom?

a. Only to root b. Only to root and any local users c. Only to root and adm d. To local root and users that are granted access e.

46. Which RPC daemon is used on HPUX 11.00? a. portrpc b. rpcmap c. portmap d. rpcbind

47. How to send stdout and stderr to the same file?

a. cat file1 file2>file 3 2>>file3 b. cat file1 file2 2&>1 file3 c. cat file1 file2 file3 2>&1 d. cat file1 file2 1>&2 file3

Page 214: Tips and Tricks for HP-UX Certificationdbmanagement.info/Books/MIX/HP_unix_book_for_certification_hp_unix...• Pass the HP-UX System Administration Exam. Tips and Tricks for HP -UX

48. What command is used to view a status of NTP? a. ntpq b. ntpdisplay c. ntpstat d. ntp

49. What does “cp –r /dba1/dba2 command do?

a. Copies the contents of the dba1 directory into dba2 directory

b. Copies the contents of the dba2 directory into dba1 directory

c. Replaces dba1 file with dba2 file d. Replaces dba2 file with dba1 file

50. Which one is a correct device file for the tape device

with scsi id 5, controller card instance 2, compression mode and no rewind?

a. /dev/dsk/c2t5d0BESTn b. /dev/rmt/c2t5d0BESTrn c. /dev/rmt/5mn d. /dev/rmt/c2t5d0BESTn

51. Consider a directory with 6 files: f1.a, f11.c, f12.b,

f22.a, f33.ac, f2.a – If we use the command ls f [1-9]?.[a-c] the files displayed would be?

a. f11.c, f12.b, f33.ac, f 22.a b. f11.c and f12.b c. f11.c, f12.b, and f22.a d. f1.a, f11.c, and f12.b

52. What are quotes used for?

a. Redirect command output b. Comments c. Additional information d. Variable assignment

53. What command is used to display the internet and

Ethernet addresses mapping? a. netstat b. arp c. netmap d. mapstat

54. What is the kmupdate command used for?

a. To synchronize different kernel files b. To modify the kernel c. To update kernel memory d. To move vmunix_test to /stand directory

55. How to properly shutdown a system?

a. reboot –h b. shutdown –O c. init 0 d. shutdown –h

56. What is the default files umask? a. rwxrwxrwx b. rw-rw-rw- c. rw-rw-r- - d. rw-r-xr- -

57. Which file is used to specify the local domain name?

a. /etc/hosts b. /etc/resolv.conf c. /etc/nsswitch.conf d. /etc/rc.config.d/namesvrs

58. Which utility does not belong to Berkeley services?

a. remsh b. rwho c. ruptime d. rsh

59. Which one does have the least security level?

a. Mounted filesystems b. Directories c. Sub-directories d. Files

60. How to search the content of a file bypassing a specific

pattern? a. grep –v b. find / ^? c. grep –r d. Find / “”

61. How many hosts can be placed in a network which has

a netmask of 255.255.255.224? a. 32 b. 30 c. 16 d. 14

62. What file is used to prevent multiple lpsched processes

to be started? a. SCHEDLOCK b. Swlock c. Lpschedlock d. LPSCHEDLOCK

63. Which command is used to synchronize time with

another NTP system? a. ntpq b. ntpstat c. ntpsync d. ntpdate

Page 215: Tips and Tricks for HP-UX Certificationdbmanagement.info/Books/MIX/HP_unix_book_for_certification_hp_unix...• Pass the HP-UX System Administration Exam. Tips and Tricks for HP -UX

64. What is HP-UX based on? a. Berkeley b. ATT System V c. MCI System V d. Internic System V

65. How to synchronize the NFS exported and mounted

filesystems? a. Use –sync option with exportfs b. There is no sync option with exportfs c. They are automatically synchronized d. Properly setup /etc/rc.config.d/nfsconf file

66. Create a directory “custom” under /etc/skel and place a “config” file there. Then create a new user using SAM. What would be “config” file permissions?

a. User has read only access to ~/custom/config file

b. ~/custom/config belongs to this user c. user does not have any permissions to this file d. ~/custom/config will not be copied into this

users home directory 67. After you have created a /dev/vg01 directory, what

command is used to create a group file? a. mknod b. mkgroup c. mksf d. mkgrp

68. Where are the most system log file located?

a. /var/adm b. /tmp c. /var/logs d. /opt/adm

69. Which utility is used to create an archive tape of

everything in vg00? a. make_archive /dev/vg00 b. make_recovery –A c. make_vg00 d. make_image –A

70. Which one of the following would display the PWD

variable? a. echo $(PWD) b. echo ${PWD}7 c. echo $PWD7 d. echo ‘$PWD’

71. Which file is used for automount configuration?

a. /tmp_mnt b. /etc/rc.config.d/netdaemons c. /etc/rc.config.d/nfsconf d. /etc/nfs.conf

72. What command is used to list bootable disks? a. lvlnboot –v b. strings /etc/lvmtab c. vgdisplay –v d. diskinfo –v

73. What is the command to print /etc/hosts file to the LJ4

printer? a. lp /etc/hosts LJ4 b. lp –dLJ4 /etc/hosts c. lp –p /etc/hosts LJ4 d. lp LJ4 /etc/hosts

74. Can a not root user specify a process priority for

his/her own script/program? a. No, only root can do it b. Yes, use a “nice” command c. Only restricted users can do it d. It depends on what script a user wants to start

75. Which statement is NOT true about NIS server?

a. NIS server can also be configured as NFS server

b. NIS server configuration file is /etc/rc.config.d/namesvrs

c. NIS can be either master or slave server d. NIS server does not have to be NIS client

76. What pvcreate command can be used for?

a. Create PVRA and VGRA b. Create a boot strap area c. Hard partition a disk d. Low level format

77. What is the fsck command used for?

a. Check only hfs filesystems b. Check only vxfs filesystems c. Check hfs and vxfs filesystems d. Check floppy disks

78. A given IP address 192.7.7.0 can be broken down into

four subnetworks. Which netmask needs to be used here?

a. 255.255.255.128 b. 255.255.255.0 c. 255.255.192.255 d. 255.255.255.192

79. What is used to install software on HP-UX systems?

a. Software installer b. Software manager c. Software distributor d. Software administrator

Page 216: Tips and Tricks for HP-UX Certificationdbmanagement.info/Books/MIX/HP_unix_book_for_certification_hp_unix...• Pass the HP-UX System Administration Exam. Tips and Tricks for HP -UX

80. Which file is used by hosts_to_named command to create DNS data files?

a. named.data b. named.boot c. param d. dns.conf

Page 217: Tips and Tricks for HP-UX Certificationdbmanagement.info/Books/MIX/HP_unix_book_for_certification_hp_unix...• Pass the HP-UX System Administration Exam. Tips and Tricks for HP -UX

HP-UX Certification – Sample Exam

Test #4

1. What command would set the variable TODAY to the output of the “date” command?

a. TODAY=${date} b. TODAY=`date ̀c. TODAY=date d. TODAY=”date”

2. What file system can create inodes as needed after

filesystems creation? a. JFS b. HFS c. DFS d. XFS

3. How is hardware controlled by the system?

a. Through device files b. Through /etc/sysio c. Through kernel drivers d. Through applications

4. What is the name of the NIS client daemon?

a. ypnetd b. ypclientd c. ypnisd d. ypbind

5. Consider the following entry from /etc/ntp.conf

Server 127.127.4.2 What is being used as the time server?

a. an external device connected to the serial port 2

b. an internal device using port 2 c. internet server configured as host 2 d. it is incorrect configuration

6. How do you list all files in the current directory

excluding . and .. ? a. Echo .[!.]* b. Echo .* c. Echo .?* d. Echo .[.]*

7. Suppose you are in single user mode and want to

install software. What command will start the swagentd daemon?

a. /sbin/init.d/swagentd –a b. /sbin/init.d/swagentd –s c. /sbin/init.d/swagentd up d. /sbin/init.d/swagentd start

8. In which file does hfs record the locations of backup copies of the superblock?

a. /etc/sbtab b. /etc/fstab c. /var/adm/fstab d. /var/adm/sbtab

9. What HP-Ux command is used to display the MAC

address of installed network adapters? a. ifconfig b. lanscan c. macscan d. ioscan

10. How can you make sure that the variable VAR is

substituted in the following statement? a. ‘cmd $VAR’ b. ${cmd $VAR} c. “cmd $VAR” d. /cmd $VAR]

11. This file contains user defined options that are read

at system startup for file system mounting? a. /etc/systab b. /etc/mtab c. /etc/fstab d. /etc/sysconf

12. Consider the following entry in the /etc/hosts.equiv

file: +

Who may access the local system? a. all hosts can access the local system b. only root can access the local system c. only systems on the same subnet can

access this system d. it is incorrect usage

13. How do you rename a directory tmp to temp in the

current directory? a. mv tmp temp b. rm tmp temp c. ln tmp temp d. cn tmp temp

14. After updating NIS maps on the master server,

what command is used to have slaves update their files?

a. yppush b. ypupdate c. ypsync d. ypbind

Page 218: Tips and Tricks for HP-UX Certificationdbmanagement.info/Books/MIX/HP_unix_book_for_certification_hp_unix...• Pass the HP-UX System Administration Exam. Tips and Tricks for HP -UX

15. Which user id (UID) does a “nobody” user have? a. 2 b. 0 c. –1 d. –2

16. Where can a list of ports be found?

a. /etc/ports b. /etc/services c. /etc/inetd.conf d. /var/adm/inet

17. Who can change the password for a user?

a. The user and root b. Only root c. Only the user d. The password can not be changed

18. You have ip address 17.10.132.3 and a netmask of

255.255.128.0. What is the network address and broadcast address?

a. 17.10.128.0 and 17.10.128.255 b. 17.10.255.0 and 17.10.255.255 c. 17.10.128.0 and 17.10.255.255 d. 17.10.255.0 and 17.10.128.255

19. You have just created a new user, bob, but the user

reports that he is unable to log in. Why not? See the line from /etc/passwd: Bob:*:102:23::/home/bob:/sbin/sh

a. UID’s higher than 99 can not be used b. No password has been assigned to this user c. /sbin/sh shell can not be used for a not root

user d. incorrect syntax was detected for this user

20. You have a class A network and want to configure

over 2000 subnets and over 8000 hosts? Which subnet mask do you need?

a. 255.255.0.0 b. 255.255.252.0 c. 255.255.224.0 d. 255.252.0.0

21. What system of disk configuration allows you to

have a file system that spans disks? a. LVM b. Whole Disk c. DxVM d. DVM

22. Which access control method is used by Ethernet?

a. CMSA/CD b. ARP c. Token Passing d. FDDI

23. What command will provide you with the device file name for a physical disk in HPUX?

a. diskstat b. diskinfo c. ioscan d. diskscan

24. After you made changes to the inetd daemon, How

do you activate them? a. call inetd –c b. call inetd –r c. call /sbin/init d. you need to reboot the system

25. When installing HPUX , there are 3 choices for a

file system type. Which one is not one of them? a. Whole disk with vxfs b. Lvm with vxfs c. Lvm with hfs d. Whole disk with hfs

26. Consider the following entry in .rhosts

A –B + C Which statement is True on system H? a. User A can not login to the system H but user

C can b. User B can not login but all users on system C

can login to system H c. User B from system A is denied login to

system H but user C can login d. User B from system A is denied login to

system H but user C can login from all systems as user C

27. This element can be added to logical volumes and

is by default 4 mbytes in size: a. Whole disk extent b. Physical extent c. Superblock extent d. Segment extent

28. Which command do you use to get help?

a. ?? cmd b. man cmd c. help cmd d. what cmd

29. Suppose you have built a new kernel that failed to

boot. The old kernel is named vmunix.prev. At the ISL > prompt how can you boot with the old kernel?

a. hpux /stand/vmunix.prev b. bo /stand/vmunix/prev c. hpux –is d. hpux –prev

Page 219: Tips and Tricks for HP-UX Certificationdbmanagement.info/Books/MIX/HP_unix_book_for_certification_hp_unix...• Pass the HP-UX System Administration Exam. Tips and Tricks for HP -UX

30. What type of device is listed below? crw-r- - - - - 1 bin sys 188 0c0040000 Aug 12 2002 c0t1d0

a. control b. block c. raw d. common

31. What command is used to query NTP servers and

clients? a. ntpsync b. ntp.conf c. xntpd d. ntpq

32. With the HFS filesystem, what is the number of the

first alternate superblock? a. 16 b. 1 c. 8 d. 32

33. What command lists the group id?

a. who b. id c. group d. whoami

34. You have an ip address starting with 15 and a

netmask 255.255.252.0. How many hosts can you have in a subnet?

a. 2046 b. 4094 c. 1022 d. 8190

35. You have a new gateway to connect to a network

15 through a router ip address 145.10.23.1. Which route statement is correct?

a. route add net 145.10.23.1 15.0.0.0 1 b. route add net 145.10.23.1 15.0.0.0 0 c. route add net 15.0.0.0 145.10.23.1 1 d. route add net 15.0.0.0 145.10.23.1 0

36. The number of links to a file, information about the

owner, group, timestamp, and file size are stored in the _______?

a. fstab b. passwd c. inodes d. superblocks

37. How to remove a directory and the files underneath?

a. rm –r dir b. rmdir –r dir c. rmdir dir d. rm dir

38. What is the preferred method to direct both stdout

and stderr to the same file? a. cat file1 >file2 >>file2 b. cat file1 2&>1 file2 c. cat file1 1>&2 file2 d. cat file1 > file2 2>&1

39. What command will run the program myprog with

a nice priority of 5? a. nice - - 5 myprog b. nice – 15 myprog c. nice - - 15 myprog d. nice –5 myprog

40. Which command lists the ip address to hardware

address translation table? a. arp b. lanadmin c. netstat d. ifconfig

41. What is the loopback address used for?

a. Gateways use it to trace lost packets b. It allows to send packets to own interface c. It is only used for test purposes d. It allows to send packets back to the host

42. How do you create a software depot?

a. swcopy b. swconfig c. swinstall d. swmake

43. When the run level is changed from 1 to 2 which

of the following scripts run last? a. /sbin/rc2.d/S565Snmp TrpDst b. /sbin/rc2.d/K900nfs.server c. /sbin/rc2.d/S565SnmpMib2 d. /sbin/rc2.d/S100swagentd

44. What is the linkloop command used for?

a. To send a test to the loopback interface b. To trace local lan throughput c. To trace packet loss d. To connect to a router

Page 220: Tips and Tricks for HP-UX Certificationdbmanagement.info/Books/MIX/HP_unix_book_for_certification_hp_unix...• Pass the HP-UX System Administration Exam. Tips and Tricks for HP -UX

45. What is true about kernel drivers on 11.00? a. You have to create a new kernel to add

drivers b. The autoboot process adds new drivers c. Only SAM can be used to add drivers d. You can add drivers dynamically

46. A customer adds a system to the heavily used NIS

domain which uses local maps/ Which statement would you expect in /etc/nsswitch.conf?

a. passwd:n is b. passwd: nis files c. passwd: compat d. passwd: nis

[NOTFOUND=CONTINUE]files

47. How do you assign the value of the date and cal commands to a variable?

a. VAR=$(date;cal) b. VAR=$(date + cal) c. VAR={date cal} d. Date > VAR;cal > VAR

48. Which ftp command do you use to send a file from

your local system to the remote system? a. put b. get c. cp d. rcp

49. What action needs to be done when the user is

greeted with the “>” prompt? a. Complete the current command line b. Immediately log off c. Reboot the system d. Reset their password

50. Which command besides lssf can be used to list

interface cards and their device files? a. lsdev b. mksf c. ioconfig d. ioscan

51. What is the correct syntax for an until loop?

a. repeat – do – done b. until – do – end c. until – do – done d. until – begin – end

52. What command is used if you want to wait for

backgroup jobs to finish? a. pause b. sleep c. until d. wait

53. You exported /opt via NFS. What can be mounted on a client?

a. Any directories under /opt as long as they are not on a different file system

b. Any files or directories under /opt as long as they are not on a different file system

c. Any files or directories under and including /opt

d. Any files or directories under /opt as long as they don’t contain links

54. Which of the following is not affected by an insf

command? a. /dev/* b. /etc/ioconfig c. ioscan d. /var/adm/sysio

55. How can you start a process with a nice value of

15? a. nice –15 prog b. renice - - 5 prog c. renice 15 prog d. nice - - 5 prog

56. Which one of the following is not a loop?

a. While – do – done b. Let – do – done c. Until – do – done d. For – do – done

57. Given the following automount map files, where

will the directory be mounted on the client? /etc/auto_master /home/etc/auto_home /etc/auto_home boota hp0:/home/boota

a. /boota b. /home/boota c. /home d. /etc/boota

58. Which file is not one of the telnet configuration

files? a. /etc/inetd.conf b. /etc/services c. /var/adm/inetd.sec d. /etc/rc.config.d/telnetd.conf

59. Which daemon needs to be running in order for

SD-UX commands to work? a. swagentd b. swd c. agentd d. swinstalld

Page 221: Tips and Tricks for HP-UX Certificationdbmanagement.info/Books/MIX/HP_unix_book_for_certification_hp_unix...• Pass the HP-UX System Administration Exam. Tips and Tricks for HP -UX

60. How do you check the exit code of the last executed program?

a. echo $? b. echo $# c. echo $e d. echo $!

61. When do you see the error “stale file handle” with

NFS? a. When the client tries to mount a file

system which is already mounted b. When the client has a directory mounted

which is no longer available on the server c. When the server accepts too many

asynchronous connections d. When the server does not keep state

connections

62. How many HFS file systems do you have at a minimum on 10.20 and above?

a. One which is /stand b. None c. Two which are /stand and / d. Three which are /stand, /, and /etc

63. What is true about the root user?

a. /etc/hosts.equiv is not read by root b. .rhosts is read before /etc/hosts.equiv c. Berkeley does not allow login without a

password d. .rhosts is read after /etc/hosts.equiv

64. What command is used to list background running

jobs? a. ls –b b. jobs c. bg –l d. bg

65. How to configure a DNS Client?

a. Edit /etc/named.boot b. Edit /etc/resolv.conf c. Edit /etc/named.data/boot.sec d. Edit /etc/nsswitch.conf

66. Which information is not returned by the vgdisplay

command? a. Volume group name b. Total PE c. Allocated PE d. File system mount point

67. What is the name of the LVM root volume group? a. Any name can be chosen b. vg00 c. root d. vgroot

68. Which one of the following should not execute the

date command? a. echo ${date} b. echo $(date) c. echo `date ̀d. echo “`date`”

69. What is the main advantage of JFS over HFS?

a. Automatic defragmentation b. Faster recovery c. Better application performance d. Better memory usage

70. Which UNIX shell does not have history nor job

control features? a. POSIX b. Bourne c. C d. Korn

71. Which file is read when bootpd sends a broadcast?

a. /var/adm/bootp b. /sbin/boot c. /etc/bootptab d. /var/boottab

72. Which script is responsible for the startup process?

a. /sbin/rc b. /etc/rc.conf c. /var/adm/rc d. /usr/sbin/start

73. Which command should you use to suspend

execution of a loop for a certain amount of time? a. wait b. sleep c. pause d. timer

74. Which command do you use to create the group

special file for volume group vg01? a. mksf b. mknod c. touch d. insf

Page 222: Tips and Tricks for HP-UX Certificationdbmanagement.info/Books/MIX/HP_unix_book_for_certification_hp_unix...• Pass the HP-UX System Administration Exam. Tips and Tricks for HP -UX

75. Which network port is used by ftp? a. 25 b. 23 c. 28 d. 21

76. Which is correct usage of the pvcreate command?

a. pvcreate /dev/vg01 b. pvcreate /dev/rdsk/c1t2d0 c. pvcreate –m 200 /dev/rdsk/c1t2d0 d. pvcreate /dev/vg01/lvol1

77. How do you prevent another system from

accessing your local printer? a. Edit /etc/rlp.conf b. Edit /etc/services c. Edit /var/adm/inetd.sec d. Edit /etc/inetd.conf

78. How to start the NTP daemon process?

a. /etc/init.d/ntpq start b. /opt/ntp/xntpd start c. /etc/ntp.conf start d. /etc/init.d/xntpd start

79. How do you extend either HFS or Online JFS file

systems? a. lvextend, fsadm b. umount, extendfs, lvextend, mount c. umount, lvextend, extendfs, mount d. lvextend, umount, fsadm, mount

80. Which RPC daemon is used on HP-UX up to

version 10.20? a. portd b. rpcd c. portmap d. rpcbind

Page 223: Tips and Tricks for HP-UX Certificationdbmanagement.info/Books/MIX/HP_unix_book_for_certification_hp_unix...• Pass the HP-UX System Administration Exam. Tips and Tricks for HP -UX

HPCS Technical On-line Seminar Program

Appendix:

Answers

Page 224: Tips and Tricks for HP-UX Certificationdbmanagement.info/Books/MIX/HP_unix_book_for_certification_hp_unix...• Pass the HP-UX System Administration Exam. Tips and Tricks for HP -UX
Page 225: Tips and Tricks for HP-UX Certificationdbmanagement.info/Books/MIX/HP_unix_book_for_certification_hp_unix...• Pass the HP-UX System Administration Exam. Tips and Tricks for HP -UX

Answers: Test 1 1.B 41.D 2.C 42.B 3.A 43.A 4.A 44.B 5.C 45.A 6.A 46.B 7.A 47.D 8.D 48.C 9.B 49.C 10.C 50.D 11.D 51.A 12.A 52.C 13.A 53.D 14.D 54.B 15.C 55.A 16.B 56.D 17.B 57.B 18.C 58.A 19.C 59.A 20.D 60.C 21.A 61.D 22.D 62.B 23.B 63.D 24.A 64.B 25.C 65.END OF TEST 26.A 66. 27.A 67. 28.C 68. 29.A 69. 30.A 70. 31.A 71. 32.B 72. 33.C 73. 34.C 74. 35.D 75. 36.B 76. 37.B 77. 38.D 78. 39.A 79. 40.A 80.

Page 226: Tips and Tricks for HP-UX Certificationdbmanagement.info/Books/MIX/HP_unix_book_for_certification_hp_unix...• Pass the HP-UX System Administration Exam. Tips and Tricks for HP -UX

Answers: Test2 1. C 41.B 2. B 42.C 3. D 43.C 4. B 44.D 5. B 45.C 6. D 46.B 7. C 47.B 8. D 48.D 9. C 49. End of test 10. D 50. 11. D 51. 12. B 52. 13. B 53. 14. B 54. 15. D 55. 16. C 56. 17. B 57. 18. D 58. 19. A 59. 20. B 60. 21. B 61. 22. A 62. 23. C 63. 24. A 64. 25. D 65. 26. A 66. 27. A 67. 28. D 68. 29. B 69. 30. C 70. 31. B 71. 32. C 72. 33. C 73. 34. D 74. 35. D 75. 36. C 76. 37. C 77. 38. C 78. 39. D 79. 40. A 80.

Page 227: Tips and Tricks for HP-UX Certificationdbmanagement.info/Books/MIX/HP_unix_book_for_certification_hp_unix...• Pass the HP-UX System Administration Exam. Tips and Tricks for HP -UX

Answers: Test3 1. B 41. B 2. A 42.A 3. C 43.A 4. D 44.A 5. A 45.D 6. A 46.D 7. D 47.A 8. D 48.A 9. B 49.A 10. C 50.D 11. C 51.C 12. A 52.D 13. A 53.B 14. A 54.D 15. D 55.D 16. B 56.B 17. A 57.B 18. C 58.D 19. B 59.A 20. C 60.A 21. A 61.B 22. A 62.A 23. C 63.D 24. A 64.B 25. A 65.B 26. D 66.D 27. B 67.A 28. B 68.A 29. A 69.B 30. C 70.B 31. D 71.C 32. A 72.A 33. B 73.B 34. C 74.B 35. C 75.D 36. C 76.B 37. A 77.C 38. D 78.D 39. C 79.C 40. A 80.C

Page 228: Tips and Tricks for HP-UX Certificationdbmanagement.info/Books/MIX/HP_unix_book_for_certification_hp_unix...• Pass the HP-UX System Administration Exam. Tips and Tricks for HP -UX

Answers: Test4 1. B 41. B 2. A 42.A 3. C 43.A 4. D 44.A 5. A 45.D 6. A 46.D 7. D 47.A 8. D 48.A 9. B 49.A 10. C 50.D 11. C 51.C 12. A 52.D 13. A 53.B 14. A 54.D 15. D 55.D 16. B 56.B 17. A 57.B 18. C 58.D 19. B 59.A 20. C 60.A 21. A 61.B 22. A 62.A 23. C 63.D 24. A 64.B 25. A 65.B 26. D 66.D 27. B 67.A 28. B 68.A 29. A 69.B 30. C 70.B 31. D 71.C 32. A 72.A 33. B 73.B 34. C 74.B 35. C 75.D 36. C 76.B 37. A 77.C 38. D 78.D 39. C 79.C 40. A 80.C

Page 229: Tips and Tricks for HP-UX Certificationdbmanagement.info/Books/MIX/HP_unix_book_for_certification_hp_unix...• Pass the HP-UX System Administration Exam. Tips and Tricks for HP -UX

Feedback is Welcome!

Your Feedback is a necessary and valuable part of our program. If you have any comments about:• The program itself• Presenters• Presentation Materials• Additional Topic Suggestions

Please send an email message to:

[email protected]

This mailbox is monitored by the program manager only and all feedback is given anonymously.

Please include the Please include the topic name and topic name and

date you attendeddate you attended