100% found this document useful (1 vote)
547 views96 pages

IBM AIX.7.1 AN10 Basics Exercises Guide

IBM AIX.7.1 AN10 Basics Exercises Guide

Uploaded by

emcvilt
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
100% found this document useful (1 vote)
547 views96 pages

IBM AIX.7.1 AN10 Basics Exercises Guide

IBM AIX.7.1 AN10 Basics Exercises Guide

Uploaded by

emcvilt
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 96

Business Data

Cloud Mobility
Intelligence Centre

Enterprise Computing Solutions

Student Manual

Dirección General de Formación

CONSEJERÍA DE EMPLEO,
TURISMO Y CULTURA

Comunidad de Madrid UNIÓN EUROPEA


FONDO SOCIAL EUROPEO
El Fondo Social Europeo invierte en tu futuro

EDUCATION
S E R V I C E S
V8.1

cover

Front cover

.I. n
AIX Basics

.T ció
(Course code AN10)

.
Student Exercises

C
.F a
ERC 3.0

C rm
to fo
ec vo
oy si
u
cl
Ex
pr
Student Exercises

Trademarks
IBM, the IBM logo, and ibm.com are trademarks or registered trademarks of International
Business Machines Corp., registered in many jurisdictions worldwide.
The following are trademarks of International Business Machines Corporation, registered in
many jurisdictions worldwide:
AIX 5L™ AIX 6™ AIX®

.I. n
AS/400® Initiate® MVS™
Power® System p® 400®

.T ció
Adobe is either a registered trademark or a trademark of Adobe Systems Incorporated in
the United States, and/or other countries.

.
Intel is a trademark or registered trademark of Intel Corporation or its subsidiaries in the

C
.F a
United States and other countries.
Linux is a registered trademark of Linus Torvalds in the United States, other countries, or

C rm
both.
Windows is a trademark of Microsoft Corporation in the United States, other countries, or
both.
to fo
UNIX is a registered trademark of The Open Group in the United States and other
countries.
Java™ and all Java-based trademarks and logos are trademarks or registered trademarks
of Oracle and/or its affiliates.
ec vo

Other product and service names might be trademarks of IBM or other companies.
oy si
u
cl
Ex

June 2013 edition


pr

The information contained in this document has not been submitted to any formal IBM test and is distributed on an “as is” basis without
any warranty either express or implied. The use of this information or the implementation of any of these techniques is a customer
responsibility and depends on the customer’s ability to evaluate and integrate them into the customer’s operational environment. While
each item may have been reviewed by IBM for accuracy in a specific situation, there is no guarantee that the same or similar results will
result elsewhere. Customers attempting to adapt these techniques to their own environments do so at their own risk.

© Copyright International Business Machines Corporation 2010, 2013.


This document may not be reproduced in whole or in part without the prior written permission of IBM.
US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
V8.1
Student Exercises

TOC Contents
Trademarks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . vii

Exercises description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ix

Exercise 1. Using the system . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-1

.I. n
Exercise instructions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-2
Section 1: Logging in / Changing passwords . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-2

.T ció
Section 2: Basic commands . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-2
Section 3: Send and receive mail . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-2
Section 4: Communicating with other users . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-3

.
Section 5: Keyboard tips . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-3

C
.F a
Exercise 2. AIX documentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-1
Exercise instructions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-2

C rm
Section 1: man Pages . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-2
Section 2: AIX Information Center . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-2

Exercise 3. Files and directories . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-1


to fo
Exercise instructions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-2

Exercise 4. Using files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-1


Exercise instructions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-2
ec vo

Section 1: Checking your environment . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-2


Section 2: Working with files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-2
Section 3: Creating and manipulating directories . . . . . . . . . . . . . . . . . . . . . . . . . . 4-2
Section 4: Remove a directory . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-3
oy si

Optional exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-4

Exercise 5. File permissions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-1


u

Exercise instructions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-2


Section 1: Listing information on files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-2
cl

Section 2: Working with file permissions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-3


Section 3: Working with directory permissions . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-3
Ex

Exercise 6. vi editor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-1


Exercise instructions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-2
Section 1: Creating a file . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-2
Section 2: Cursor movement keys . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-2
pr

Section 3: Using set to customize the editing session . . . . . . . . . . . . . . . . . . . . . . 6-4


Section 4: Command line editing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-4

Exercise 7. Shell basics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-1


Exercise instructions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-2
Section 1: Wildcards . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-2

© Copyright IBM Corp. 2010, 2013 Contents iii


Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
Student Exercises

Section 2: Redirection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-2


Section 3: Pipes, tees, and filters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-2
Section 4: Command grouping and line continuation . . . . . . . . . . . . . . . . . . . . . . 7-3

Exercise 8. Using shell variables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .8-1


Exercise instructions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8-2
Section 1: Variable substitution . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8-2
Section 2: Command substitution . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8-2

.I. n
Section 3: Quoting . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8-3

.T ció
Exercise 9. Controlling processes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .9-1
Exercise instructions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9-2
Section 1: Structure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9-2

.
Section 2: Process environment . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9-2

C
Section 3: Job control . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9-3

.F a
Section 4: Terminating a process . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9-4

C rm
Exercise 10. Customizing the user environment . . . . . . . . . . . . . . . . . . . . . . . . . . .10-1
Exercise instructions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10-2
Section 1: Customizing .profile and .kshrc . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10-2
to fo
Exercise 11. AIX utilities (1) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .11-1
Exercise instructions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11-2
Section 1: The find command . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11-2
ec vo

Exercise 12. AIX utilities (2) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .12-1


Exercise instructions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12-2
Section 1: The grep command . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12-2
Section 2: The sort command . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12-2
oy si

Section 3: The head and tail commands . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12-2


Section 4: The tn, ftp and tar commands . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12-2
u

Exercise 13. AIX utilities (3) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .13-1


Exercise instructions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13-2
cl

Section 1: Using find, xargs, and file . . . . . . . . . . . . . . . 13-2

Exercise 14. AIX utilities (4) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .14-1


Ex

Exercise instructions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14-2


Section 1: Using diff, cmp, dircmp . . . . . . . . . . . . . . . . . 14-2
Section 2: Using compress, uncompress, zcat . . . . . . . . . . . . 14-2
Section 3: Displaying non-printable characters . . . . . . . . . . . . . . . . . . . . . . . . . . 14-2
pr

Exercise 15. Additional shell features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .15-1


Exercise instructions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15-2
Section 1: Writing shell scripts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15-2
Section 2: Using for, test, and if . . . . . . . . . . . . . . . . . 15-2
Section 3: Using while and expr . . . . . . . . . . . . . . . . . . 15-3

iv AIX Basics © Copyright IBM Corp. 2010, 2013


Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
V8.1
Student Exercises

TOC Exercise 16. Using AIXwindows . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16-1


Exercise instructions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16-2
Section 1: Starting AIXWindows . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16-2
Section 2: Working with Windows . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16-2
Section 3: Using the root window . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16-3
Section 4: Cut and paste functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16-3
Section 5: Command line options for aixterm (Optional) . . . . . . . . . . . . . . . . . . 16-3
Section 6: The Client-Server model (Optional) . . . . . . . . . . . . . . . . . . . . . . . . . . . 16-4

.I. n
Exercise 17. Using the Common Desktop Environment . . . . . . . . . . . . . . . . . . . . 17-1

.T ció
Exercise Instructions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17-2
Section 1: Exploring the front panel . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17-2
Section 2: Work with the Help Manager . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17-3

.
Section 3: Starting a terminal window . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17-3

C
Section 4: Working with the File Manager . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17-3

.F a
Section 5: Drag and Drop Operations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17-4
Section 6: File Manager: Finding, copying and deleting files . . . . . . . . . . . . . . . . 17-5

C rm
Section 7: Optional Exercise Steps . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17-5

Appendix A. Customizing AIXwindows (1) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . A-1


Exercise instructions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . A-2
to fo
Section 1: Customizing the .xinitrc file . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . A-2
Section 2: Customizing the .Xdefaults file . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . A-2

Appendix B. Customizing AIXwindows (2) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . B-1


ec vo

Exercise instructions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . B-2


Section 1: Using the Custom tool: Color and fonts . . . . . . . . . . . . . . . . . . . . . . . . B-2
Section 2: Customizing the root window with the xsetroot command . . . . . . . . B-3
Optional exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . B-4
oy si

Section 3: Using the Custom Tool: Size and Location, Icons and Scrollbar . . . . B-4
Section 4: Customizing the Motif Window Manager (MWM) . . . . . . . . . . . . . . . . B-4
u

Appendix C. Customizing CDE . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . C-1


Exercise instructions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . C-2
cl

Section 1: Customizing the front panel . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . C-2


Section 2: Adding a new control to the front panel . . . . . . . . . . . . . . . . . . . . . . . . C-3
Ex
pr

© Copyright IBM Corp. 2010, 2013 Contents v


Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
Student Exercises

.I. n
.T ció
.
C
.F a
C rm
to fo
ec vo
oy si
u
cl
Ex
pr

vi AIX Basics © Copyright IBM Corp. 2010, 2013


Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
V8.1
Student Exercises

TMK Trademarks
The reader should recognize that the following terms, which appear in the content of this
training document, are official trademarks of IBM or other companies:
IBM, the IBM logo, and ibm.com are trademarks or registered trademarks of International
Business Machines Corp., registered in many jurisdictions worldwide.

.I. n
The following are trademarks of International Business Machines Corporation, registered in
many jurisdictions worldwide:

.T ció
AIX 5L™ AIX 6™ AIX®
AS/400® Initiate® MVS™

.
Power® System p® 400®

C
.F a
Adobe is either a registered trademark or a trademark of Adobe Systems Incorporated in
the United States, and/or other countries.

C rm
Intel is a trademark or registered trademark of Intel Corporation or its subsidiaries in the
United States and other countries.
Linux is a registered trademark of Linus Torvalds in the United States, other countries, or
to fo
both.
Windows is a trademark of Microsoft Corporation in the United States, other countries, or
both.
ec vo

UNIX is a registered trademark of The Open Group in the United States and other
countries.
Java™ and all Java-based trademarks and logos are trademarks or registered trademarks
of Oracle and/or its affiliates.
oy si

Other product and service names might be trademarks of IBM or other companies.
u
cl
Ex
pr

© Copyright IBM Corp. 2010, 2013 Trademarks vii


Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
Student Exercises

.I. n
.T ció
.
C
.F a
C rm
to fo
ec vo
oy si
u
cl
Ex
pr

viii AIX Basics © Copyright IBM Corp. 2010, 2013


Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
V8.1
Student Exercises

pref Exercises description


None of the exercises, except Exercises 4 and 5 are dependent on the
preceding exercise being successfully completed. It is assumed,
however, that you understand the commands and concepts from each
exercise as these commands and concepts are carried over to the

.I. n
follow-on exercises.
Each exercise in this course is divided into sections as described

.T ció
below. Select the section that best fits your method of performing
exercises. You can select to use a combination of these sections as
appropriate.

.
C
Exercise Instructions – This section contains what it is you are to

.F a
accomplish. There are no definitive details on how to perform the
tasks. You are given the opportunity to work through the exercise

C rm
given what you learned in the unit presentation, utilizing the unit
Student Notebook, your past experience, and maybe a little intuition.
Exercise Instructions with Hints – This section is an exact duplicate
of the Exercise Instructions section except that in addition, specific
to fo
details and hints are provided to help step you through the exercise.
Using the Exercise Instructions section along with the Exercise
Instructions with Hints section can make for a rewarding
combination providing you with no hints when you do not want them
ec vo

and hints when you need them. When there is more than one way to
do a command, we show you both ways with an -OR- between
possible solutions.
oy si

Optional Exercises – This section provides additional practice on a


particular topic. Specific details and hints are provided to help step you
u

through the Optional Exercises, if needed. Not all exercises include


Optional Exercises.
cl

Solutions – This section provides at least one solution to questions


strategically placed in some exercises. Where applicable, the solutions
have been provided at the end of the Exercise Instructions with
Ex

Hints section. Note: These are NOT the solutions to the exercises as
those are provided in the Exercise Instructions with Hints.
pr

© Copyright IBM Corp. 2010, 2013 Exercises description ix


Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
Student Exercises

.I. n
.T ció
.
C
.F a
C rm
to fo
ec vo
oy si
u
cl
Ex
pr

x AIX Basics © Copyright IBM Corp. 2010, 2013


Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
V8.1
Student Exercises

EXempty Exercise 1. Using the system

What this exercise is about


The purpose of this exercise is to become familiar with AIX command
syntax and basic commands.

.I. n
What you should be able to do

.T ció
After completing this exercise, students should be able to:

.
• Log in to an AIX system and change passwords

C
.F a
• Execute basic commands
• Use the wall and write commands to communicate with other

C rm
users
• Use keyboard control keys to control command line output
to fo
Introduction
When executing commands on the command line, use the Enter key
on the graphics keyboard not the Ctrl/Act key. If using an ASCII
ec vo

keyboard, use the Return key not the Send key. Use of the Ctrl/Act
or Send keys can cause unpredictable results. When correcting a
typographical error on the command line, use the Backspace key not
the arrow keys.
oy si
u
cl
Ex
pr

© Copyright IBM Corp. 2010, 2013 Exercise 1. Using the system 1-1
Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
Student Exercises

Exercise instructions
Preface
• All exercises for this unit depend on the availability of specific equipment in your
classroom.

Section 1: Logging in / Changing passwords

.I. n
__ 1. Log in to the system with the user name and password provided by your instructor. It

.T ció
should be a user name such as teamxx where xx is a double digit number like 01,
02 and so forth.
The very first time you log in with your new user name, you will be prompted to

.
change your password. Keep the password the same as your login name. The

C
.F a
passwords you supply on the command line will not be displayed.
__ 2. Verify that the password has been set by logging out and back in.

C rm
Section 2: Basic commands
__ 3. Display the system's date.
to fo
__ 4. Display the whole calendar for the year 2007.
__ 5. Display the month of September for the year 1752. Notice anything peculiar about
September? __________
ec vo

__ 6. Display the month of January for the years 1999 and 99. Are 1999 and 99 the
oy si

same? __________
u
cl

__ 7. There are two commands that will display information about all users currently on
the local system. Display who is currently logged in on your system. Check to see
when they logged in.
Ex

__ 8. Display just your login name.


__ 9. Use banner to display Out to Lunch.
__ 10. Use the echo command to write the character string Out to Lunch to your display.
pr

__ 11. Use the clear command to clear your screen.

Section 3: Send and receive mail


__ 12. Send a note to yourself using the mail command. Provide a subject but ignore the
carbon copy prompt.

1-2 AIX Basics © Copyright IBM Corp. 2010, 2013


Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
V8.1
Student Exercises

EXempty __ 13. Start the mail process and list the message in your mailbox. Read your message,
save it, and quit the mail program. To list a brief summary of mail subcommands,
type ? at the mail prompt.
__ 14. Access your mail and delete the message you saved in your personal mailbox. Exit
the mail program. If there is more than one person logged in on your system,
practice sending mail to each other.

.I. n
Section 4: Communicating with other users

.T ció
__ 15. Send a note to all users on the system indicating that you have almost completed
this exercise.
__ 16. Pair up with someone on your system to coordinate this exercise. Open a line of

.
communication to send a message to your partner, teamyy. Let teamyy know that

C
.F a
you are waiting for a response. teamyy should then reply and let you know that they
have nothing else to say. End of conversation.

C rm
Section 5: Keyboard tips
To get some practice temporarily stopping, starting, and terminating the scrolling of
command output, use the banner command to banner the letters of the alphabet in order to
to fo
generate multiple lines of output.
__ 17. Using banner, display the alphabet separating each character with a space. As
output is scrolling to your display, temporarily stop the output. Resume the scrolling.
ec vo

(You can use the command ping localhost to generate long output if the banner
command is too quick.)
__ 18. Repeat the banner command used in the previous step, typing only the first five
letters of the alphabet, but DO NOT press Enter. Erase your input using <Ctrl-u>.
oy si

Now have the banner command display the phrase End of Exercise. This time if
you make a typing mistake while keying this command, use the Backspace key to
u

correct the command line.


__ 19. Log off the system.
cl
Ex

End of exercise
pr

© Copyright IBM Corp. 2010, 2013 Exercise 1. Using the system 1-3
Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
Student Exercises

.I. n
.T ció
.
C
.F a
C rm
to fo
ec vo
oy si
u
cl
Ex
pr

1-4 AIX Basics © Copyright IBM Corp. 2010, 2013


Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
V8.1
Student Exercises

EXempty Exercise 2. AIX documentation

What this exercise is about


The purpose of this exercise is to give the students the opportunity to
explore and experiment with the man command and with the AIX online

.I. n
documentation center.

.T ció
What you should be able to do
After completing this exercise, students should be able to:

.
C
• Execute the man command

.F a
• Start a Web browser to access the online documentation

C rm
Introduction
In this exercise, you will first use the man command from the command
to fo
line. This part of the exercise can be performed in either graphics
mode or ASCII mode.
In the second part of the exercise, you will use a Web browser to
access AIX online documentation.
ec vo
oy si
u
cl
Ex
pr

© Copyright IBM Corp. 2010, 2013 Exercise 2. AIX documentation 2-1


Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
Student Exercises

Exercise instructions
Preface
• All exercises for this unit depend on the availability of specific equipment in your
classroom.

Section 1: man Pages

.I. n
__ 1. Log in to the system with the user name and password provided by your instructor.

.T ció
__ 2. Bring up the man pages for the man command. Read the text that follows to obtain a
better understanding of the functionality of the man command.

.
Remember to use the Space bar to go forward one screen and the Return key to go

C
forward one line. Press the b key to go back one screen. When you have read

.F a
enough, exit man using the q key or <Ctrl-c>.

C rm
__ 3. Using the man command, search on the keyword calendar. From the list produced,
find the command that displays a calendar.
__ 4. Having found the cal command from the previous step, use man without any options
to obtain the correct syntax of the command.
to fo
Section 2: AIX Information Center
__ 5. Start up a Web browser and access the online documentation. Your instructor will
ec vo

tell you whether to use the Internet site or a local AIX system configured as a
documentation server.
The URL for the Internet site is:
http://publib.boulder.ibm.com/infocenter/aix/v7r1/index.jsp
oy si

__ 6. Click the + next to AIX 7.1 Information link in the left frame.
__ 7. Select one or two of the topics displayed in the left frame under AIX 7.1
u

Information link.
cl

__ 8. Now, suppose you do not know what document to look in for the information you
require. Use the search function in the Information Center to find information on the
wc command.
Ex

__ 9. Use the Search Scope function to narrow your search. Change the search scope
for the previous search to only include the Commands Reference.
__ 10. Use any extra time you have to explore other documents available in the AIX
pr

Information Center.
__ 11. Exit your Web browser.

2-2 AIX Basics © Copyright IBM Corp. 2010, 2013


Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
V8.1
Student Exercises

EXempty

End of exercise

.I. n
.T ció
.
C
.F a
C rm
to fo
ec vo
oy si
u
cl
Ex
pr

© Copyright IBM Corp. 2010, 2013 Exercise 2. AIX documentation 2-3


Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
Student Exercises

.I. n
.T ció
.
C
.F a
C rm
to fo
ec vo
oy si
u
cl
Ex
pr

2-4 AIX Basics © Copyright IBM Corp. 2010, 2013


Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
V8.1
Student Exercises

EXempty Exercise 3. Files and directories

What this exercise is about


This exercise provides the students with the opportunity to begin
working with directories and the files they contain.

.I. n
What you should be able to do

.T ció
After completing this exercise, you should be able to:

.
• Display the name of the current directory

C
.F a
• Change directories
• Use various options of the ls command to display information

C rm
about files and directories
• Create and remove directories
• Create zero-length files
to fo
Introduction
In this exercise, you will be using AIX commands to work with
ec vo

directories and files.


oy si
u
cl
Ex
pr

© Copyright IBM Corp. 2010, 2013 Exercise 3. Files and directories 3-1
Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
Student Exercises

Exercise instructions
Preface
• All exercises for this unit depend on the availability of specific equipment in your
classroom.
__ 1. If you are not already logged in, log in to the system

.I. n
__ 2. Using the pwd command, verify that you are in your home directory, /home/teamxx,
the directory where you are placed when you first log in.

.T ció
__ 3. Change your current directory to the root directory (/).
__ 4. Verify that you are in the root directory and then execute both a simple and a long

.
listing of the files in that directory.

C
.F a
__ 5. Issue the ls command with the -a and the -R options. What is the effect of each
option?_______________ (Note: The ls -R will provide extensive output. Once you

C rm
have seen enough, enter the key sequence <Ctrl-c> to end the command.)
to fo
__ 6. Return to your home directory (/home/teamxx) and list its contents including hidden
files.
__ 7. Create a directory in your home directory called mydir. Then, issue commands to
ec vo

view a long listing of both your /home/teamxx/mydir and /home/teamxx


directories. What are the sizes of each directory?________________________
__ 8. Change to the /home/teamxx/mydir directory. Use the touch command to create
two zero-length files called myfile1 and myfile2 in your mydir directory.
oy si

__ 9. Issue the command to view a long listing of the contents of your mydir directory.
What are the sizes of myfile1 and myfile2?__________________ View the long
u

listing again, this time also displaying the i-node numbers of the files. What are the
i-node numbers for the files? _____________________
cl

__ 10. Change back to your home directory and issue the ls -R command to view your
directory tree.
Ex

__ 11. Use the istat command to view i-node information on your mydir directory.
Why might the Last Accessed date be more current than the other two dates?
__ 12. Use the rmdir command to remove the mydir directory. Does it work?
pr

____________________ You will note that the rmdir command cannot remove a
non-empty directory. To do that, you will need to issue a command that we will learn
in the next unit, rm -r.

3-2 AIX Basics © Copyright IBM Corp. 2010, 2013


Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
V8.1
Student Exercises

EXempty

End of exercise

.I. n
.T ció
.
C
.F a
C rm
to fo
ec vo
oy si
u
cl
Ex
pr

© Copyright IBM Corp. 2010, 2013 Exercise 3. Files and directories 3-3
Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
Student Exercises

.I. n
.T ció
.
C
.F a
C rm
to fo
ec vo
oy si
u
cl
Ex
pr

3-4 AIX Basics © Copyright IBM Corp. 2010, 2013


Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
V8.1
Student Exercises

EXempty Exercise 4. Using files

What this exercise is about


In this exercise, students use a number of AIX commands to
manipulate files.

.I. n
What you should be able to do

.T ció
After completing this exercise, a student should be able to:

.
• Copy, move, rename, link, and remove files

C
.F a
• Display the contents of a file
• Print a file

C rm
Introduction
In this exercise, you will be using AIX commands to manipulate
to fo
ordinary files and directories using the commands discussed in
lecture.
ec vo
oy si
u
cl
Ex
pr

© Copyright IBM Corp. 2010, 2013 Exercise 4. Using files 4-1


Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
Student Exercises

Exercise instructions
Preface
• All exercises for this unit depend on the availability of specific equipment in your
classroom.

Section 1: Checking your environment

.I. n
__ 1. If not already logged in, log in to the system.

.T ció
__ 2. Using pwd, verify that you are in your home directory, /home/teamxx, the directory
where you are placed when you first log in.

.
__ 3. List the contents of your home directory (/home/teamxx), including hidden files.

C
.F a
Section 2: Working with files

C rm
__ 4. Look at the contents of the /etc/hosts and /etc/profile files. Use the commands
cat, pg, and more to see how each command handles the output.
__ 5. Copy the file /usr/bin/cat into your current (home) directory.
to fo
__ 6. Copy the file /usr/bin/cal into your current (home) directory.
__ 7. List the files in your current directory. You should see the two you just copied.

Section 3: Creating and manipulating directories


ec vo

__ 8. Create a subdirectory in your home directory called myscripts.


__ 9. Move and rename the two files that you just copied to your home directory (cat and
cal) into your new subdirectory. Name the new files mycat and mycal respectively.
oy si

__ 10. Make the new subdirectory, myscripts, your current directory.


__ 11. List the contents of the directory to make sure that the files were copied.
u

__ 12. Use the mycat command in your myscripts directory to look at the contents of
cl

the .profile file in your home directory.


__ 13. Make your home directory the current directory.
Ex

__ 14. Create another subdirectory in your home directory called goodstuff.


__ 15. Copy a file called /etc/profile into the new directory, and name the new file
newprofile.
pr

__ 16. Use the cat command to look at the file. Hard to read? Try the pg command.
__ 17. The filename, newprofile, is too long to keep typing. Change its name to np. List
the contents of the goodstuff directory to make sure that you have accomplished
the task. Use the cat command to type out the renamed file.

4-2 AIX Basics © Copyright IBM Corp. 2010, 2013


Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
V8.1
Student Exercises

EXempty __ 18. This is a good point to check everything out. Starting from your home directory and
working downwards, display a hierarchical tree of your files and subdirectories.

Section 4: Remove a directory


__ 19. Ensure you are in your home directory. Remove the goodstuff directory. Could you
do it? Why or why not?

.I. n
__ 20. Change to the goodstuff directory. Do a listing on the contents of the goodstuff
directory including any hidden files. Remove the files. Do another listing on the

.T ció
goodstuff directory including the hidden files. Notice the . and .. files are still there.
The directory is considered empty if these are the only two entries left in it. Remove
the directory.

.
C
.F a
End of exercise

C rm
to fo
ec vo
oy si
u
cl
Ex
pr

© Copyright IBM Corp. 2010, 2013 Exercise 4. Using files 4-3


Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
Student Exercises

Optional exercises
__ 1. Using the mkdir command only once, create a directory under the myscripts
directory named sports that has three directories in it named tennis, basketball,
and baseball. Check to be sure the directories were created properly.
__ 2. Copy the file /etc/motd into the tennis directory and create two files in the
basketball directory. Leave the baseball directory empty. Check to be sure the files

.I. n
were created.

.T ció
__ 3. Use the rm command to remove the sports directory and everything in it.

.
C
End of optional exercises

.F a
C rm
to fo
ec vo
oy si
u
cl
Ex
pr

4-4 AIX Basics © Copyright IBM Corp. 2010, 2013


Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
V8.1
Student Exercises

EXempty Exercise 5. File permissions

What this exercise is about


The purpose of this exercise is to give the student the opportunity to
work with file and directory permissions. A fundamental understanding

.I. n
of basic AIX file ownership and permissions should be a result of
performing these exercises.

.T ció
What you should be able to do

.
After completing this exercise, students should be able to:

C
.F a
• Manipulate permissions on ordinary files and directories

C rm
• Interpret file and directory permission bits
• Display long listing information for files and directories

Introduction
to fo
In this exercise, you will be using AIX commands to manipulate AIX file
and directory permissions. Understanding the implications of file
permissions and ownership and using the commands to change file
ec vo

permissions is necessary to doing additional exercises in this course.

Tips
oy si

Make sure you are aware of what directory you are in while performing
u

the various steps. If you lose track of where you are in the exercise,
some instructions will appear not to work. Use pwd frequently to check
cl

your current directory.


Ex
pr

© Copyright IBM Corp. 2010, 2013 Exercise 5. File permissions 5-1


Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
Student Exercises

Exercise instructions
Preface
• All exercises for this unit depend on the availability of specific equipment in your
classroom.

Section 1: Listing information on files

.I. n
__ 1. Log in to the system. Change to the myscripts directory. Display a long listing of the

.T ció
files in the myscripts directory. Notice the owner and permissions for the files that
you copied in the previous exercise.
Record the permissions for mycat. __________________________

.
C
Record the permissions for mycal. __________________________

.F a
__ 2. Now, do a long list on the original cat and cal files in the /usr/bin directory and

C rm
compare the permissions to those in the myscripts directory. You own the copies
but not the originals.
__ 3. Change the modification time of mycal and mycat in the myscripts directory.
Check to see that the time actually changed. What is another use for the touch
to fo
command? _______________________
__ 4. Make it so you can reference the mycal file in the myscripts directory by the name
of home_mycal in your home directory. Compare the detailed file information for
both files.
ec vo

Is there any difference? ___________________


What is the link count? _________________
oy si

__ 5. Change the directory to your home directory. Execute home_mycal.


What does the output look like?
u

_______________________________________________________________
cl

Now, change permissions on the home_mycal file so that you, the owner of the file,
have read only permission. Try running the mycal command.
Ex

Can you do it? _________________


Why or why not? _________________
__ 6. Remove home_mycal. Did that remove myscripts/mycal? _________________
pr

Why or why not?


________________________________________________________________

5-2 AIX Basics © Copyright IBM Corp. 2010, 2013


Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
V8.1
Student Exercises

EXempty Section 2: Working with file permissions


__ 7. Change the directory to the myscripts directory. Using symbolic notation of the
chmod command, remove the read permission on the other permission bits from the
file mycat. Check the new permissions.
__ 8. Using octal notation, change the permissions on mycat so that the owner
permission bits are set to read-only permission with no permission for anyone else.

.I. n
Check the new permissions.
__ 9. Use the mycat command to display the contents of the .profile file. Did it work?

.T ció
What happened?
_______________________________________________________________

.
_______________________________________________________________

C
.F a
__ 10. Make your home directory the current directory. Check to see if you are in your
home directory.

C rm
Section 3: Working with directory permissions
__ 11. Alter the permissions on the myscripts directory so that you have read-only access
to fo
to it.
__ 12. Use a long list to check that you have set the permissions correctly.
__ 13. Try getting a simple list of the contents of the directory. Try a long list. Did they work?
ec vo

Why or why not?


________________________________________________________________
________________________________________________________________
oy si

__ 14. Try to execute mycal. Did it work?


Why or why not?
u

________________________________________________________________
cl

________________________________________________________________
__ 15. Try to remove mycal. Did it work?
Ex

Why or why not?


________________________________________________________________
________________________________________________________________
pr

__ 16. Return the permissions of myscripts back to its original form of rwxr-xr-x and then
remove mycal.
__ 17. As time permits, experiment with other permission combinations. When you are
through, make sure to change the permissions back to rwx for the owner.

© Copyright IBM Corp. 2010, 2013 Exercise 5. File permissions 5-3


Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
Student Exercises

End of exercise

.I. n
.T ció
.
C
.F a
C rm
to fo
ec vo
oy si
u
cl
Ex
pr

5-4 AIX Basics © Copyright IBM Corp. 2010, 2013


Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
V8.1
Student Exercises

EXempty Exercise 6. vi editor

What this exercise is about


The purpose of this exercise is to give the student the opportunity to
create and edit files using the most common UNIX editor, vi. A clear

.I. n
understanding of the vi editor is critical to successfully complete the
rest of the exercises in this course.

.T ció
What you should be able to do

.
After completing this exercise, students should be able to:

C
.F a
• Create a file
• Save and exit a file and exit without saving

C rm
• Manipulate a file using various cursor movement keys
• Add, delete, and make changes to text within a file
• Set options to customize the editing session
• Invoke command line editing
to fo
Introduction
The vi editor is based on software developed by the University of
ec vo

California at Berkeley, California, Computer Science Division. The vi


editor, pronounced “vee-eye” (short for visual), features commands to
create, change, append, or delete files. The following exercises will
familiarize you with some of the major features and functions of vi.
oy si

For your assistance, there is a vi Command Summary in the


Appendix of the Student Notebook.
u
cl
Ex
pr

© Copyright IBM Corp. 2010, 2013 Exercise 6. vi editor 6-1


Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
Student Exercises

Exercise instructions
Section 1: Creating a file
__ 1. Ensure that you are in your home directory. Create a file in your home directory
named vitest.
__ 2. When you open a vi file, you are automatically placed in command mode. Press the

.I. n
i key (insert) to switch to input (text) mode. You can also press the a key (append).
Use of i or a simply determines if typing starts before or after the cursor. There is no

.T ció
indication to tell you that you are in input mode.
Switch from input mode to command mode by pressing the ESC key. Press ESC a
second time. Notice that if you press ESC twice, you will get a “beep” from the

.
terminal (some ASCII terminals do not beep). The beep indicates that you are in

C
.F a
command mode already. Now press i again to put you back in input mode. Continue
to the next step.

C rm
__ 3. Input the following text exactly as it is presented line-by-line. Then key in the
alphabet, one character per line. Following will show a-d but continue on through z.
Adding the alphabet is an easy way to fill a couple of screens of information needed
for later use.
to fo
This is a training session about the usage of the vi editor. We need
some more lines to learn the most common commands of the editor. We are
ec vo

now in the entry mode and we will switch right after this to the
command mode.
a
b
oy si

c
d
...
u

z
cl

__ 4. Return to command mode. Write and quit the file. Notice that as soon as you press
the : (colon), it appears below the last line of your input area. Once the buffer is
Ex

empty and the file is closed, you will see a message giving the number of lines and
characters in the file.

Section 2: Cursor movement keys


pr

__ 5. Open vitest using vi. Notice the bottom line of the file indicates the name of the file
and number of characters.
__ 6. Using both the arrow keys and the h, j, k, l keys, practice moving the cursor down
one line, up one line, right a couple characters, and back a couple characters.

6-2 AIX Basics © Copyright IBM Corp. 2010, 2013


Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
V8.1
Student Exercises

EXempty __ 7. You might not want to cursor one character or one line at a time throughout an entire
file. Practice using cursor movement keys to work around by page or by line. Using
the cursor movement keys from the previous step, position your cursor at the first
line of the file. While in command mode, do the following:
i. Move forward one page.
ii. Move back one page.

.I. n
iii. Move cursor to last line in the file.
iv. Move cursor to first line in the file.

.T ció
v. Move cursor to line 4 of the file.
vi. Move cursor to end of line.

.
C
vii. Move cursor to beginning of line.

.F a
__ 8. Move your cursor to the top of the file. Search for the word entry. Your cursor
should be on the e. Switch to input mode and add the word “text”. Do not forget the

C rm
space after the word.
__ 9. Move the cursor to the space after the word mode on the same line. Insert a comma.
Remember, you are still in input mode.
to fo
__ 10. Enter command mode. Position the cursor anywhere on the line beginning with
“some more lines”. Insert a blank line below to form two paragraphs.
__ 11. Opening a blank line as in the previous step, automatically puts you in input mode;
ec vo

therefore, return to command mode. Now save the changes you have made so far,
but DO NOT exit the editor.
__ 12. While still in command mode, remove the alphabetic characters c, e, g but leave
the blank lines in their place; in other words, do not delete the entire line, just the
oy si

character. Then go back and remove the blank lines. This will give you practice
using two of the delete functions.
u

__ 13. Now replace the alphabetic character h with a z.


cl

__ 14. You just decided you really do not want to save the changes to the alphabetic
characters. Quit the editing session without saving the changes made since the last
save.
Ex

__ 15. Edit vitest one more time. First, copy the first paragraph (including the blank line)
one line at a time to the end of the file. When that is complete, copy the second
paragraph all at once to the end of the file.
pr

__ 16. You just decided that the lines you just added to the end of file do not look right.
Delete them all with one command.
__ 17. Now, before you do anything else with this file, you decide you need to embed the
current date and time as the first line of the file. Do this without leaving the vi editor.

© Copyright IBM Corp. 2010, 2013 Exercise 6. vi editor 6-3


Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
Student Exercises

Section 3: Using set to customize the editing session


__ 18. Options can be set temporarily in an editing session using the set command. Go
back to the top of your file. Ensure you are in command mode and set the following
commands:
a. Set automatic word wrap 15 spaces before the right margin.
b. Display the INPUT MODE message when in input mode.

.I. n
c. Turn line numbering on.

.T ció
__ 19. Test each of the options set in the previous instruction.
__ 20. Write the file and quit the editor.

.
Section 4: Command line editing

C
.F a
__ 21. Now that you are familiar with vi modes and commands, practice command line
editing. To set up your session to use command line editing, use the set -o vi

C rm
command.
__ 22. Now you can recall previously executed commands, edit them, and resubmit them.
Let us build a command history to work with. List (simple, not long) the contents of
to fo
the directory /usr. Display the contents of the file /etc/filesystems. Echo hello.
__ 23. Suppose you want to edit one of the commands you just executed. Press the ESC
key to get to vi command mode. Try pressing the k key several times to go up the
list of commands. Try j to go down. This recall of commands is essentially looking
ec vo

through a buffer of commands that you previously executed. The commands are
actually stored in your .sh_history file in your home directory.
__ 24. Retrieve the ls command. Use the l key to move your cursor to the / in /usr.
oy si

(Note: The arrow keys tend to wipe your line out. You have to use the l key for right
and h for left.) Use the i key to insert text and change this command to be a long list.
Execute it.
u

__ 25. Recall the cat command. This time list the contents of the /etc/passwd file.
cl

__ 26. Recall the cat command. Go to the end of the line (remember $). Add to the end of
the command to pipe the output to wc to count just the lines.
Ex

End of exercise
pr

6-4 AIX Basics © Copyright IBM Corp. 2010, 2013


Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
V8.1
Student Exercises

EXempty Exercise 7. Shell basics

What this exercise is about


This exercise will familiarize the students with basic shell operations.

.I. n
What you should be able to do

.T ció
After completing this exercise, students should be able to:
• Use wildcards for file name expansion

.
• Redirect standard in, standard out, and standard error

C
.F a
• Use pipes to provide the output of one process as input to another
process

C rm
• Perform command grouping and line continuation

Introduction
to fo
Understanding the use and manipulation of the shell is considered a
foundation for understanding AIX user interfaces. You will use
commands to experiment with the shell features discussed in the Shell
ec vo

Basics lecture.
oy si
u
cl
Ex
pr

© Copyright IBM Corp. 2010, 2013 Exercise 7. Shell basics 7-1


Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
Student Exercises

Exercise instructions
Section 1: Wildcards
__ 1. Type cd to get back to your home directory. (Your home directory is the one you use
when you log in.)
__ 2. Execute a simple ls to list the non-hidden files in your home directory. Now use the

.I. n
ls command with a wildcard character to list these files. What is the difference in
output of these two commands?

.T ció
________________________________________________________________
Why?

.
________________________________________________________________

C
.F a
__ 3. Change to the /usr/bin directory. List just those files starting with the letter a.
__ 4. List all two character file names.

C rm
__ 5. List all file names starting with the letters a, b, c, or d.
__ 6. List all files except those beginning with c through t. This will be a long list. You
might want to pipe the output to pg or more. Did you get any file names that you did
to fo
not expect? __________ If so, do you know why?

__ 7. Return to your home directory.


ec vo

Section 2: Redirection
__ 8. Using the cat command and redirection, create a file called junk containing a few
oy si

lines of text. Use <Ctrl-d> at the beginning of a new line when you have finished
entering text and want to return the shell $ prompt. List the file contents to verify
your update.
u

__ 9. Append more lines of text to the file you have created using the cat command and
cl

redirection. List the file contents to verify your update.


__ 10. Mail the file junk to yourself. Wait a minute and open your mail, delete it, and quit
Ex

the program.

Section 3: Pipes, tees, and filters


__ 11. Using the ls command, list the files in your current directory. Make a note of the
pr

number of files:
__ 12. List the files in your current directory, but this time redirect the output to the file
temp.
__ 13. Use the appropriate command to count the number of words in the temp file. Is this
the same count as in instruction 11? __________ If not, why not?

7-2 AIX Basics © Copyright IBM Corp. 2010, 2013


Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
V8.1
Student Exercises

EXempty ________________________________________________________________
Display the contents of temp. Remove the file.
__ 14. This time use a pipe to count the number of files in your current directory. Was the
result what you expected this time? __________ Is it the same as in instruction 11?
________________________________________________________________
__ 15. Use the command you created in instruction 14, but this time insert a tee in the

.I. n
middle trapping the result of the list in a file called junk2. Did you get the number
displayed on the screen? __________

.T ció
Check the contents of junk2 to make sure that it contains what you expected.
__ 16. List in reverse order the contents of your current directory. Send the results of the

.
reverse listing to a file named junk3, and to a program to count the number of words

C
.F a
in the reverse listing. Append the final count to junk3. Remember to use the append
version of redirection. In this particular case, you might get unexpected results if you

C rm
do not. It might not be a straight overwrite because the file is being used twice in the
same command. Experiment if you are curious.
__ 17. There is a special file in the /dev directory that represents your terminal. Display the
file name associated with your terminal. Output will be something like tty0, lft0, or
to fo
pts/x. Repeat the command from instruction 16 with two exceptions:
a. Rather than using junk3, tee the output to the special file that represents your
terminal (/dev/<your_terminal_name>).
ec vo

b. Do not append the results of the wc command to junk3. Have the count display
to your terminal.

Section 4: Command grouping and line continuation


oy si

__ 18. On the same command line, display the date, who is logged in, the name of your
current directory, and the names of the files in your current directory. Do these
u

commands have any relationship to each other?


cl

__ 19. The primary purpose of this exercise instruction is to use line continuation with a
command that is too long to fit on one command line. The secondary purpose is to
Ex

test what you have learned so far by letting you create an incredibly long command
string.
You can choose to break the line anywhere you feel comfortable, but do not type
pr

past the right edge of the screen. When completed, test your output by displaying
the contents of the files that were created. This should be one long command
connected by pipes and redirection.
a. Do a long listing of the files in your home directory including hidden files.

© Copyright IBM Corp. 2010, 2013 Exercise 7. Shell basics 7-3


Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
Student Exercises

b. Capture the output to a file named reverse.listing and send the same output to
a program that will count only the number of words.
c. Capture the number of words and place the number in 4 files named file1
through file4.
d. Finally, send the output to a program to count the number of lines captured in the
previous instruction and redirect that number to a file named file5.

.I. n
.T ció
End of exercise

.
C
.F a
C rm
to fo
ec vo
oy si
u
cl
Ex
pr

7-4 AIX Basics © Copyright IBM Corp. 2010, 2013


Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
V8.1
Student Exercises

EXempty Exercise 8. Using shell variables

What this exercise is about


The student will define and utilize variable and command substitution
to set the shell environment and utilize quoting to override the shell

.I. n
interpretation of metacharacters.

.T ció
What you should be able to do
After completing this exercise, students should be able to:

.
C
• List shell built-in variables

.F a
• Set up variable substitution to define or alter the environment

C rm
• Use command substitution to set variables equal to the output of a
command
• Use the three methods of quoting to allow metacharacters to be
used literally instead of interpreted
to fo
Introduction
ec vo

This exercise contains three sections: variable substitution, command


substitution, and quoting. Knowledge of the first two sections, variable
and command substitution, is required to perform the third section,
quoting.
oy si

Caution: Throughout this exercise, the single quotes and the back
quotes look very similar. The single quotes look like this ', and the
u

back quotes like this ‘. The back quote may look different on the
keyboard than it does as printed in this exercise.
cl
Ex
pr

© Copyright IBM Corp. 2010, 2013 Exercise 8. Using shell variables 8-1
Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
Student Exercises

Exercise instructions
Section 1: Variable substitution
__ 1. Display the shell built-in variables.
__ 2. Set a variable named lunch to pizza and a variable named dinner to ham. Display
the value of the variables using echo. Locate them in the list of variables.

.I. n
__ 3. Using the variables you just defined, display the message, Lunch today is pizza
and dinner is ham.

.T ció
__ 4. Using the variables you just defined, display the message, Lunch today is
hamburgers.

.
__ 5. Remove the value of both variables. Check to be sure they are no longer included in

C
your list of variables.

.F a
__ 6. Display the value of your primary and secondary prompt strings.

C rm
__ 7. Change the primary prompt string to "You Rang?". (Single quotes will also work)
Why is it necessary to use the quotes with "You Rang?"?
__ 8. Change your secondary prompt string to "What Else?". Test it with the ls command
to fo
using line continuation. End the command. Reset both prompt strings back to their
original values. Why are quotes needed around the > when resetting the PS2
variable? __________
__ 9. Check the value of the variable related to your home directory. Reset that variable to
ec vo

change your home directory to /bin. Use the cd and pwd commands to test the
effects of this change.
__ 10. Log out and log back in. What is your home directory? __________ Why?
oy si

________________________________________________________________
Note: If you are working in an aixterm session, after keying exit, press the right
u

mouse button and select New Window to get back to an aixterm session.
cl

Section 2: Command substitution


__ 11. Display your list of variables. Reissue the command but send the output to the wc
Ex

command to get the number of variables that are currently set.


__ 12. Using command substitution, echo the following:
There are # variables currently set
where # is the number of variables.
pr

__ 13. Each user ID configured on the system is represented by one line in the
/etc/passwd file. Applying your knowledge of command substitution, echo a
message that displays:
There are # users created on the system
where # is the number of line entries in /etc/passwd.

8-2 AIX Basics © Copyright IBM Corp. 2010, 2013


Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
V8.1
Student Exercises

EXempty Section 3: Quoting


__ 14. Using all three methods of quoting, banner the literal symbol *. Why do all three
work?
________________________________________________________________
__ 15. Ensure you are in your home directory. Create a directory in your home directory
named quoting.

.I. n
__ 16. Change to the quoting directory. Create a zero-length file in the quoting directory

.T ció
named filea. Create a variable named n set to the value of hello. Test what you
have done by displaying the contents of quoting and the value of n.
__ 17. From the quoting directory, execute the following five commands. Record the

.
output. Check the Solutions section for the expected output.

C
.F a
i. $ echo '* $n 'ls' $(ls)'

C rm
________________________________________________________
ii. $ echo "* $n 'ls' $(ls)"

________________________________________________________
to fo
iii. $ echo \* \$n \'ls\' \$\(ls\)

________________________________________________________
ec vo

iv. $ echo * $n 'ls' $(ls)

________________________________________________________
oy si

v. $ echo * $n ls

________________________________________________________
u
cl
Ex

End of exercise
pr

© Copyright IBM Corp. 2010, 2013 Exercise 8. Using shell variables 8-3
Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
Student Exercises

.I. n
.T ció
.
C
.F a
C rm
to fo
ec vo
oy si
u
cl
Ex
pr

8-4 AIX Basics © Copyright IBM Corp. 2010, 2013


Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
V8.1
Student Exercises

EXempty Exercise 9. Controlling processes

What this exercise is about


This exercise familiarizes the student with process manipulation and
process control.

.I. n
What you should be able to do

.T ció
After completing this exercise students should be able to:

.
• Monitor processes by using the ps or jobs command

C
.F a
• Control processes by using the kill or jobs command
• Display current process ID

C rm
Introduction
In this exercise, you will use commands to experiment with process
to fo
control to get a better understanding of your process environment. You
will identify the processes associated with your terminal session, work
with variables in parent and child processes and terminate processes
you have started.
ec vo
oy si
u
cl
Ex
pr

© Copyright IBM Corp. 2010, 2013 Exercise 9. Controlling processes 9-1


Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
Student Exercises

Exercise instructions
Preface
• All exercises for this unit depend on the availability of specific equipment in your
classroom.

Section 1: Structure

.I. n
__ 1. Log in to the system and display your current process ID(PID).

.T ció
__ 2. Create a subshell by entering ksh. What is the process ID of the subshell?
Is it different from your login process?

.
C
.F a
__ 3. Enter the command ls -lR / > outfile 2> errfile & and then execute the
command which displays all of your running processes. The ls command will

C rm
terminate when it finishes listing all the files in the directory tree.
__ 4. Terminate your child shell. What happens if you type exit from your login shell?
to fo
Section 2: Process environment
__ 5. Display all your variables that are in your current process environment.
ec vo

__ 6. Create a variable x and set its value to 10. Check the value of the variable. Again,
display all your current variables.
__ 7. Create a subshell with ksh. Check to see what value variable x holds in the subshell.
What is the value of x? __________ List the subshell current variables. Do you see
oy si

a listing for x? __________


__ 8. Return to your parent process. Set the value of variable x so that its value will be
u

inherited by your child processes. Verify this by creating a subshell and checking on
the value of variable x.
cl

__ 9. Change the value of x to 200 in the subshell. Check that the value was changed.
Ex

__ 10. Go back to the parent process. Check on the value of x in this environment. Was the
change in the subshell exported back to the parent?
__ 11. Create a shell script and name it sc1. It should read:
pwd; cd /; pwd
pr

__ 12. Make the file sc1 executable and run the program. What directory are you in now?

Why?

9-2 AIX Basics © Copyright IBM Corp. 2010, 2013


Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
V8.1
Student Exercises

EXempty __ 13. Create another shell script and name it sc2. Have it read:
var1=hello; var2=$LOGNAME; export var1 var2
__ 14. Make sc2 executable and run the program. When it is finished, examine the values
of the variables var1 and var2. What values do var1 and var2 have?

Why?

.I. n
.T ció
__ 15. Run the sc2 program again, this time by forcing it to run in the current shell. When it
is finished, check the values for var1 and var2. What values do var1 and var2 have
now?

.
Why?

C
.F a
C rm
Section 3: Job control
__ 16. Create a shell script and name it sc3. It should read:
sleep 120
to fo
ls -lR / > outfile 2> errfile &
Make it executable. Start the script with the command:
$ ./sc3 > outfile 2> errfile
ec vo

in the foreground.
__ 17. Suspend the job you just started.
__ 18. List all the jobs that you are running on the system and restart the above job in the
oy si

background.
__ 19. Bring the job back to the foreground.
u

__ 20. Once the command finishes executing, restart it again in the background, display
cl

the process ID, and log off.


__ 21. Log in. Check to see if the process is still running.
Ex

__ 22. Start the sc3 script with the nohup command, reference it using an explicit path and
put it in the background. Do not forget to redirect the output from sc3, note its
process ID and job number and then log off.
__ 23. Log in. Check to see if the process is still running.
pr

Hint

Search for its process ID.

© Copyright IBM Corp. 2010, 2013 Exercise 9. Controlling processes 9-3


Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
Student Exercises

__ 24. When the process is complete, display the file that contains your output. (Hint: If you
did not specify an output file, nohup will send the output to nohup.out.)
__ 25. Rerun the sc3 script you just created placing it into the background but not using the
nohup command. Note its process ID and job number. Apply the nohup to the
process ID of the background process sc3 and then log off. You must also apply the
nohup to the child process “sleep 120”.
Log back into the system and verify that the process is still running.

.I. n
Section 4: Terminating a process

.T ció
__ 26. Use the ls -lR / command we have been using to start a long running job in the
background. Note the process ID that is provided when you begin the background

.
process. __________

C
.F a
You can use sleep 120 instead of ls -lR if the ls command completes too quickly.
__ 27. If you did not record the process ID when you first started the command in the

C rm
background, how would you find it? __________

Once you know the process ID, kill the process. Check to be sure it was killed.
to fo
__ 28. Repeat instruction 26 above. Kill the process using the job number rather than the
process ID. Check to be sure the job was killed.
ec vo

End of exercise
oy si
u
cl
Ex
pr

9-4 AIX Basics © Copyright IBM Corp. 2010, 2013


Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
V8.1
Student Exercises

EXempty Exercise 10.Customizing the user environment

What this exercise is about


When users log in, they generally prefer their environment to be
customized to meet their specific needs. In this exercise, the student

.I. n
will customize their environment with some very useful functions that
are invoked every time they log in.

.T ció
What you should be able to do

.
After completing this exercise, students should be able to:

C
.F a
• Customize .profile and .kshrc files

C rm
• Set alias definitions

Introduction
to fo
Half way through the exercise, you will change your primary prompt
from a $ to the name of your current directory. This changed prompt
string will be reflected from that point on in the exercises. This will look
different from what you are used to seeing in previous exercises.
ec vo

If you are working in an X Windows session, when instructed to log


out, execute one of the following commands: $ su - or $ login.
oy si
u
cl
Ex
pr

© Copyright IBM Corp. 2010, 2013 Exercise 10. Customizing the user environment 10-1
Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
Student Exercises

Exercise instructions
Preface
• All exercises for this unit depend on the availability of specific equipment in your
classroom.

Section 1: Customizing .profile and .kshrc

.I. n
__ 1. To customize your environment and have it take effect every time you log in, you

.T ció
must incorporate the changes in a file that is read at login. Ensure you are in your
home directory. Edit your .profile file to add the following functions:
__ a. Change the primary prompt string to reflect the current directory.

.
C
__ b. Display a message at login which contains your login name and the time you

.F a
logged in.

C rm
__ c. Define an alias named dir that invokes the ls -l command.
__ d. Automatically set up the command line editing facility.
__ 2. Test your customization by re-executing your .profile. You can choose to log out
and back in, or simply rerun it using the dot notation. Once you have done that,
to fo
execute and answer the following:
__ a. Did your message display? _______
__ b. Is your prompt the name of your home directory? _______
ec vo

__ c. Change to the /etc directory. Did your prompt change? _____


__ d. Using dir do you get a long listing of your current directory? _____
oy si

__ e. Invoke dir using command line editing.


If you answered NO to any question, edit your .profile and fix it.
u

__ 3. Once you have your customized .profile setup and functioning, open a subshell.
Answer the following questions:
cl

__ a. Is your prompt the name of the current directory? _____


Ex

__ b. Does the value of the alias dir still work? _____


__ c. Can you invoke command line editing? _____
__ 4. Exit from the subshell and return to your home directory. Most settings, with the
exception of system variables, only apply to the current environment and are not
pr

passed to subshells (child processes). To pass alias or set customized settings


down to subshells, the ENV variable must be set in your .profile file along with the
existence of a customized .kshrc file.
Revise your .profile and create the appropriate .kshrc file to support the alias and
set customization you did in instruction 1.

10-2 AIX Basics © Copyright IBM Corp. 2010, 2013


Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
V8.1
Student Exercises

EXempty In the .profile file, remove the 'alias dir' and 'set -o vi' customizations. Add the
ENV variable assignment. Export both PS1 and ENV.
Add the alias and set customizations (you just removed from .profile) to .kshrc.
__ 5. Test your customization by re-executing your .profile file. Open a subshell and
answer the following questions:
__ a. Is your prompt the name of the current directory? _____

.I. n
__ b. Is the value of the alias dir still working? _____

.T ció
__ c. Can you invoke command line editing? _____
__ 6. Exit the subshell and return to your login shell. Display a listing of all currently set
alias names and locate the dir alias.

.
C
__ 7. Temporarily unalias dir without editing the .kshrc file. Then display the list of alias

.F a
settings again and ensure that it is no longer defined. Try executing dir.
__ 8. The dir alias is still in your .kshrc file but is not set. The unalias command

C rm
removed it from the list of current alias names. Invoke .kshrc to automatically add
dir back in the alias list. Execute dir.
to fo
End of exercise
ec vo
oy si
u
cl
Ex
pr

© Copyright IBM Corp. 2010, 2013 Exercise 10. Customizing the user environment 10-3
Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
Student Exercises

.I. n
.T ció
.
C
.F a
C rm
to fo
ec vo
oy si
u
cl
Ex
pr

10-4 AIX Basics © Copyright IBM Corp. 2010, 2013


Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
V8.1
Student Exercises

EXempty Exercise 11.AIX utilities (1)

What this exercise is about


The purpose of this exercise is to become familiar with some of the
most helpful data tools available with AIX.

.I. n
What you should be able to do

.T ció
After completing this exercise, students should be able to execute
recursive searches on directories for files that meet specific criteria.

.
C
.F a
Introduction

C rm
This exercise is designed to give you experience using the find
command.
Using the command line editing feature will be very helpful during this
to fo
exercise as some of the commands can get quite lengthy and will be
repeated in many instructions.
This exercise shows the $ prompt; however, unless you reset the PS1
variable from the prior exercise, you will see your current directory as
ec vo

your prompt.
oy si
u
cl
Ex
pr

© Copyright IBM Corp. 2010, 2013 Exercise 11. AIX utilities (1) 11-1
Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
Student Exercises

Exercise instructions
Preface
• All exercises for this unit depend on the availability of specific equipment in your
classroom.

Section 1: The find command

.I. n
__ 1. Find and display all the files in the /tmp directory.

.T ció
__ 2. Find all files in your home directory that begin with the letter s and have ls -l
automatically execute on each file name found as a result of the search operation.

.
__ 3. Repeat the search in the previous step, but interactively prompt the user to display

C
the long list on each file.

.F a
__ 4. Find all files starting from the /usr directory that are owned by the userid uucp.

C rm
Modify the command line to count the number of files owned by uucp. There might
be some directories that you do not have permission to read. This will cause a
permission denied message to be displayed. Redirect all error messages to a file
called errfile.
to fo
__ 5. Display the file errfile from the previous instruction to see if any errors messages
were encountered.
__ 6. To demonstrate that find recursively searches all directories and subdirectories
from the search path down, do the following:
ec vo

a. Ensure you are in your home directory.


b. Make a subdirectory called level1.
oy si

c. Create a zero-length file named letter1 in the subdirectory level1.


d. Change to the level1 subdirectory.
u

e. Make a subdirectory under level1 called level2.


cl

f. Create a zero-length file named letter2 in the subdirectory level2.


g. Change to your home directory.
Ex

h. From your home directory, issue the command to list all files starting with the letter l.
Record the names displayed.
pr

i. From your home directory, issue the command to find only files starting with the
letter l. Record the names displayed.

11-2 AIX Basics © Copyright IBM Corp. 2010, 2013


Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
V8.1
Student Exercises

EXempty

End of exercise

.I. n
.T ció
.
C
.F a
C rm
to fo
ec vo
oy si
u
cl
Ex
pr

© Copyright IBM Corp. 2010, 2013 Exercise 11. AIX utilities (1) 11-3
Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
Student Exercises

.I. n
.T ció
.
C
.F a
C rm
to fo
ec vo
oy si
u
cl
Ex
pr

11-4 AIX Basics © Copyright IBM Corp. 2010, 2013


Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
V8.1
Student Exercises

EXempty Exercise 12.AIX utilities (2)

What this exercise is about


The purpose of this exercise is to become familiar with some of the
most helpful data tools available with AIX.

.I. n
What you should be able to do

.T ció
After completing this exercise, students should be able to:

.
• Search text files for pattern matching

C
.F a
• Extract specific fields within a file
• Sort lines in a file

C rm
• Display the first or last few lines of a file
• Log in to a remote system
• Transfer files between systems
to fo
• Save and restore files using the tar command

Introduction
ec vo

This exercise is designed to give you experience using some AIX data
tools.
oy si
u
cl
Ex
pr

© Copyright IBM Corp. 2010, 2013 Exercise 12. AIX utilities (2) 12-1
Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
Student Exercises

Exercise instructions
Preface
• All exercises for this unit depend on the availability of specific equipment in your
classroom.

Section 1: The grep command

.I. n
__ 1. Find all lines in the /etc/passwd file for user names that start with team.

.T ció
__ 2. Find all lines in the /etc/passwd file that begin with the letter t.
__ 3. Find all lines in /etc/passwd that contain a digit 0-9.

.
__ 4. Repeat the search in the previous instruction, but this time display only the number

C
.F a
of lines that contain the pattern.
__ 5. Use the ps and grep commands to display the processes initiated by users other

C rm
than yourself, and pipe the output to the more command.

Section 2: The sort command


to fo
__ 6. Display the content of the /etc/passwd file in alphabetic order. Next, display the
contents of the file in reverse order.

Section 3: The head and tail commands


ec vo

__ 7. Display the first 10 lines of /etc/passwd.


__ 8. Display the first 5 lines of /etc/passwd.
__ 9. Display the last 10 lines of /etc/passwd.
oy si

__ 10. The tail command is also handy for stripping out header information from the
output of a command. First, list all processes currently running on your system.
u

Notice the headings. Next, display all processes running on your system excluding
the header information.
cl

Section 4: The tn, ftp and tar commands


Ex

__ 11. Log in to any remote system in your classroom. If you are not sure about the name
of the remote system ask your instructor. Use one of the teamxx user IDs that have
been supplied by your instructor.
__ 12. Execute the hostname command and verify that you really work on the remote
pr

system.
__ 13. Change to the /tmp directory and create a new file testfile1.
__ 14. Log out from the remote system.
__ 15. On your local system, create a new directory remote_files.

12-2 AIX Basics © Copyright IBM Corp. 2010, 2013


Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
V8.1
Student Exercises

EXempty __ 16. Transfer the remote file /tmp/testfile1 to your local system. The file should be stored
in the subdirectory remote_files.
__ 17. Verify that the file has been copied to your local system.
__ 18. Stay in the remote_files subdirectory and use the tar command to save all files in
this directory. Create an archive file /tmp/archive.tar and save all files relatively.
__ 19. Verify the content of the archive file.

.I. n
__ 20. Restore all files from your archive into the /tmp-directory.

.T ció
End of exercise

.
C
.F a
C rm
to fo
ec vo
oy si
u
cl
Ex
pr

© Copyright IBM Corp. 2010, 2013 Exercise 12. AIX utilities (2) 12-3
Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
Student Exercises

.I. n
.T ció
.
C
.F a
C rm
to fo
ec vo
oy si
u
cl
Ex
pr

12-4 AIX Basics © Copyright IBM Corp. 2010, 2013


Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
V8.1
Student Exercises

EXempty Exercise 13.AIX utilities (3)

What this exercise is about


This exercise allows you to experiment with additional helpful utilities
that can be used in the AIX environment.

.I. n
What you should be able to do

.T ció
After completing this exercise, students should be able to use find,
xargs, and file to manipulate files.

.
C
.F a
Introduction

C rm
You will be manipulating ordinary files and directories using
commands discussed in lecture. Where there is more than one way to
invoke a command, you will see an -OR- between the possible
solutions in the Exercise Instructions with Hints section.
to fo
ec vo
oy si
u
cl
Ex
pr

© Copyright IBM Corp. 2010, 2013 Exercise 13. AIX utilities (3) 13-1
Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
Student Exercises

Exercise instructions
Preface
• All exercises for this unit depend on the availability of specific equipment in your
classroom.

Section 1: Using find, xargs, and file

.I. n
__ 1. Verify that you are in your $HOME directory. Create a subdirectory called newdir.

.T ció
Change to this directory and create five empty files in this directory with the names
of 1, 2, 3, 4, and 5.
__ 2. Show a simple list of the contents of the newdir directory. Now, list the contents of

.
the newdir directory and pass the output to xargs to copy the files and rename

C
.F a
them with the prefix file so the resulting copied file's name is file1, and so forth.
Verify that the files were copied and the names assigned accordingly.

C rm
__ 3. Using find, xargs, and grep, display the names of the files under your home
directory which contain the string AIX.
__ 4. Find out in which directory the find command is located. Determine the type of file
to fo
(executable, ASCII, dir, and so on) of the find command.
__ 5. Using the find command to recursively list the file under your home directory,
determine the type of each file. This can be accomplished in two ways. You can first
create a file, named myfiles and then determine the file types of the files listed in
ec vo

myfiles. Alternatively, you can do the entire task in a pipe, thus eliminating the need
to create the file, myfiles.
oy si

End of exercise
u
cl
Ex
pr

13-2 AIX Basics © Copyright IBM Corp. 2010, 2013


Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
V8.1
Student Exercises

EXempty Exercise 14.AIX utilities (4)

What this exercise is about


This exercise allows you to experiment with additional helpful utilities
that can be used in the AIX environment.

.I. n
What you should be able to do

.T ció
After completing this exercise, students should be able to:

.
• Use diff, cmp, and dircmp to compare files and directories

C
.F a
• Use compress, zcat, and uncompress
• Use cat to display non-printable characters

C rm
Introduction
You will be manipulating ordinary files and directories using
to fo
commands discussed in lecture. Where there is more than one way to
invoke a command, you will see an -OR- between the possible
solutions in the Exercise Instructions with Hints section.
ec vo
oy si
u
cl
Ex
pr

© Copyright IBM Corp. 2010, 2013 Exercise 14. AIX utilities (4) 14-1
Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
Student Exercises

Exercise instructions
Preface
• All exercises for this unit depend on the availability of specific equipment in your
classroom.

Section 1: Using diff, cmp, dircmp

.I. n
__ 1. Create a file called list1. In list1, list the names of several people you know, one line

.T ció
per name. Copy list1 to a file called list2. Edit list2 and make the following
changes:
• Change the spelling of one of the names.

.
C
• Remove one of the names.

.F a
• Add a new name.

C rm
__ 2. Using diff, compare the contents of list1 and list2.
__ 3. Using cmp, compare the contents of list1 and list2. Then invoke a complete or long
comparison of the contents of both files.
to fo
__ 4. Using dircmp -d, compare your home directory with the home directory of another
user account on your system (teamyy).

Section 2: Using compress, uncompress, zcat


ec vo

__ 5. Copy the file /etc/magic to a file in your home directory named mymagic. Do a long
listing on mymagic and record the number of bytes in the file: ________
__ 6. Using the verbose option with compress, compress mymagic. Record the
oy si

percentage of compression, ______________, and the name of the compressed


file, __________________. Do a long listing on the file and record the number of
u

bytes. _____________ Compare the number to the number in the previous


instruction.
cl

__ 7. Using zcat, expand and view the contents of mymagic.Z. You might want to page it
as it is a large file.
Ex

__ 8. Using uncompress, restore the compressed file back to its original file. Invoke a long
listing and record the number of bytes. ____________ The number should be the
same as the number in Exercise 5, "Copy the file /etc/magic to a file in your home
directory named mymagic. Do a long listing on mymagic and record the number of
pr

bytes in the file: ________".

Section 3: Displaying non-printable characters


__ 9. In your home directory, create a file named invis and type a few lines that include
random tabs, spaces, Ctrl-G's, and so forth, between the words. Display the file.

14-2 AIX Basics © Copyright IBM Corp. 2010, 2013


Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
V8.1
Student Exercises

EXempty __ 10. Notice in the instruction above that when you displayed the contents of invis, it did
not look quite right. Display and locate all the non-printable characters to determine
where you used spaces, tabs, control characters, and so forth.
__ 11. Create a directory named invisdir but insert an accidental <Ctrl-g> somewhere in
the name.
__ 12. Invoke the following four commands. When asked to type in the invisdir name, do
NOT enter the <Ctrl-g> you originally included as part of the name.

.I. n
__ a. Invoke a listing of files and directories in your home directory (invisdir should be

.T ció
included as part of the output).
__ b. Try to invoke a long listing on the invisdir directory.

.
__ c. Try to remove the invisdir directory.

C
.F a
__ d. Repeat instruction a. above to see if there are any non-printable characters in
the invisdir directory name that made instructions 2 and 3 fail.

C rm
__ 13. Using a method of your choice, successfully remove the invisdir directory.
to fo
End of exercise
ec vo
oy si
u
cl
Ex
pr

© Copyright IBM Corp. 2010, 2013 Exercise 14. AIX utilities (4) 14-3
Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
Student Exercises

.I. n
.T ció
.
C
.F a
C rm
to fo
ec vo
oy si
u
cl
Ex
pr

14-4 AIX Basics © Copyright IBM Corp. 2010, 2013


Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
V8.1
Student Exercises

EXempty Exercise 15.Additional shell features

What this exercise is about


After you have been using AIX for a while, you will find certain
characteristics of your environment that you would like to customize

.I. n
along with some tasks that you execute regularly that you would like to
automate.

.T ció
This exercise will introduce you to some of the more common
constructs used to help you write shell scripts in order to customize
and automate your computing environment.

.
C
.F a
What you should be able to do

C rm
After completing this exercise, students should be able to:
• List common constructs used in writing shell scripts
• Create and execute simple shell scripts
to fo
Introduction
You need not have any programming experience to perform this
ec vo

exercise. Refer to the unit in the Student Notebook for help with the
syntax of constructs when creating the shell scripts in this exercise.
oy si
u
cl
Ex
pr

© Copyright IBM Corp. 2010, 2013 Exercise 15. Additional shell features 15-1
Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
Student Exercises

Exercise instructions
Preface
• All exercises for this unit depend on the availability of specific equipment in your
classroom.

Section 1: Writing shell scripts

.I. n
__ 1. Create a shell script named parameters that will echo the five lines that follow using

.T ció
predefined special variables set by the shell to fill in the blanks. Execute the script
using the positional parameters 10 100 1000.

.
The name of this shell script is ________.

C
The first parameter passed is number ____.

.F a
The second parameter passed is number ____.
The third parameter pass is number ____.

C rm
Altogether there were _____ parameters passed.
__ 2. Using conditional execution, create a shell script named checkfile that will check to
see if the file named parameters exists in your directory, and if it does, use a
command to show the contents of the file. Execute the script.
to fo
__ 3. Modify the checkfile script and change the name of the file from parameters to
noname (check to ensure that you do NOT have a file by this name in your current
directory). Also, using conditional execution, if the ls command was NOT
ec vo

successful, display the error message, The file was not found. Execute the
script. What else got displayed?
oy si

__ 4. Modify the checkfile script so that error messages from the ls command do not
appear on the screen. Execute the script.
u

__ 5. Modify the checkfile script to accept a single parameter from the command line as
input to the ls and cat commands. Execute the script twice, once using the file
cl

named parameters and again using the file named noname.

Section 2: Using for, test, and if


Ex

__ 6. Using the for loop, modify the checkfile script to accept multiple files as input from
the command line instead of just one. If the files are found, display all of them. If the
files are not found, display the error showing all file names that were not found. Look
in your directory and jot down a few valid file names that you can use as input.
pr

Execute the script using valid and invalid file names.


__ 7. Change the checkfile script to use an if statement and test command rather
than conditional execution to check if the ls command was successful. Execute the
script as you did in the previous step.

15-2 AIX Basics © Copyright IBM Corp. 2010, 2013


Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
V8.1
Student Exercises

EXempty
Hint

Return codes play a part in this script.

Section 3: Using while and expr

.I. n
__ 8. Create an endless while loop that will echo Out to Lunch every 5 seconds in a
script named lunch. Execute the script. When you have seen enough, break the

.T ció
loop.
__ 9. From the command line, display the results of multiplying 5 and 6.

.
__ 10. Now using expr, create a shell script named math to multiply any two numbers when

C
.F a
entered as input from the command line. Execute the script multiplying 5 times 6.
Experiment with any other two numbers.

C rm
End of exercise
to fo
ec vo
oy si
u
cl
Ex
pr

© Copyright IBM Corp. 2010, 2013 Exercise 15. Additional shell features 15-3
Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
Student Exercises

.I. n
.T ció
.
C
.F a
C rm
to fo
ec vo
oy si
u
cl
Ex
pr

15-4 AIX Basics © Copyright IBM Corp. 2010, 2013


Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
V8.1
Student Exercises

EXempty Exercise 16.Using AIXwindows

What this exercise is about


This exercise provides an opportunity to use AIXwindows.

.I. n
What you should be able to do

.T ció
At the end of the exercise, students should be able to:
• Start AIXwindows

.
• Manipulate screen windows using AIXwindows

C
.F a
• Open a new aixterm window
• Customize motif application on launch (optional)

C rm
• (Optional) Use the xhost command and DISPLAY environment
variable to execute an X Client on a remote system
to fo
Introduction
It will be necessary to perform this machine exercise through a VNC
session. Be sure to check with your instructor if you have any
ec vo

questions regarding the terminal you should use.


While in the AIXwindows environment, you might want to minimize or
close any windows not needed to prevent the terminal screen from
oy si

becoming too cluttered.


This exercise also includes an optional exercise. Verify with your
u

instructor that the machine setup will support the optional exercise.
cl
Ex
pr

© Copyright IBM Corp. 2010, 2013 Exercise 16. Using AIXwindows 16-1
Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
Student Exercises

Exercise instructions
Preface
• All exercises for this unit depend on the availability of specific equipment in your
classroom.

Section 1: Starting AIXWindows

.I. n
__ 1. Start your terminal emulator application, connect to the AIX system, and log in.

.T ció
__ 2. Before we can start the VNC server application, you will need to set a VNC
password for your remote session. Run the vncpasswd program, and when
prompted, enter a password. Set your password to the same as your username (for

.
example, if your userid was team01, set the password to team01).

C
.F a
__ 3. Start the VNC server application. Make note of the hostname/IP address and
session number for the VNC server that is started.

C rm
Hostname: ______________________________
IP Address: ______________________________
Session number: __________________________
to fo
__ 4. Switch back to your lab workstation or lab portal facility and launch a VNC viewer.
Enter in the IPaddress:session where appropriate, and the password. If all is
correct, a window should appear with the AIXWindows environment in it, running
ec vo

under your assigned userid.

Section 2: Working with Windows


oy si

__ 5. Verify that the aixterm is the active window.


__ 6. Using the aixterm, try typing some AIX commands such as ls, date, cal, and
u

whoami.
__ 7. Resize the width of the window.
cl

__ 8. Change the height and width of the window, simultaneously.


__ 9. Drag the aixterm from one side of the screen to the other.
Ex

__ 10. Use the options in the window menu to move and resize the window.
__ 11. View the window menu again. Why do you think some items may be grayed out?
pr

__ 12. Open the window menu on the aixterm, but now type the letter m rather than clicking
move. Note that this is another way to move a window.

16-2 AIX Basics © Copyright IBM Corp. 2010, 2013


Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
V8.1
Student Exercises

EXempty __ 13. The window menu also contains key sequence definitions (for example Alt+F7).
These key bindings are known as accelerators.
What happens when you try pressing the Alt+F7 key when the menu is posted?

What happens if you try a mnemonic when the menu is not posted?

.I. n
.T ció
__ 14. Iconify (minimize) the aixterm window. Once it is an icon, restore it back to the

.
screen.

C
__ 15. Maximize the aixterm window. What happens? Once it is maximized, resize the

.F a
window to a smaller size.

C rm
Section 3: Using the root window
to fo
__ 16. Use the root menu to open another aixterm window.
__ 17. Start another xclock from the root menu.
ec vo

Section 4: Cut and paste functions


__ 18. Within a window, use the vi editor to create a file called tempfile. Add a few lines of
text to this file, but do not exit.
oy si

__ 19. Within a second aixterm window, use the vi editor to create another file called
tempfile.new. Go into insert mode but do not add any text to this file at this time.
u

__ 20. Copy a few lines of text from tempfile in the first window to tempfile.new in the
second window. When you have completed this step, exit vi in both windows.
cl

__ 21. You have now completed this machine exercise. You can either try the optional
steps that follow, end AIXwindows or lock your terminal.
Ex

__ 22. When you are done with working on this AIXWindows exercise, whether at this point
or somewhere in the optional steps), be sure to go to the last step (Step 28) and
terminate the vncserver on your system.
pr

Section 5: Command line options for aixterm (Optional)


__ 23. The aixterm command has many command line options. View these options using
the aixterm -help command. You will need to pipe the output to pg or more as
there is a lot of information.

© Copyright IBM Corp. 2010, 2013 Exercise 16. Using AIXwindows 16-3
Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
Student Exercises

If a printer is available, you might want to print this information.


__ 24. Start an aixterm from the command line. Give the window the following
characteristics:
background color lightskyblue
foreground color forestgreen
font rom10.iso1

.I. n
title My Window

.T ció
full cursor
scrollbar

.
Why do you think this window is smaller than the others?

C
.F a
C rm
__ 25. Start an xclock from the command line within one of the windows. Give the clock
the following characteristics:
background color white
to fo
foreground color red
hands on the dial blue
second hand update every second
ec vo

Section 6: The Client-Server model (Optional)


__ 26. Use the xhost command to enable all other clients to access your X server.
oy si

You should see the message “Access control disabled, clients can
connect from any host”.
u

__ 27. Have another user (if possible, on a different server) try and start an aixterm and
display it to your AIXWindows session. They will need to change the value of their
cl

DISPLAY variable to the hostname and X server number (which is the same as the
VNC session number).
Ex

__ 28. In the new window that appeared, use the id command to verify that the window
was started from the other user. Check the value of the DISPLAY variable. It should
indicate the name of your host.
__ 29. From the remote system's window, execute the xcalc & command. From which
pr

system is the calculator being executed? You can verify this with the ps command.
When you have completed this step, close the remote system's window.
__ 30. You have now completed the optional machine exercise. Shut down the VNC
AIXWindows session from your original terminal emulator session.

16-4 AIX Basics © Copyright IBM Corp. 2010, 2013


Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
V8.1
Student Exercises

EXempty

End of exercise

.I. n
.T ció
.
C
.F a
C rm
to fo
ec vo
oy si
u
cl
Ex
pr

© Copyright IBM Corp. 2010, 2013 Exercise 16. Using AIXwindows 16-5
Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
Student Exercises

.I. n
.T ció
.
C
.F a
C rm
to fo
ec vo
oy si
u
cl
Ex
pr

16-6 AIX Basics © Copyright IBM Corp. 2010, 2013


Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
V8.1
Student Exercises

EXempty Exercise 17.Using the Common Desktop


Environment

What this exercise is about


This exercise introduces you to the features of CDE.

.I. n
.T ció
What you should be able to do
At the end of the exercise, students should be able to:

.
• Recognize the various CDE controls on the Front Panel

C
.F a
• Use the Help Manager

C rm
• Start both an aixterm and dtterm terminal window
• Use the File Manager to navigate the directory structure, create
new files (using the CDE text editor) and directories (folders), and
place a file icon in the workspace backdrop
to fo
• Optionally, use the Calendar control to view the calendar, set
appointments, and create reminders
ec vo

Introduction
This exercise is designed to provide an introduction to the features of
CDE. You will use the Help Manager to obtain information as needed.
oy si

Much of your work in this exercise will be with the File Manager, which
is one of the most useful CDE functions.
u

If time permits, an optional exercise is included on the CDE calendar


functions. Feel free to explore the other functions of CDE. In the next
cl

unit and exercise, you will learn to customize your CDE environment.
Ex
pr

© Copyright IBM Corp. 2010, 2013 Exercise 17. Using the Common Desktop Environment 17-1
Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
Student Exercises

Exercise Instructions
Preface
• All exercises for this unit depend on the availability of specific equipment in your
classroom.

Section 1: Exploring the front panel

.I. n
__ 1. Be sure that you have terminated the vncserver that was started for the Using

.T ció
AIXwindows exercise. The instructions for this were in the last step of that exercise.
__ 2. If you are logging in on a locally connected graphics terminal, then enter your user
information at the Login Manager panel.

.
C
If you are using VNC to create the CDE session, then connect to the AIX system

.F a
using the ASCII terminal application and log in with your userid. Rename the
existing xstartup file in the $HOME/.vnc directory to xstartup.bak.

C rm
__ 3. Ensure that your present working directory is your home directory. Start the VNC
server application. Make note of the hostname/IP address and session number for
the VNC server that is started.
to fo
Hostname: ______________________________
IP Address: ______________________________
Session number: __________________________
ec vo

__ 4. Switch back to your lab workstation or lab portal facility and launch a VNC viewer.
Enter in the IPaddress:session where appropriate, and the password. If all is
correct, a window should appear with the AIXWindows environment in it, running
oy si

under your assigned userid.


__ 5. The CDE environment, by default, launches the Application Manager and File
Manager. Close those two windows (we will restart them later).
u

__ 6. Locate the CDE Front Panel; you might need to scroll the Desktop window to find it
cl

at the bottom of the window. Find the following components of the CDE Front Panel
(do not click on them, just locate them):
Ex

Workspace Switch Buttons


Style Manager
File Manager
pr

Application Manager
Personal Application Manager
Clock, Calendar
Mail

17-2 AIX Basics © Copyright IBM Corp. 2010, 2013


Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
V8.1
Student Exercises

EXempty Trash Can


Exit Icon
Move Handles
Menu and Iconify Buttons
__ 7. Move the Front Panel to the top of the screen.

.I. n
__ 8. Iconify the Front Panel and then restore it.

.T ció
Section 2: Work with the Help Manager
__ 9. From the Help subpanel, note how options exist so that you can access AIX online
documentation. The Infocenter menu item will not work unless the Infocenter Facility

.
has been configured on the lab system and has connectivity to an Infocenter server.

C
.F a
When you have reviewed the various Help functions, close the Help windows.

C rm
Section 3: Starting a terminal window
__ 10. Start an aixterm terminal window.
Now you have a terminal window where commands can be entered.
to fo
__ 11. Run some command line commands.
__ 12. Start the Desktop Terminal dtterm, using the Personal Applications Front Panel
pop-up menu (the control that looks like a piece of paper and a pencil).
ec vo

The Personal Applications control is on the left side of the control panel, between
the File Manager and Mail controls.
__ 13. Run some command line commands.
oy si

__ 14. Compare the aixterm and the dtterm windows. What differences do you see?
__ 15. In the dtterm session, use the Edit menu bar option to copy and paste text.
u

__ 16. Now close all open windows, except the Front Panel, and we will work with the File
Manager.
cl

Section 4: Working with the File Manager


Ex

__ 17. Select the File Manager control from the Front Panel to access the File Manager.
__ 18. Make sure that you are in your Home Directory: called /home/teamxx. The current
directory is displayed at the top of the window.
pr

__ 19. View several of the files.


__ 20. So that you have a few items to work with, the first thing you will need to do is create
a few new files.
__ 21. Click one of your new files and then click Selected in the menu bar. Click Open to
edit the file. This will invoke the CDE Text Editor.

© Copyright IBM Corp. 2010, 2013 Exercise 17. Using the Common Desktop Environment 17-3
Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
Student Exercises

__ 22. Enter several lines of text in each file. Play with using the mouse pointer and/or
cursor control keys to place your cursor in various locations in the text. Play with
changing the text, using the insert and delete keyboard functions. You will notice that
the CDE Text Editor is not the vi editor.
Content is immaterial, but for at least one of the files, create a small shell script.
When you have finished editing a file, save the file by clicking the File option in the
menu bar, then selecting Close. Confirm that you want to save the file when that

.I. n
window is presented.

.T ció
__ 23. Add execute permission to the shell script you just created. Once this is complete,
execute the shell script.
__ 24. To execute the Shell Script, be sure its icon shows as a lightening bolt. Double-click

.
the Shell Script icon. On the Action:Run window, click OK. A window will appear

C
.F a
showing the results of the Shell Script. Once you have reviewed the results, close
the Run window.

C rm
Now you have a number of files that you can use in some drag and drop operations.

Section 5: Drag and Drop Operations


to fo
You will need to be working with the files in your Home directory, so these should be
displayed in the File Manager window.
If you are not at the correct directory, navigate up and down the structure until you get to
where you want/ought/need to be.
ec vo

__ 25. Use the mouse to move one of the files in your $HOME directory to the workspace
backdrop. This will create a shortcut to access the file.
The File icon has been dropped onto the backdrop and will stay there for fast and
oy si

convenient access. Now, if the file is executable, use the left mouse button and
double-click the File icon to make it run.
u

__ 26. With the pointer on the File icon on the backdrop, press the right button on the
mouse.
cl

What actions can you take on the file?


You can drag a selected file from the Directory display presented by the File
Ex

Manager or from the Desktop and place it somewhere else. You cannot place the
same file more than once on the Desktop backdrop. You cannot drop a file on itself.
__ 27. While dragging a file, take it across the controls on the Desktop.
pr

What do you see?


__ 28. Drop the file on the Clock control. What happens?

17-4 AIX Basics © Copyright IBM Corp. 2010, 2013


Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
V8.1
Student Exercises

EXempty Section 6: File Manager: Finding, copying and deleting files


The Desktop File Manager is one of the most useful and powerful tools in CDE. This
section explores more of the File Manager capabilities.
__ 29. Set the File Manager preferences to display a Directory Tree diagram, starting at the
root directory.
__ 30. Navigate to the root directory in the File Manager window.

.I. n
__ 31. Expand the /usr/dt directory.

.T ció
__ 32. Set your viewing options to see a single folder at a time (rather than a tree structure)
and using small icons. Also request display of the full path using icons near the top
of the window.

.
__ 33. Set your viewing options to display by properties (such as modify date, permissions,

C
.F a
owner, and so on). This output will look similar to the output of the ls -la command.
__ 34. Close the File Manager and any windows that it opened.

C rm
__ 35. Use the File Manager to execute the date command. This command is found in the
/bin directory.
__ 36. Use the File Manager to create the directory cdelab in your $HOME directory.
to fo
__ 37. The File Manager can also be used to execute a find operation. Use the File
Manager to find all pixmap files (files with an extension of .pm) in the CDE /usr/dt
directory.
ec vo

__ 38. Copy two or more of the pixmap files to the cdelab subdirectory.
__ 39. Rename one of the files to myicon.pm.
__ 40. Delete the myicon.pm file using the mouse and the Front Panel trash can.
oy si

__ 41. Delete a second pixmap file using the File Manager Menu Bar.
__ 42. With CDE, it is possible to retrieve a deleted file. Restore myicon.pm.
u

__ 43. Empty the trash can.


cl

__ 44. Change the Owner and Group permissions of the restored file to read/write.
__ 45. Close the File Manager.
Ex

__ 46. At this point, you can continue with the optional exercise or exit out of CDE. If you
are in a VNC environment, do not use the Exit icon, but instead just lock the session.
If completely done with using the CDE interface go to the last step in this exercise
and close down the interface.
pr

Skip this step to perform the optional steps.

Section 7: Optional Exercise Steps


__ 47. Click the Calendar control on the Front Panel. Add an appointment in the next
week.

© Copyright IBM Corp. 2010, 2013 Exercise 17. Using the Common Desktop Environment 17-5
Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
Student Exercises

__ 48. Change the view to Day View to view the appointment you have scheduled.
__ 49. Change the view to Week View to view the appointment you have scheduled.
__ 50. Set a reminder to yourself for the appointment. Make the appointment private so that
others cannot view it on your calendar.
__ 51. Return to the Month view icon on the calendar menu bar.
__ 52. Close the Calendar window

.I. n
__ 53. Exit out of the vnc session.

.T ció
.
End of exercise

C
.F a
C rm
to fo
ec vo
oy si
u
cl
Ex
pr

17-6 AIX Basics © Copyright IBM Corp. 2010, 2013


Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
V8.1
Student Exercises

EXempty Appendix A. Customizing AIXwindows (1)

What this exercise is about


This exercise shows the students how they can customize their
AIXwindows environment.

.I. n
What you should be able to do

.T ció
At the end of the lab, you should be able to:

.
• Customize the .xinitrc file

C
.F a
• Customize the .Xdefaults file

C rm
Introduction
In this exercise, students will learn how to edit files to customize their
AIXwindows environment.
to fo
ec vo
oy si
u
cl
Ex
pr

© Copyright IBM Corp. 2010, 2013 Appendix A. Customizing AIXwindows (1) A-1
Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
Student Exercises

Exercise instructions
Preface
• All exercises for this unit depend on the availability of specific equipment in your
classroom.
• If VNC is used to provide the AIXWindows environment, then the file that controls the

.I. n
AIXWindows session initialization is called xstartup, and is located in .vnc subdirectory
of the user’s home directory.

.T ció
• If the exercises are being done on a local attached graphics console (LFT), then follow
the instructions marked (LFT). If a VNC server session is being used to display
AIXWindows, then follow the instructions marked (VNC).

.
C
.F a
Section 1: Customizing the .xinitrc file
The .xinitrc file is used by the startx shell script to initialize the AIXwindows session.

C rm
(Actually, startx executes xinit, which reads the .xinitrc file.) If VNC is used to provide
the AIXWindows environment, then the file that controls the AIXWindows session
initialization is called xstartup, and is located in .vnc subdirectory of the user’s home
directory.
to fo
__ 1. Log in to your AIX system, either locally or through a terminal emulator.
__ 2. If using a local graphics display (LFT), copy the file /usr/lpp/X11/defaults/xinitrc
into your $HOME directory and call the file .xinitrc. If using a VNC session, there is no
ec vo

need to copy the file; the xstartup file is already present in $HOME/.vnc.
__ 3. Edit the file and make the following changes:
• Add a second hand to the xclock.
oy si

• Make the root window solid black.


• Add, on a new line before the exec mwm line, the following:
u

aixterm -T "Bills Window" &


cl

__ 4. Start the AIXwindows session. If you are accessing AIXWindows through a VNC
client, then start the VNC server with vncserver, and connect to the specified
session with the client. Does the AIXwindows environment look different? It should!
Ex

Section 2: Customizing the .Xdefaults file


pr

__ 5. Execute the command aixterm -keywords | pg to view all the resources that can
be customized for an aixterm window.

A-2 AIX Basics © Copyright IBM Corp. 2010, 2013


Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
V8.1
Student Exercises

EXempty __ 6. Create the .Xdefaults file in your $HOME directory and add the following resource
definitions:
Aixterm*foreground: DarkSlateGrey
Aixterm*background: wheat
Aixterm*geometry: 80x30
Aixterm*font: rom10.iso1
__ 7. Restart AIXwindows. This will cause your new .Xdefaults file to be read and used

.I. n
for any new aixterm windows you create. Now, open a new aixterm window. Does

.T ció
it have the characteristics specified in the .Xdefaults file?

__ 8. Now, end the AIXwindows session and then restart it. If using a VNC environment,

.
switch to your ASCII terminal session and issue vncserver -kill :session where

C
.F a
session is the VNC session ID. Restart the session by running vncserver. What do
the two original windows look like? Why?

C rm
__ 9. Edit the .Xdefaults file and update the following lines for new colors:
to fo
Aixterm*foreground: grey
Aixterm*background: navy
__ 10. Restart the mwm and then create a new aixterm window from the command line.
ec vo

Does it use your new color specifications? It should!

__ 11. Exit your AIXwindows environment and log out from your system. If using VNC,
oy si

switch to your ASCII terminal session and kill the VNC server.
u

End of exercise
cl
Ex
pr

© Copyright IBM Corp. 2010, 2013 Appendix A. Customizing AIXwindows (1) A-3
Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
Student Exercises

.I. n
.T ció
.
C
.F a
C rm
to fo
ec vo
oy si
u
cl
Ex
pr

A-4 AIX Basics © Copyright IBM Corp. 2010, 2013


Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
V8.1
Student Exercises

EXempty Appendix B. Customizing AIXwindows (2)

What this exercise is about


This exercise shows the students how they can customize their
AIXwindows environment.

.I. n
What you should be able to do

.T ció
At the end of the exercise, you should be able to:

.
• Use the custom tool to tailor colors and fonts

C
.F a
• Use the custom tool to tailor size, location, icons, and the scrollbar
• Customize the Motif window manager (mwm)

C rm
• Use the xsetroot command to customize the root window

Introduction
to fo
In this exercise, students will learn how to use the AIXwindows
custom tool to customize their AIXwindows environment.
ec vo
oy si
u
cl
Ex
pr

© Copyright IBM Corp. 2010, 2013 Appendix B. Customizing AIXwindows (2) B-1
Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
Student Exercises

Exercise instructions
Preface
• All exercises for this unit depend on the availability of specific equipment in your
classroom.
• If the exercises are being done on a local attached graphics console (LFT), then follow

.I. n
the instructions marked (LFT). If a VNC server session is being used to display
AIXWindows, then follow the instructions marked (VNC).

.T ció
Section 1: Using the Custom tool: Color and fonts
__ 1. Log in to your system and start AIXwindows. If the AIXWindows session is being

.
accessed through VNC, start the VNC server, and access it from your VNC client.

C
.F a
__ 2. Make sure you have two aixterm windows open as well as the xclock. Also, start
the scientific calculator.

C rm
__ 3. Start the AIXwindows customization tool.
__ 4. On the Customizing Tool window, choose xcalc.
__ 5. View the different resource categories that can be changed for the xcalc
to fo
application. What sorts of resources can be changed? Choose Colors, which is the
default resource category.
__ 6. Change the background color for xcalc to the color of your choice.
ec vo

__ 7. Switch focus to an aixterm window and display the contents of .Xdefaults. Has it
been updated? It should not have been!
oy si

__ 8. So, to have your values saved in .Xdefaults, change your focus back to the xcalc
customizing window. Save the values you have chosen.
u

__ 9. Now, review the .Xdefaults file again. Your resource change should now be there.
cl

__ 10. Return to the xcalc Customizing window and now choose the resource category of
Fonts.
Ex

__ 11. View the various fonts that can be used for the window interior.
__ 12. The List of Fonts window is used to display all the possible fonts. Feel free to scroll
through them, but be aware that there are LOTS of fonts in the list! You can narrow
down the list of fonts by choosing Family, Weight, Slant, Style, Spacing, and Size
pr

in the respective selection windows. Below these windows will be feedback


indicating how many fonts match the selection criteria.

B-2 AIX Basics © Copyright IBM Corp. 2010, 2013


Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
V8.1
Student Exercises

EXempty Click a font from the List of Fonts that appears interesting. It will be displayed in the
Sample box (some fonts will not display). If you have trouble finding a font you like,
try the following to narrow down the search:
Family: Helvetica
Weight: Bold
Slant: All
Style: All

.I. n
Spacing: All
Size: 14

.T ció
Choose a font to be used for the xcalc window and save your choice as you did for
the background color. Verify they change has been added to your .Xdefaults file.

.
Close the Customizing windows.

C
__ 13. Use the customizing tool to change the background color for an aixterm. When you

.F a
choose Apply will the color of your existing aixterm windows change like it did for
the xcalc window? Will the new color be updated in the .Xdefaults file? Verify that

C rm
your change updated .Xdefaults and affects the appearance of a new aixterm.

Section 2: Customizing the root window with the xsetroot command


to fo
We will next change the root menu. This is done using the xsetroot command from the
command line of one of your aixterm windows.
__ 14. Change the root window to solid blue.
ec vo

__ 15. Change the cursor pointer to a skull and crossbones (called pirate), to a shuttle, or
to gumby. Move the cursor to the root window to view the new cursor shape.
__ 16. Have the root window display xsnow (snowflakes) or escherknots - take your pick.
These bitmap images are found in the directory /usr/include/X11/bitmaps. You
oy si

might want to view the file names in this directory for other bitmaps of interest. The
bitmaps themselves are black and white images, so you might want to set other
u

colors for the background and foreground.


__ 17. If you decide you like any of these root window options, how would you make your
cl

customization permanent, that is, available every time you start AIXwindows?
Ex
pr

© Copyright IBM Corp. 2010, 2013 Appendix B. Customizing AIXwindows (2) B-3
Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
Student Exercises

Optional exercises
Section 3: Using the Custom Tool: Size and Location, Icons and
Scrollbar
__ 18. Make sure you have a running Calculator Tool. If not, start one.
__ 19. Start the AIXwindows Custom Tool and choose xcalc again.

.I. n
__ 20. Choose the Size and Location resource category and customize the size of the
xcalc.

.T ció
__ 21. Suppose you want to update the icon used for a particular AIXwindows application.
To demonstrate how this is done, we will change the icon used for xcalc. You might

.
first want to iconify and then restore the xcalc window to view the icon that is used.

C
Then, use the xcalc Customizing window, and choose the icon resource category.

.F a
__ 22. Choose a new icon for the xcalc window: have the icon look like a terminal. Once

C rm
you have completed this task, review the .Xdefaults file to verify that your entry has
been added. Test the new icon to verify that it is being used.
__ 23. Now, add a scroll bar to the aixterm windows. Verify that the .Xdefaults file has
been updated and test to verify that the scroll bar works.
to fo
__ 24. In your new aixterm window, list the files in /usr/bin and then use the scrollbar to go
back and forth in the listing.

Section 4: Customizing the Motif Window Manager (MWM)


ec vo

__ 25. Use the AIXwindows custom tool to update the MWM with the following
characteristics:
oy si

window manager background: red


window manager foreground: blue
u

Verify that .Xdefaults has been updated.


__ 26. Some users prefer to use the pointer focus policy so they do not have to click a
cl

window to make it the active window. The pointer focus policy allows you to merely
move the pointer to a window to make it the active window. If you are interested,
change your focus policy to pointer. Verify that .Xdefaults has been updated and
Ex

that the new focus policy works.


pr

End of exercise

B-4 AIX Basics © Copyright IBM Corp. 2010, 2013


Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
V8.1
Student Exercises

EXempty Appendix C. Customizing CDE

What this exercise is about


This exercise provides an opportunity to customize the CDE Desktop.

.I. n
What you should be able to do

.T ció
At the end of the exercise, students should be able to:
• Customize CDE using the Style Manager

.
• Customize the Front Panel

C
.F a
Introduction

C rm
Students will work as teams using a graphics terminal to customize
their CDE environment. This machine exercise will focus on using the
interactive customization features of CDE. First, the CDE environment
to fo
will be customized using the Style Manager. Then, the Front Panel will
be customized.
ec vo
oy si
u
cl
Ex
pr

© Copyright IBM Corp. 2010, 2013 Appendix C. Customizing CDE C-1


Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
Student Exercises

Exercise instructions
Preface
• All exercises for this unit depend on the availability of specific equipment in your
classroom.

Section 1: Customizing the front panel

.I. n
__ 1. If logging in through a VNC client, first connect to the AIX machine via an ASCII

.T ció
terminal session and log in as your user. Start the VNC server session by typing
vncserver. Switch back to your desktop, and start the VNC client application,
specifying the hostname and VNC session number.

.
If logging in on a graphics console (LFT), log in as your userid.

C
.F a
__ 2. Customize your Workspaces as follows:

C rm
Rename each Workspace.
Change the Backdrop of each Workspace.
Turn on the screen saver and screen lock.
to fo
Set the window behavior.
Select a different palette for the workspaces.
__ 3. Add a fifth workspace and customize its style using the Style Manager.
ec vo

__ 4. Set the new session as your Home session, and set Startup to return to your Home
session at login.

Note
oy si

This is not supported in a VNC session. If using VNC, skip to Step 6.


u
cl

__ 5. Log out and log in again. Check to see that the state of your session matches what
you set in the previous steps.
Ex

__ 6. Add the same dtterm session to all workspaces.


An application can be assigned to one or more workspaces by using the Window
button menu.
pr

__ 7. Use the ls command in the dtterm to list the current directory.


Check each of the workspaces to see if the same application session is available.
__ 8. Now, remove a Workspace application from one or more Workspaces.
__ 9. Have the dtterm application appear on the Front Panel as the default application
associated with the Personal Applications control.

C-2 AIX Basics © Copyright IBM Corp. 2010, 2013


Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
V8.1
Student Exercises

EXempty __ 10. Tear off the Personal Applications subpanel menu, and place it on the workspace.
__ 11. Create a new subpanel for the Style Manager control and add the Icon Editor and
the aixterm applications to it.
__ 12. Now, remove the Icon Editor from the new subpanel.

Section 2: Adding a new control to the front panel

.I. n
__ 13. Start the Application Manager.
__ 14. Open the Personal Applications subpanel.

.T ció
__ 15. Drag the Firefox icon from the Application Manager window on to the Install Icon
from the Personal Applications subpanel.

.
__ 16. Close the Personal Applications subpanel.

C
.F a
__ 17. Find out the name of the definition file in directory $HOME/.dt/types/fp_dynamic.
Write down the file name:

C rm
__ 18. Copy this definition file to directory $HOME/.dt/types and specify a new file name.
__ 19. Anchor the application control in the Front Panel by editing the copied definition file.
to fo
Use your student notes to find out which lines must be changed.
__ 20. Restart the CDE. After restarting CDE, you should see the application icon on the
Front Panel.
ec vo

End of exercise
oy si
u
cl
Ex
pr

© Copyright IBM Corp. 2010, 2013 Appendix C. Customizing CDE C-3


Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
Student Exercises

.I. n
.T ció
.
C
.F a
C rm
to fo
ec vo
oy si
u
cl
Ex
pr

C-4 AIX Basics © Copyright IBM Corp. 2010, 2013


Course materials may not be reproduced in whole or in part
without the prior written permission of IBM.
V8.1

Ex backpg
Back page

cl
pr u
oy si
ec vo
to fo
C rm
.F a
.T ció
.I. n
C
.
Ex
cl
pr u
oy si
ec vo
to fo
C rm
.F a
.T ció
.I. n
C
.
CONTACTO
Teléfono
91 761 21 78
Póngase en contacto con nuestro equipo y le
informaremos de cualquier duda o cuestión
que pueda surgirle.

Email
[email protected]
Mándenos un email y le atenderemos
enseguida.

Online
@Arrow_Edu_ES
O bien puede contactarnos a través de
nuestro perfil en Twitter.

Visítenos
Arrow ECS Education Services
Avenida de Europa 21,
Parque Empresarial La Moraleja
28108 Alcobendas, Madrid

EDUCATION
S E R V I C E S

You might also like