You are on page 1of 50

UNIX Self Study Guide

Self Study Guide


Self Study Guide

Credits and Copyright

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

UNIX Self Study Guide


vi
Self Study Guide

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 Goals and Audience


Goal: For ECLIPS operators to gain a fundamental knowledge of UNIX
Audience: Wireline Field Engineers, Specialists, and Maintenance Engineers

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:

Use the basic navigation commands of the UNIX system.

Apply the advanced UNIX commands and applications.

UNIX Self Study Guide


vii
Course Overview

UNIX Self Study Guide


viii
Self Study Guide

Module 1
Overview of UNIX

Upon the completion of 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.

Lessons
1. Introduction to UNIX
2. UNIX File System
3. Navigation

UNIX Self Study Guide


9
1 Overview of UNIX

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


UNIX is an operating system that is used to manage interaction and resource
sharing between many other computer programs and applications.

It is designed to run multiple processes simultaneously and support multiple users


in order to facilitate the sharing of data. UNIX systems also have a graphical user
interface (GUI), similar to Microsoft Windows, that provides an easy to use
environment.

The UNIX operating system is time-sharing and interactive, and made up of three
parts: the Kernel, the Shell, and the programs.

The system consists of wrappers around the


hardware as illustrated in the The relationship
between X-Windows, the Shell, and the Kernel
figure. The Kernel wraps the hardware. Shell
wraps the Kernel, and X-Windows wraps Shell.
The user interacts with either X-Windows or the
Shell.

The Shell acts as an interface between the user


and the Kernel. When a user logs in, the login
program checks the username and password,
then it starts another program called the Shell, The relationship between X-Windows,
the Shell, and the Kernel
which is a command line interpreter (CLI). The
Shell interprets the commands that the user types in and arranges for them to be
executed.

UNIX Self Study Guide


10
Self Study Guide

Disks
User

Acquisition Memory
Consumers System Resources
CPU

Programs
Network

An Operating System Controls and Regulates Requests for System Resources

Features of UNIX

Hierarchical File System


Data and information in UNIX are organized in files that are contained within
different levels of directories and subdirectories. Files normally contain data, text,
programs, and so forth. The UNIX file system structure is very flexible, it allows
moving, copying, and renaming files and directories through simple UNIX system
commands.

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.

UNIX Self Study Guide


11
1 Overview of UNIX

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.

Screenshot of login into UNIX system

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

UNIX Self Study Guide


12
Self Study Guide

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.

Screenshots of ECLIPS Startup

UNIX Self Study Guide


13
1 Overview of UNIX

X-Windows Resources
The Windows Resources figure shows screenshots of some of the resources found
in X-Windows.

Windows Resources

1. ECLIPS Main Menu


2. System Message Window (sys log)
3. Data Acquisition Main Menu. All data acquisition is controlled from this window.
4. Clock (Console Window). There is also a digital version available.
5. CPU load window (used to indicate the amount of load on the CPU).
6. Terminal window, referred to as an hpterm window. This window is where the
operator enters commands for the shell to execute.

UNIX Self Study Guide


14
Self Study Guide

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.

The Components of the Command Line


Command Line Components Description
ras2 The name assigned to the computer system; hostname
/dat1a The working directory

UNIX Self Study Guide


15
1 Overview of UNIX

Command Line Components Description


$ The prompt
rm The command
5.aff The command argument

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.

File Systems Recognized in UNIX


The following are types of file systems recognized by UNIX:
High-Performance File System (HFS) - An HFS file system is the local file
structure of the computer hardware.
Network File Systems (NFS) - NFS allows many systems to share the same
files via a network. Once access to the network is granted, the NFS file system
is handled in the same way the local HFS is.
CD-ROM File Systems (CDFS) - CD-ROM file systems are always read only,
which makes them different from the previous examples. If the CD/DVD has
writing capability, they are treated in a similar manner to HFS/NFS file systems.
UNIX cannot access and use the content of a file system unless it is incorporated
into, or mounted to, the system's file hierarchy. An example of this hierarchy is
given in the UNIX File Hierarchy figure.

UNIX Self Study Guide


16
Self Study Guide

UNIX File Hierarchy

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.

UNIX Self Study Guide


17
1 Overview of UNIX

Device Interface with the Operating System

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

UNIX Self Study Guide


18
Self Study Guide

Device File Naming Convention


While the actual device file names differ from one UNIX computer model to
another, they all follow the same naming convention.

c# t# d# [Other]

Interface Card
Number

Target address

Device number

Device independant
information

Device File Naming Convention

File Name Conventions:


c# – The number of the interface card to which the device is connected.
t# – The target address of the device on the interface. Typically t# is the
address set by jumpers or dip switches in the device itself.
d# – The Logical Unit Number. It ranges between 0 to 7. On SCSI devices, d#
is the SCSI Logical Unit Number and will always be 0 on SCSI devices used in
ECLIPS.
[Other] – The last part of the device file name varies by device type and is
optional. For example, device files for tape drives include processing options
such as n for no rewind.

UNIX Self Study Guide


19
1 Overview of UNIX

Categories of Device Files


There are two conventions to handle I/O with a device: block mode and character
mode.

Block Device Files


Block Device Files transfer data in blocks using the system's internal resources,
which speeds up I/O transfer. Hard disks require this type of data transfer and
speed, and therefore use block device files.

Block device files are placed under a subdirectory called dsk.

Examples of block device files with descriptions


Naming
Description
Convention
/dev/dsk/c3t5d0 A block type device file for a hard disk that has a SCSI address of 5
/dev/dsk/c0t0d0 A block type device file for a CD/DVD drive that has a SCSI address of 0

Character Device Files


Character Device Files transfer data one character at a time. They do not use the
system's internal resources; instead, they use those of the application. Character
devices are often referred to as raw devices. Terminals, printers, and plotters use
character device files.

They are placed under subdirectories called rdsk and/or rmt.

An example of a character device file with a description


Naming Convention Description
/dev/rmt/c2t3d0 A character type device file for a tape drive that has a SCSI address of 3

The Device files and their associated directories table shows some examples of
naming conventions, along with their applications.

Device files and their associated directories


Naming
Application
Convention
/dev General directory that contains all device files for all peripherals
/dev/dsk General directory that contains all block device files for all hard disk and/or
their individual logical partitions
/dev/rdsk General directory that contains all character device files for all hard disk
and/or their individual logical partitions
/dev/vgn General directory that contains all device files for a volume group
/dev/vgn/lvoln General directory that contains the entire block device files for logical volumes
in a volume group

UNIX Self Study Guide


20
Self Study Guide

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.

Examples of the two device files a hard disk may have


Naming Convention Description
/dev/dsk/c3t5d0 Hard disk with block type device file
/dev/dsk/c0t0d0 Hard disk with character type device file

UNIX Self Study Guide


21
1 Overview of UNIX

Lesson 3
Navigation

Lesson Overview
This lesson consists of the following topics:
Navigating the UNIX File System
Path names
Special Directories
Basic Commands

Navigating the UNIX File System


A UNIX file system hierarchy provides an easy, effective mechanism to organize
files. Since a UNIX system distribution normally contains hundreds of files and
programs, a hierarchy convention has been defined so that every UNIX System
supports a similar directory layout. The top of the hierarchy is referred to as the root
directory. It is denoted with a single forward slash (/).

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.

UNIX Self Study Guide


22
Self Study Guide

Navigating File System

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

UNIX Self Study Guide


23
1 Overview of UNIX

Relative Path Name


Always starts at current location in the hierarchy
Will never start with a /
Is unique relative to current location only
Is often shorter than the absolute path name

It is important to know the current directory when accessing files with


relative path names to ensure access of the correct file. If files with the
same name exist in more than one directory on the file system the
wrong file may be accessed.

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

UNIX Self Study Guide


24
Self Study Guide

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.

Switch User 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.

UNIX Self Study Guide


25
1 Overview of UNIX

Present Working Directory Command

The Short List Command figure demonstrates the use of the ls command.

Short List Command

The Long List Command figure demonstrates the use of the ll command.

Long List Command

The Change Directory Command figure demonstrates the use of the cd command.

Change Directory Command

The Create Directory Command figure demonstrates the use of the mkdir
command.

Directory ADAM
created under dat1a

Create Directory Command

The Remove or Delete Command figure demonstrates the use of the rm command.

UNIX Self Study Guide


26
Self Study Guide

Remove or Delete Command

The Move or Rename Command figure demonstrates the use of the mv command.

Move or Rename Command

The Make a Copy Command figure demonstrates the use of the cp command.

Make a Copy Command

UNIX Self Study Guide


27
1 Overview of UNIX

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.

UNIX Self Study Guide


28
Self Study Guide

Module Review Questions


1. What are the types of file systems recognized in UNIX?
(Select all that apply)

a. Network File Systems


b. CD-ROM File Systems
c. Low-Performance File Systems
d. High-Performance File Systems

2. In the command line “dev0: /WORK $ bdf”, match the items and their
description:

A. dev0 current directory


B. bdf hostname
C. /WORK no argument
D. argument command

3. In the string /dev/vg03/lvol1, what is the logical volume?

4. True/False. The host name identifies your system on the LAN.

a. True
b. False

5. Which command is used to determine the hostname?

UNIX Self Study Guide


29
1 Overview of UNIX

UNIX Self Study Guide


30
Self Study Guide

Module 2
Advanced UNIX Applications

Upon the completion of 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

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

UNIX Self Study Guide


31
2 Advanced UNIX Applications

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 (/)

User cls2 ($) is not the same thing as /cls2 directory

Logging in as a certain user does not put the operator in that particular
directory.

Levels and Types of Access Permissions


Owner, Group, and Other are the three levels of access permissions a file or a
directory in the UNIX system can have; details are shown in the Access
Permissions table.

UNIX Self Study Guide


32
Self Study Guide

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:

Access Symbolic and Numeric Notations


Read (r) = 4
Write (w) = 2
Execute (x) = 1

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.

UNIX Self Study Guide


33
2 Advanced UNIX Applications

Result of the Long List Command

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

The chmod command is used to change the permissions of a file or directory.


Permissions can only be changed by the file’s owner (or root – the system
administrator). Therefore, in the UNIX system, access to a file is generally the
responsibility its owner, as opposed to the system manager.

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.

UNIX Self Study Guide


34
Self Study Guide

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.

UNIX Self Study Guide


35
2 Advanced UNIX Applications

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.

Mounting Command Line:


Syntax: mount (device file) (mounting directory)
Example: $ mount /dev/dsk/c2t1d0 /dat1a

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 command is umount and not “unmount”.

UNIX Self Study Guide


36
Self Study Guide

Device Mount/Unmount Process and Examples

Example of Mounting a File System Using the Command


Line
$ mount /dev/vg00/lvol5/home

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

cls etc home dat1a

lvol5
Mounting the lvol5 Partition to a
Mount Point Called home

Mounting a Hard Drive Partition

While working in the directory that is the desired mount point, the system will not
allow mounting. An error message will be returned.

A file system cannot be mounted to the current working directory.

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.

UNIX Self Study Guide


37
2 Advanced UNIX Applications

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.

Screenshot of the Mount GUI

Never edit the fstab manually. Always use the mount GUI.

UNIX Self Study Guide


38
Self Study Guide

Mount/Unmount Graphical User Interface (GUI)


To mount using the GUI, left-click on a blank space anywhere
on the desktop, which will launch the Root Window Menu.

Select System Utilities and then Mount File System, which


will launch the Mount Type Select window as shown in the
Mount Type Select figure. Here the user can choose the option
of mounting a Hard Disk or CD/DVD ROM, which can be on
either the local computer or another computer connected in the
network.

In the example shown in the CDFS Mount figure, the mount of a


local CD ROM will be performed. After selecting remote or local
CD ROM, the window will appear. In UNIX, the CD/DVD drive
needs to be mounted every time the CD/DVD ROM has to be
read and it has to be unmounted when it needs to be ejected.
The user cannot mount a blank CD/DVD ROM.

To mount the DVD, select LOCAL CD/DVD option in the


Mount Type Select window, which will launch the window Root Window Menu
where the user may enter the directory name. In this case it
is /cdrom for CD/DVD.

Mount Type Select

CDFS MOUNT

Once successfully mounted, the system generates a message confirming the


successful mounting operation, as shown in the Mount Operation Successful figure.

UNIX Self Study Guide


39
2 Advanced UNIX Applications

Mount Operation Successful

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

Once successfully unmounted, the system generates a message confirming the


successful unmounting operation, as shown in the Unmount Successful figure. The
files in that directory will not be available until remounted again.

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.

UNIX Self Study Guide


40
Self Study Guide

bdf Command

Monitoring Available Disk Space


One of the responsibilities of an ECLIPS engineer is to ensure enough disk space
is available to record the interval required by the customer before entering the
record mode. If not, the engineer must have a plan for data management prior to
the job commencing.

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

UNIX Self Study Guide


41
2 Advanced UNIX Applications

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

Local Area Network


A Local Area Network (LAN) is a method of connecting two or more computer
systems over a small area. Most installations that have one or more computers will
install a LAN to allow the users to work on several different computers without
physically picking up all of their work and moving it to the new computer. The Local
Area Network figure illustrates devices connected through a LAN.

Devices off network LAN

HUB
Jet Direct BOX 4-ch wsp

esp

rap
Plotter 1

Plotter 2 cpu

Local Area Network

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.

UNIX Self Study Guide


42
Self Study Guide

Syntax: $ping <hostname or ipaddress>

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’.

Hosts File Example

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.

Network Connectivity Check Example

Logging in to a Remote Unit


To be logged in automatically to the system named hostname, the user should use
the command $ rlogin hostname.

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).

UNIX Self Study Guide


43
2 Advanced UNIX Applications

Network Connectivity Using rlogin Command

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

UNIX Self Study Guide


44
Self Study Guide

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

UNIX Self Study Guide


45
2 Advanced UNIX Applications

Module Review Questions


1. Which command is used to change ownership of a file?

a. chmod
b. chgrp
c. chown
d. chowner

2. How do you access “Root Window Menu"?

a. Right click on a blank space.


b. By Default the Menu is available at login.
c. Left click on a blank space.
d. None of the above

3. Which command is used check the network connectivity between two network
devices?

a. rcp
b. hello
c. rlogin
d. ping

UNIX Self Study Guide


46
Self Study Guide

Appendix

Course Summary

Course Review Activity

UNIX Practical Exercise


UNIX Practical Exercise
This UNIX assignment will help you to:
Become familiar with the UNIX commands
Perform some activities which are routinely performed in ECLIPS by a field
engineer
Follow these rules:
Remember UNIX is case and space sensitive.
Perform this assignment in a UNIX machine at your location (lab system or a
log in unit).
Bring the completed assignment to the wireline academy for discussion.
Login as “cls2”
Password is “cls262” (Ask the maintenance lab for the latest password)

Use the appropriate UNIX commands to complete these steps.

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.

UNIX Self Study Guide


47
Course Summary

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?

UNIX Self Study Guide


48
Self Study Guide

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:

Use the basic navigation commands of the UNIX system.

Apply the advanced UNIX applications, including mounting /unmounting


devices, setting permissions , and remotely accessing.

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."

UNIX Self Study Guide


49
Course Summary

UNIX Self Study Guide


50

You might also like