Professional Documents
Culture Documents
Credits:
Subject Matter Expert.............................................. Gladwin Fernando
Technical Writer....................................................... Mohamed Zughrat
QA Reviewer................................................................... Hakim Kechih
Instructional Design Project Manager............................ Cynthia Koons
Instructional Designer........................................................ Matt Gregan
Copyright notices:
© 2015 Baker Hughes Incorporated
Self Study Guide
Table of Contents
Page
Course Overview......................................................................................................vii
Welcome................................................................................................................vii
Course Goals and Audience..................................................................................vii
Course Modules.................................................................................................... vii
Course Objectives................................................................................................. vii
Overview of UNIX...................................................................................................... 9
Introduction to UNIX..............................................................................................10
The UNIX Operating System............................................................................. 10
Features of UNIX............................................................................................... 11
UNIX File System..................................................................................................15
Host File.............................................................................................................15
Prompt............................................................................................................... 15
File Systems Recognized in UNIX..................................................................... 16
Device Files....................................................................................................... 17
Navigation............................................................................................................. 22
Navigating the UNIX File System.......................................................................22
Path names........................................................................................................23
Basic Commands...............................................................................................24
Module Review Questions.................................................................................... 29
Advanced UNIX Applications...................................................................................31
File Permission and Access..................................................................................32
UNIX Users........................................................................................................ 32
Levels and Types of Access Permissions..........................................................32
ECLIPS License.................................................................................................35
Mounting and Unmounting....................................................................................36
Device Mount/Unmount Process and Examples................................................37
fstab File............................................................................................................ 37
Mount/Unmount Graphical User Interface (GUI)................................................39
Monitoring Available Disk Space....................................................................... 41
Basic Networking.................................................................................................. 42
Local Area Network............................................................................................42
Network Connectivity......................................................................................... 42
Logging in to a Remote Unit.............................................................................. 43
Remote Copy..................................................................................................... 44
Module Review Questions.................................................................................... 46
Appendix..................................................................................................................47
Course Summary.................................................................................................. 47
Course Overview
Welcome
Welcome to the UNIX Self Study Guide! At Baker Hughes, learning is identified as
one of our core values. We believe a learning environment is the way to achieve
the full potential of each individual and the company. On behalf of Baker Hughes,
we would like to express our gratitude for your commitment to continued learning
that both increases your own individual potential and enables Baker Hughes to
continue "Advancing Reservoir Performance". We applaud your participation in this
learning event and hope that it results in future success in your current role.
Course Modules
This course consists of the following modules:
Overview of UNIX
Advanced UNIX Applications
Course Objectives
Upon the completion of this course, participants will be able to do the
following:
Module 1
Overview of UNIX
Upon the completion of this module you should be able to do the following:
Lessons
1. Introduction to UNIX
2. UNIX File System
3. Navigation
Lesson 1
Introduction to UNIX
Lesson Overview
This lesson consists of the following topics:
The UNIX Operating System
Features of UNIX
The UNIX operating system is time-sharing and interactive, and made up of three
parts: the Kernel, the Shell, and the programs.
Disks
User
Acquisition Memory
Consumers System Resources
CPU
Programs
Network
Features of UNIX
Multi-tasking
While physically the Central Processing Unit (CPU) can execute only one task at a
time, the UNIX operating system has the capability to time-share the CPU between
multiple processes that are scheduled to run at the same time. This multi-tasking
feature is transparent to the user who feels that the tasks and programs are being
executed simultaneously.
Multi-user
Multi-user capability is one of the most important features of UNIX. It allows more
than one user to log in and use the system at the same time, which is a natural
extension of the multi-tasking capability.
The multi-user feature of UNIX is generally not used by the ECLIPS system. There
commonly is one single user working on the system and performing many tasks at
the same time.
Logging In
In order to bring the user back to the Log In prompt, the user needs to log out of X-
Windows (as opposed to shutting down the system or re-booting it). To do so, the
keys Ctrl_Shft_Break should be hit simultaneously.
Logging out of X-Windows in this way will allow the user to clear any problems
associated with X-Windows relatively quickly. Such problems might be Windows or
programs locking up and and slowing the system down. System slowing down/
freezing can be due various reasons. It can be simple, like a program taking up too
much processing time, or it can be software issue.
login: cls2
password: cls262
ECLIPS Startup
In order to log into ECLIPS, the user has to log in as cls2 as shown in the
Screenshot of loggin into UNIX system figure. The system requires the user to
make decisions or answer questions that will set the way the ECLIPS system will
behave.
These include:
Whether to append the syslog file (use the append option).
Select a working directory, the user needs to create a subdirectory
under /dat1a and use it as the working directory.
If the use of the ECLIPS machine is for training purposes, the default job
information in the Job ID file can be used.
X-Windows Resources
The Windows Resources figure shows screenshots of some of the resources found
in X-Windows.
Windows Resources
Lesson 2
UNIX File System
Lesson Overview
This lesson consists of the following topics:
Host File
Prompt
File Systems Recognized in UNIX
Device Files
Host File
Each computer has an address assigned to it. This is referred to as an internet
protocol (IP) address. In order to communicate with other computers on the
network, each computer has to be uniquely identified using a combination of unique
IP addresses and an associated hostnames.
The file that contains the hostnames and their associated IP addresses is known as
the hosts file. It acts as a phonebook.
To find the hostname of a UNIX computer, the following command can be typed:
$hostname
To view the hosts file, the following command can be typed on the command line:
$more/etc/hosts
Prompt
In order to access and navigate the UNIX file system, the user must type a
command at the prompt, which is the $ that can be seen in a UNIX command line.
In order for a UNIX system to recognize and execute a command, the command
has to comply with a predefined format. A UNIX command is composed of
individual components as shown in The Components of the Command Line table.
This example uses the ras/data/$ rme 5.aff command.
When a prompt ($) is seen, a command can be typed. In this example, the
computer will understand the first word as the command rm (remove) with an
argument to the command (5.aff). Note that a space has to be inserted between
the command and its argument.
Note the space that exists between the command and its argument.
Every command line will be concluded with a return (enter key). Pressing the enter
key transmits the command to the computer for execution.
The hostname and the current working directory might not be visible on
the command line.
The UNIX system command input is case sensitive. Most commands and options
are defined in lowercase. Therefore, rm 5.aff is a valid command and RM 5.aff is
not a valid command.
Device Files
A device refers to a peripheral connected to a computer.
Examples of devices:
An entire hard disk
A portion of a partitioned hard disk
A CD/DVD drive
Printers
Display terminals
Keyboard
Mouse
Every operating system has unique tools to control the data input and output (I/O)
through the peripherals that are connected to it. For example, Microsoft Windows-
based computers use special files called drivers to access peripheral devices. The
equivalent of these in UNIX-based computers are called Device Files. These files
control the communications between the UNIX system and the peripheral device,
as illustrated in the Device Interface with the Operating System figure.
Logical Volume
A physical hard disk can be used in various ways:
A single storage unit
Grouped with other hard disks to form a larger storage space
Divided into more than one partition
In the last listed example, the hard disk is known as a volume group, with the
partitions referred to as Logical Volumes. Each logical volume is treated by UNIX
as if it is an individual hard disk.
The Logical Volume figure illustrates how a single hard disk can be partitioned into
three smaller logical volumes. Each Logical Volume holds a separate file system
and has its own device file.
Logical
Hard Disk A Volume 1
(72Gb) (32Gb)
Logical
Volume 2
(30Gb)
Logical
Volume 3
10Gb)
Logical Volume
c# t# d# [Other]
Interface Card
Number
Target address
Device number
Device independant
information
The Device files and their associated directories table shows some examples of
naming conventions, along with their applications.
Naming
Application
Convention
/dev/vgn/rlvoln General directory that contains the entire character device files for logical
volumes in a volume group
/dev/rmt General directory that contains all character device files for 1/2-inch reel and
DDS tape. This also includes the instruction to rewind such devices.
Some devices, such as hard disks, are capable of handling I/O in both block and
character mode. Such devices will have two device files, one for block and one for
character mode. All other devices typically have only character device file.
Lesson 3
Navigation
Lesson Overview
This lesson consists of the following topics:
Navigating the UNIX File System
Path names
Special Directories
Basic Commands
The UNIX system provides commands that allow the creation of new directories
easily as organizational needs change. The system also allows for moving or
copying files from one directory to another. It is as easy as adding a new file folder
to one of the drawers in a file cabinet and moving a report from an old folder to a
new folder.
When a directory is created, two entries, called dot (.) and dot dot (..) , are created
automatically. These are commonly used when designating relative path names.
With relative path names the hierarchy can only be traversed down. With dot dot, it
is possible to traverse up through the hierarchy as well.
Dot (.) – Commonly referred to as dot, it represents the current position in the
directory.
Dot Dot (..) – Commonly referred to as dot dot. It represents the directory
immediately above the current directory position, often called the parent
directory. The root directory (/) is like any other directory, and contains entries
for both dot and dot dot. Since the root directory does not have a parent
directory, its dot dot entry just refers to the root directory.
Path names
File and directory locations can be designated with either an absolute path name or
a relative path name.
Absolute Path Name
Gives complete designation of the location of a file or directory
Always starts at the top of the hierarchy (the root)
Always starts with a forward slash (/)
Is not dependent on current location in the hierarchy
Is unique across the entire hierarchy
Path names
Basic Commands
This table summarizes the most commonly used UNIX commands.
Command Action
su Switch user
man Display manual page for help on commands
date Display the system date and time
pwd Display the absolute path of current working directory
ls List files and directories relative to the current pwd
ll Detail-lists files and directories relative to the current pwd an argument | more
displays one page at a time; hit space bar for next page
Command Action
cd Change directory
find Find files according to the format “find (where) (how) (what)”
example: find /dat1a -name file_name
mkdir Create a new directory
cp Create a copy of a file according to the format: cp (source) (destination)
Example: cp /etc/hosts
mv Moves or renames a file or directory
rm Deletes a file or (-r) for directory
more Displays the contents of a file
Examples
The Switch User Command figure demonstrates the use of the su command.
su, the Switch User command, switches from cls2 to root and vice
versa. When the su command is used to switch user from cls2 to root,
the user must type the exit command to get back to cls2. If the su
command is used again the system will daisy chain the user to cls2 as
in cls2-root-cls2.
The Date Command figure demonstrates the use of the date command.
Date Command
The Present Working Directory command demonstrates the use of the pwd
command.
The Short List Command figure demonstrates the use of the ls command.
The Long List Command figure demonstrates the use of the ll command.
The Change Directory Command figure demonstrates the use of the cd command.
The Create Directory Command figure demonstrates the use of the mkdir
command.
Directory ADAM
created under dat1a
The Remove or Delete Command figure demonstrates the use of the rm command.
The Move or Rename Command figure demonstrates the use of the mv command.
The Make a Copy Command figure demonstrates the use of the cp command.
Module Summary
You have now completed the Overview of UNIX module, which consisted of the
following lessons:
Introduction to UNIX
UNIX File System
Navigation
After completing this module, you should be able to do the following:
List the features of the UNIX system.
Categorize the file systems of UNIX.
Navigate the UNIX file system using the proper commands.
2. In the command line “dev0: /WORK $ bdf”, match the items and their
description:
a. True
b. False
Module 2
Advanced UNIX Applications
Upon the completion of this module you should be able to do the following:
Module Overview
This module consists of the following lessons:
File Permission and Access
Mounting and Unmounting
Basic Networking
Lessons
1. File Permission and Access
2. Mounting and Unmounting
3. Basic Networking
Lesson 1
File Permission and Access
Lesson Overview
This lesson consists of the following topics:
UNIX Users
Levels and Types of Access Permissions
ECLIPS License
UNIX Users
UNIX is well known for its multiple user capabilities.
It is important to remember the following points when using UNIX:
Conventionally, there are three users identified on ECLIPS machines:
1. cls2 (denoted as a $ in the command prompt)
2. root (denoted as a # in the command prompt)
3. auxproc (can access the UNIX machine from a PC)
Switch between users using the command su
Any user can be terminated using the command exit
User root (#) is not the same thing as directory root (/)
Logging in as a certain user does not put the operator in that particular
directory.
Access Permissions
User Description
Owner – The ultimate proprietor of the file.
– The owner possesses the right to determine the permissions assigned to the different
users regarding the access to the file.
– Can transfer the ownership of the file to other users on the system.
Group – A group to which a user belongs.
– The permissions of this group to access a file are determined by the owner.
Other – Every other user outside the group.
– The permissions of this group to access a file are determined by the owner.
When a user is logged into a UNIX computer, access to any file is defined by the
user's identification, group identification, and the permissions associated with the
file.
Access Types
The permissions to access a file are designated through a nine character field. The
first three characters define the permissions for the owner of the file, the following
three characters define the permissions of the group to which the file belongs, and
the last three characters define the permissions of all other users on the system.
The type of access can be represented symbolically or numerically.
There are three types of access for each file and directory:
The Long List command ll is used to display the files in the current working
directory, the owners, groups, and the permissions to access them.
The mode of a file is divided into owners, groups, and others. Each one has a set of
permissions that control access to it.
The Permissions figure shows examples of files with different types of permissions:
print_env.tif file – Both the owner and the group have a read (r) and a write
(w) access to this file. All other users have only a read access.
run_update.tif file – The owner has a read (r) and a write (w) access to the file.
The group only has a read (r) access. Other users do not have any access to it.
Permissions
Once ownership of a file has been changed, only the new owner or
root can modify its ownership and/or mode.
The group field in the long listing identifies which user group has access to a given
file. The chgrp command can be used to change the user group of a file.
Only the owner of a file (or root) can change the group identifier associated with a
file. In ECLIPS, there is almost no need to change the group association of a file.
The chown functions in the same way as the chgrp. While there should be little
need to be changing ownership of files in ECLIPS, the command needs to be
understood. When changing the ownership of a file, always change the group first.
If the user changes the owner first, control of the file may be lost.
Change Owner
The one instance where it might be required to change the ownership, group,
and/or permissions of a file or directory would be to create a mount point with the
correct associations. In the Change Owner figure, an OCT was transferred to the
ECLIPS system from a laptop using File Transfer Protocol (FTP). The user account
for FTP is auxproc, which means the owner of the transferred file will also be
auxproc. All ECLIPS files should be owned by user cls2, so the user would
change the owner of the file after it is transferred to the system.
ECLIPS License
ECLIPS requires a license to be operated, in the same manner that Microsoft office
does. All users are issued a license that is good for one year, after which it must be
renewed annually.
The name of the ECLIPS license file is license.eclips.dat. This file is located in the
directory /usr/local/flexlm/licenses. To get a new license the system hostid must
be provided. The command to get the system hostid is echostid.
Lesson 2
Mounting and Unmounting
Lesson Overview
This lesson consists of the following topics:
Device Mount/Unmount Process and Examples
fstab File
Mount/Unmount Graphical User Interface (GUI)
Monitoring Available Disk Space
Mounting is the process of logically linking an external file system to the local
system's file hierarchy so that the content of the external file system is accessible
to the user, as if it is a part of the local file system.
An external file system can be mounted onto the local system's file hierarchy using
either the mount command, or the user-friendly graphical user interface (GUI).
Mounting is required to make the file system part of the overall system hierarchy.
However, mounting through the command line as shown below is only temporary,
the file system will not automatically be mounted the next time the system is
started.
The command line does not edit the file systems table (fstab) file to add an entry.
To logically disassociate the new file system from the root file system, the user
must unmount it. The command to use in this case is called: umount.
The above command is used to mount a file system whose designated device file
is /dev/vg00/lvol5 onto an empty directory, /home, in the root file system. The
command links the file system contained in a physical partition of a hard disk, via
the device file, to a point in the root file system. After being mounted, the contents
of this file system will be accessible by navigating to the /home directory and the
branches below it.
Root File System Hierarchy
/ Partitioned Hard
Disk with its Own
File System
lvol5
Mounting the lvol5 Partition to a
Mount Point Called home
While working in the directory that is the desired mount point, the system will not
allow mounting. An error message will be returned.
fstab File
The fstab is a text file located under the /etc directory. It stores information that
tells the computer what file systems to mount automatically every time the system
is started up. It also contains information on the resources that were previously
mounted and the location where they were mounted. The fstab file eliminates the
need to perform manual mounting every time a file system on a hard disk is to be
accessed.
The fstab image shows examples of entries that can be found in an fstab file.
fstab
In a freshly installed UNIX computer, some devices (e.g. data hard disk, CD/DVD
drive) need to be manually mounted for the first time. If the mount command line is
used to perform the mounting operation, the fstab file will not be edited, therefore,
the next time the system is switched on, the CD/DVD drive will have to be mounted
again before it can be used. In order to have the mounting entries permanently
registered in the fstab file, the graphical user interface (GUI) method is to be used.
After the first manual mount using the GUI, subsequent startup of the computer will
automatically mount those devices.
Never edit the fstab manually. Always use the mount GUI.
CDFS MOUNT
To unmount a hard disk or CD/DVD rom, select System Utilities and then
Unmount File System from the Root Window Menu. This action will launch the
window where the user enters the directory to unmount, as shown in the Unmount
figure.
Unmount
Unmount Successful
The command bdf displays all the mounted devices on the computer. This includes
remotely mounted hard disk and CD/DVD ROM. The bdf Command figure shows
the bdf command executed before and after mounting a CD/DVD ROM.
bdf Command
With experience, the data rate of various logging combinations will be familiar to an
engineer. It is a simple matter to calculate the required disk space by multiplying
the data rate by the interval logged. The Disk Monitor screen shows the ratio of
used space to available space. In the Disk Monitor figure, red indicates used space
and green indicates available space.
Disk Monitor
Lesson 3
Basic Networking
Lesson Overview
This lesson consists of the following topics:
Local Area Network
Hosts File
Network Connectivity
Logging in to Remote Unit
Remote Copy
HUB
Jet Direct BOX 4-ch wsp
esp
rap
Plotter 1
Plotter 2 cpu
Network Connectivity
Network connectivity between two network devices (computers, plotters, panels,
etc.) may be verified with the command ping. The ping command sends an Echo
Request packet to the host. If the network connection between the devices is good,
the host will echo back the packet.
The figure Hosts File Example displays the hosts file located at /etc/hosts. This
host computer has a host name of dubcla65 with IP address of 10.97.102.165, and
is been listed in the local computer ‘sys5’.
In this case, the network connectivity of the device dubcla65 can be checked in
two different ways: $ping 10.97.102.165 or $ping dubcla65. The results of these
commands are shown in the figure Network Connectivity Check Example.
To remotely login to another system in the network, the local system should have
the hostname and ip address of the remote computer in its hosts file(/etc/hosts).
Remote Copy
There are two methods of copying file:
1. Use the command rcp (source) (destination)
Example: $ rcp camlab1:/etc/hosts /dat1a/ELS_fast/yyy
2. Through File Transfer Protocol (FTP)
There are several considerations for the operator when copying a file.
The remote computer can be either the source or the destination.
Be aware of the permissions.
To copy directories use the –r option.
The command for copying a file remotely is shown in the Remote Copy figure.
Remote Copy
Module Summary
You have now completed the Advanced UNIX Applications module, which
consisted of the following lessons:
File Permission and Access
Mounting and Unmounting
Basic Networking
After completing this module, you should be able to do the following:
Choose and set the permission levels of various UNIX users
Sequence the steps to mount and unmount devices
Sequence the correct process for communicating between network devices
a. chmod
b. chgrp
c. chown
d. chowner
3. Which command is used check the network connectivity between two network
devices?
a. rcp
b. hello
c. rlogin
d. ping
Appendix
Course Summary
Step 1
Check System Date.
Step 2
Create a directory named “unix” under /dat1a
Step 3
Make this newly created directory (/dat1a/unix) as your working directory.
Step 4
Display the contents of hosts file located at /etc/hosts.
Step 5
Find a file named ‘license.eclips.dat’ under /usr/local/flexlm/licenses (hint:
use wildcard * eg: /usr/*).
Step 6
Copy (DO NOT MOVE) the file ‘license.eclips.dat’ you found in previous step
to /dat1a/unix.
Step 7
Determine the owner and permission of the file license.eclips.dat
under /dat1a/unix.
Step 8
Rename the file license.eclips.dat under /dat1a/unix to ‘eclips.practice’ (Do
not make a copy but rename).
Step 9
Change ownership of the file eclips.practice under /dat1a/unix to ‘root’.
Step 10
Switch user (hint: password is ‘root62’).
Step 11
Change permission of eclips.practice as listed and exit.
Owner : read/write/execute
Group : read/execute
Other : execute
Step 12
Change ownership of the file eclips.practice under /dat1a/unix to ‘cls2’.
Were you able to change the ownership to cls2? If no, what is the reason?
How can you change the ownership to cls2 in this case?
Step 13
Determine hostid of your UNIX computer.
Step 14
Find the expiry date of the ECLIPS license of your UNIX computer.
Course Modules
This course consisted of the following modules:
Overview of UNIX
Advanced UNIX Applications
Course Objectives
Having completed this course, you should be able to do the following:
Next Steps
Congratulations on completing the UNIX Self Study Guide!! Once again, we would
like to express our gratitude for your commitment to continued learning that both
increases your own individual potential and enables Baker Hughes to continue
"Advancing Reservoir Performance."