0% found this document useful (0 votes)
10 views75 pages

Base Linux 1

This document serves as a transcript for a training course on Linux, covering topics such as the origins of Linux, navigation within the Linux OS, and file management. It emphasizes the importance of using the correct commands and understanding the Linux file system structure. The document is intended for internal reference only and requires viewing the course in the ALP for full training and record updates.

Uploaded by

Leah Teng
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
10 views75 pages

Base Linux 1

This document serves as a transcript for a training course on Linux, covering topics such as the origins of Linux, navigation within the Linux OS, and file management. It emphasizes the importance of using the correct commands and understanding the Linux file system structure. The document is intended for internal reference only and requires viewing the course in the ALP for full training and record updates.

Uploaded by

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

NOTE: This document functions as a transcript/reference only.

To receive full training


and have your training record updated, you must view the course in the ALP.

Base Linux 1

1.1 Welcome

1.2 Menu

Notes:
Intended for Internal Service for reference purposes only.

Published by Articulate® Storyline www.articulate.com


NOTE: This document functions as a transcript/reference only. To receive full training
and have your training record updated, you must view the course in the ALP.
Welcome to this training. Our goal is to provide you with information about ...
Introduction to Origins of Linux,
Navigation in Linux OS
Listing and Viewing a File
Critical Files
File Permissions
Creating and Editing Files
In addition to the content, you'll also be asked a few questions to check your
knowledge along the way.
This Main Menu is your guide to select where you wish to go with your
learning. You can Select each chapter to go over the content and then the
quiz afterwards OR you can only choose the Content or only the Quiz if you
know the information but wish to test your comprehension.
You can navigate buy using the Menu on your left. The notes will provide you
with speaker notes of what the audio is saying. The glossary will provide you
with a description of certain words from the course.
Also good to know, there are tabs at the top of the screen - a resources tab
that provides a transcript and any other relevant information, an Author tab
that lists the author and contact details - just in case you have questions, and
also Help and Exit tabs.
Click on a section to get started!

Intended for Internal Service for reference purposes only.

Published by Articulate® Storyline www.articulate.com


NOTE: This document functions as a transcript/reference only. To receive full training
and have your training record updated, you must view the course in the ALP.

2. Introduction to Linux

2.1 Introduction to Origins of Linux

Notes:

In the introduction to Origins of Linux section we will discuss the following:


- Linux Creation
- Linux Versions
and Linux version in Enterprise Imaging 8.1

Intended for Internal Service for reference purposes only.

Published by Articulate® Storyline www.articulate.com


NOTE: This document functions as a transcript/reference only. To receive full training
and have your training record updated, you must view the course in the ALP.
2.2 Linux Creation

Notes:

Was Initially written in 1991 by Linus Torvalds. Linux was created from ground up as an
open source operating system. Being Linux is Open source, that allowed various groups
to create their own versions. Linux is not another type or flavor of UNIX. Although it does
share a good deal of UNIX files and command structure. Many of the commands that we
will be learning are applicable in a UNIX (Solaris) environment.

Intended for Internal Service for reference purposes only.

Published by Articulate® Storyline www.articulate.com


NOTE: This document functions as a transcript/reference only. To receive full training
and have your training record updated, you must view the course in the ALP.
2.3 Linus Creation

Notes:

When we use the term “Open Source” what does that REALLY mean? In most cases, it
means you can view the source code but you are not free to modify.
Also, In most cases, Open Source does NOT mean free.
- You have to pay up front in some manner
- Pay for Service Contract
- and Usually its’ free for personal, non commercial use

Intended for Internal Service for reference purposes only.

Published by Articulate® Storyline www.articulate.com


NOTE: This document functions as a transcript/reference only. To receive full training
and have your training record updated, you must view the course in the ALP.
2.4 Linux Versions

Notes:

We had mentioned there are different flavors of Linux, much in the same way there are
different flavors or versions of UNIX
The different vendors had different goals in mind with their versions:
- Red Hat offers Enterprise Support
- and Trustix is very secure

Intended for Internal Service for reference purposes only.

Published by Articulate® Storyline www.articulate.com


NOTE: This document functions as a transcript/reference only. To receive full training
and have your training record updated, you must view the course in the ALP.
2.5 Linux in Enterprise Imaging

Notes:

As noted, Linux is NOT another flavor of UNIX. However, as indicated throughout this
course, most of the commands and tools you will learn to use will work in a Solaris
environment just as well as they do in a Linux environment. As we’ll see, there are far
more similarities than differences. As of Enterprise Imaging 8.1, Enterprise Imaging
Database servers can run on Oracle Enterprise Linux 6.8 (OEL 6.8) which is the
Operating System of choice. OEL 6.8 is the latest release of distribution's legacy branch
based on Red Hat Enterprise Linux 6.8. OEL is an enterprise-class Linux distribution
supported by Oracle and is fully compatible with Red Hat Enterprise Linux.

Intended for Internal Service for reference purposes only.

Published by Articulate® Storyline www.articulate.com


NOTE: This document functions as a transcript/reference only. To receive full training
and have your training record updated, you must view the course in the ALP.

3. Navigation in Linux OS

3.1 Navigation in Linux OS

Notes:

In Navigating in Linux OS section we will discuss the following:


- Putty
- Prompts
- Root Directory
- Home Directory
- Present Working Directory
- Navigating Linux File System
- Listing File and Directory Contents
- Viewing a File
- Available Resources
- such as Man pages
- Top command
- and Checking Disk Space Usage

Intended for Internal Service for reference purposes only.

Published by Articulate® Storyline www.articulate.com


NOTE: This document functions as a transcript/reference only. To receive full training
and have your training record updated, you must view the course in the ALP.
3.2 Exploring Linux via Command Line - Putty

Notes:

Putty is the tool we’ll most often use to interface with Linux Servers. Putty is a
free, downloadable terminal emulation program used to navigate from pc to Linux
server. It supports several network protocols, including SCP, SSH, Telnet, rlogin,
and raw socket connection. We’ll make use of a SSH connection. As we can see,
we have the putty icon on our desktop. Double clicking the putty icon will open up
the Putty configuration page. We can enter either the Host Name (if we have
DNS enabled locally ) or the IP address of the server we want to navigate to. We
want to be sure that we have chosen SSH as the Connection Type. We also
have the option to define the IP and “Save” the entry for ease of use. We’ll
access the entry for my database server below….highlight the entry, click load
and then click open. That opens a terminal screen on the Linux server in
question. And you see that we’ve logged into our server. That’s how we use putty
as a means of accessing either a Linux or Solaris server

Intended for Internal Service for reference purposes only.

Published by Articulate® Storyline www.articulate.com


NOTE: This document functions as a transcript/reference only. To receive full training
and have your training record updated, you must view the course in the ALP.
3.3 Prompts

Notes:

Which user you are currently logged in as ( root or oracle ) will be directly expressed
through the type of symbol that accompanies command line prompt.
Users current present working directory will also be incorporated into prompt.
- Logged in as root - # sign.
- Logged in as any other user - $ sign.
Tildy is indicative of a users home directory - Both cases we see the tildy in the prompt
which indicates the users home directory. In the screen capture, via the command
whoami, we see that we are currently logged in as root. And as noted, the prompt is
denoted with a # sign, signifying root user. We can switch user to the oracle user: su -
oracle (more on that later). Once again use the whoami to verify the current user -
oracle. And we see as noted earlier that the prompt is a $ sign rather than a # sign. This
is very significant due to the fact that when you are logged in a root user, you have
complete access and control of the system. Mistakes made as root user can result in
serious loss of data. Golden Rule # 1 - Never su to root unless you absolutely
need to be root

Intended for Internal Service for reference purposes only.

Published by Articulate® Storyline www.articulate.com


NOTE: This document functions as a transcript/reference only. To receive full training
and have your training record updated, you must view the course in the ALP.
3.4 Linux File System

Notes:

Here is a generic look at the Linux file structure. Linux file system starts with /,
the root directory. All other directories are 'children' of this directory.
Critical second level directories include, but are not limited to:
/bin /etc /usr /var /sbin /dev /tmp /lib /boot and /opt
Hover over the purple directories for it’s definition.

Intended for Internal Service for reference purposes only.

Published by Articulate® Storyline www.articulate.com


NOTE: This document functions as a transcript/reference only. To receive full training
and have your training record updated, you must view the course in the ALP.
/opt (Slide Layer)

3.5 Root Directory

Notes:

Root user account is comparable to the administrator user in Windows. Once logged into
a server as root, you have complete access.
Root Home Directory (/root)
Intended for Internal Service for reference purposes only.

Published by Articulate® Storyline www.articulate.com


NOTE: This document functions as a transcript/reference only. To receive full training
and have your training record updated, you must view the course in the ALP.
A Home directory (aka login directory) is the directory that serves as the repository for a
user's personal files (including configuration files), directories and programs. It’s also
the first directory the user logs into the system.
The first line, via the whoami command, we see that we are logged in as the root user.
The second line, via the pwd command, (present working directory) we see that we are
currently located in /root (slash root), roots home directory. On the third line we see that
cd (change directory) is to root and that we are now located in the root directory, at the
very top of the Linux file structure. To recap, we explained what is the root user. We
showed you where the home directory is located and the physical location of slash root.

3.6 Changing Directories

Notes:

cd (change directory) is a command that is used to change from our current directory to
another directory.
Please click on the cd's syntax to find out . Items in square brackets are optional.
- cd .. This command brings you back one directory
- cd ~ This command returns user to home directory

Intended for Internal Service for reference purposes only.

Published by Articulate® Storyline www.articulate.com


NOTE: This document functions as a transcript/reference only. To receive full training
and have your training record updated, you must view the course in the ALP.
3.7 Home Directory

Notes:

When you log into a Linux server with a specific login, you're placed in a directory called
the home directory for that specific user. Every user within Linux has a home directory.
So no matter where you are in the file structure, by typing: cd ~ or cd. This will bring you
back to home directory of your current user. The symbol ~ (Tildy) is indicative of the
users home directory.
As noted the command pwd (present working directory) reflects our current location the
directory structure. Upon login, we are located in the home directory of the user that we
logged in with. In this case it’s the root directory. This is denoted by the location, but
also by the tildy (~) symbol in the prompt

Intended for Internal Service for reference purposes only.

Published by Articulate® Storyline www.articulate.com


NOTE: This document functions as a transcript/reference only. To receive full training
and have your training record updated, you must view the course in the ALP.
3.8 Present Working Directory (PWD)

Notes:

The pwd Command returns your working directory (sometimes called your current
working directory or present working directory). Pwd is the directory you're currently
working in. At the start of every session, your home directory is your working directory.
You may change to another directory, in which case the directory you move to becomes
your present working directory.
As noted the command pwd (present working directory) reflects our current location the
directory structure. Upon login, we are located in the home directory of the user that we
logged in with. In this case it’s roots home directory.
When we type cd / , we navigate from root’s home directory to the base of the Linux file
system. We can see the actual root directory when we type pwd and we can also see
that reflected in the prompt.
As we noted earlier the cd command stands for change directory. When we type cd
/etc/opt - we navigate to the /etc/opt directory. As we talked about earlier….typing cd ..
Will bring me back one directory. And as we mentioned as well…..when we type cd by
itself (or cd ~) that will bring us back to that users home directory.

Intended for Internal Service for reference purposes only.

Published by Articulate® Storyline www.articulate.com


NOTE: This document functions as a transcript/reference only. To receive full training
and have your training record updated, you must view the course in the ALP.
3.9 Navigating Linux File System

Notes:

An absolute pathname defines a path of directories to get from root to the directory or
file you want. When specifying an absolute path, we begin the path name with a slash
(/). Signifying that you will start from the root directory
A relative pathname gives a location relative to your present working directory. Unless
you use an absolute pathname (starting with a slash), Linux assumes that you're using a
relative pathname. Like absolute pathnames, relative pathnames can go through more
than one directory level by naming directories along the path.
One of the more critical components to navigating through a Linux or Solaris file
structure is understanding the difference between using an absolute pathname vs a
relative path name.
As we noted before, / is indicative of the root directory, so when we include a slash in
our navigation path, we are starting from root and working our way down the directory
structure.
So in this example, I need to move to /etc/opt directory. We type: cd /etc/opt and
that would get us to the correct location.
However if I’m already in /etc and easier way, with slightly less typing would be to use
the relative path to opt. With the term meaning navigation is relative to my current or
pwd. We’ve seen that cd .. command will take me back one directory. So we can type
cd opt and navigate to /etc/opt via a relative path.
A fairly common mistake that people new to Linux or Solaris make is including the /
when its not wanted or needed. As we see, if I include a / preceding opt, that would take
you to a completely different directory. To recap. When using an Absolute path, I begin
Intended for Internal Service for reference purposes only.

Published by Articulate® Storyline www.articulate.com


NOTE: This document functions as a transcript/reference only. To receive full training
and have your training record updated, you must view the course in the ALP.
my navigating from root and must spell out each directory along the directory tree. When
using a relative path, its relative to my current location (pwd)

3.10 Terminal Windows

Notes:

When we use su, telnet, ssh or do a variety of commands, we fork to a new shell. A fork
in a multithreading environment means that a thread of execution is duplicated, creating
a child thread from the parent thread. A bit like stepping through a door, we have the
ability to back out gracefully by typing exit.
Using the whoami command, we see that we are currently logged in as root. Using the
su - oracle command, we switch users from root to oracle. But we also “Fork” to another
thread. When we type exit, we exit the current thread and step back to our original
terminal window. We see we’re back at user root, without having to switch users.

Intended for Internal Service for reference purposes only.

Published by Articulate® Storyline www.articulate.com


NOTE: This document functions as a transcript/reference only. To receive full training
and have your training record updated, you must view the course in the ALP.
3.11 Capitalization in Linux

Notes:

Windows does not discriminate between upper and lower case. The only exception is
passwords. Linux was created by and for computer experts. In Linux, upper and lower
case makes a huge difference. Each ASCI character is a separate entity. Usernames,
passwords, file names and folder/directory names are case sensitive. Please see the
slide for the different variations.

Intended for Internal Service for reference purposes only.

Published by Articulate® Storyline www.articulate.com


NOTE: This document functions as a transcript/reference only. To receive full training
and have your training record updated, you must view the course in the ALP.
3.12 Man pages

Notes:

A man page (short for manual page) is a form of online software documentation usually
found on a Unix or Linux operating system.
Topics covered include computer programs, specific commands and their associated
arguments.
You type man space the command in question. In this example it's the command ping

Intended for Internal Service for reference purposes only.

Published by Articulate® Storyline www.articulate.com


NOTE: This document functions as a transcript/reference only. To receive full training
and have your training record updated, you must view the course in the ALP.
3.13 Command Summary

Notes:

Here are is a command summary for navigating in Linux OS. Click on the commands to
obtain a full description.

Intended for Internal Service for reference purposes only.

Published by Articulate® Storyline www.articulate.com


NOTE: This document functions as a transcript/reference only. To receive full training
and have your training record updated, you must view the course in the ALP.

4. Listing and Viewing a File

4.1 Introduction to Linux

Notes:

In Listing and Viewing a file section we will discuss the following:


- Listing File and Directory Contents
- Viewing a File
- Available Resources
- Top command
- Checking Disk Space Usage
- and Man pages

Intended for Internal Service for reference purposes only.

Published by Articulate® Storyline www.articulate.com


NOTE: This document functions as a transcript/reference only. To receive full training
and have your training record updated, you must view the course in the ALP.
4.2 Listing Files

4.3 Long Listing: $ ls - l

Notes:

Typing ls -l will provide long format output, please click on each listing to get the full
description:

Intended for Internal Service for reference purposes only.

Published by Articulate® Storyline www.articulate.com


NOTE: This document functions as a transcript/reference only. To receive full training
and have your training record updated, you must view the course in the ALP.

4.4 Common options with ls (list)

Notes:

(first images goes here) Shown on this slide are 12 common uses and variations
of the ls or list commands.

***Running the command ls will give us a simple listing of the names of the files and
sub-directories in the current directory.

Running the command ls -l will provide us with a long listing of the files and sub-
directories in the current directory.

The initial letter or symbol denotes the type of entity it is, usually a dash for a file or a d
for directory.

The next 9 letters denotes the permission set for the file or directory.

R for read permissions, W - for write permissions and X - for executable permissions.

We’ll be diving deeper into permissions shortly. This denotes the owner of the directory
Intended for Internal Service for reference purposes only.

Published by Articulate® Storyline www.articulate.com


NOTE: This document functions as a transcript/reference only. To receive full training
and have your training record updated, you must view the course in the ALP.
(or file).

This denotes the group that has been granted permissions to the directory or file.

We see the last date and time the file or directory was modified. We see the name of the
directory (or file).

4.5 Viewing a File

Notes:

cat [options] [files]


Cat can read one or more files and print them to the monitor. It will scroll whole file to
screen. Cat can be useful if you want to output the contents to a file for some use. We
would incorporate the pipe command for that use.

Intended for Internal Service for reference purposes only.

Published by Articulate® Storyline www.articulate.com


NOTE: This document functions as a transcript/reference only. To receive full training
and have your training record updated, you must view the course in the ALP.
4.6 Viewing a File

Notes:

more [options] [files]


This displays a file on a monitor, one screen at a time.
Here is how you would navigate through the file:
- click on Enter key to display the next line
- Then click on Spacebar to display the next screen.
- /<string>(slash string) to search for a word or string of characters
- n to go to the next instance of that word
- B to go back to the previous instance
- q to quit
- Press h for help with additional commands
We can always invoke the man pages for a particular topic if we need more information.

Intended for Internal Service for reference purposes only.

Published by Articulate® Storyline www.articulate.com


NOTE: This document functions as a transcript/reference only. To receive full training
and have your training record updated, you must view the course in the ALP.
4.7 Viewing a File

Notes:

less [options] [files]


This displays a file on a monitor, one screen at a time. Similar to the more command,
but with a better search feature.
Here is how you would navigate through the file:
- The Enter key is to display the next line
- Spacebar is to display the next screen.
- /<string>(slash string) to search for a word or string of characters
- Each instance of the word will be highlighted
- n to go to the next instance of that word
- B to go back to the previous instance
- q to quit
- Press h for help with additional commands

Intended for Internal Service for reference purposes only.

Published by Articulate® Storyline www.articulate.com


NOTE: This document functions as a transcript/reference only. To receive full training
and have your training record updated, you must view the course in the ALP.
4.8 Viewing a File

Notes:

head [options] [files]


The head command shows the first few lines of one or more files (the default is
10). You can specify the number of lines to be displayed.
tail [options] [file]
The tail command shows the last ten lines of the named file. You can specify the
number of lines to be displayed.
tail -f [file]
The tail -f command allows you to view the file real time. This is an excellent way
to track contents of a log file real time.

Intended for Internal Service for reference purposes only.

Published by Articulate® Storyline www.articulate.com


NOTE: This document functions as a transcript/reference only. To receive full training
and have your training record updated, you must view the course in the ALP.
4.9 Viewing a File

Notes:

The cat command will dump the entire file to the screen. The command is useful if you
are viewing a smaller file, or you want to use the output from a file. The more command
allows us to view a file and then page through if the output is too large for the screen. To
exit the screen type q to quit. The more command also allows us to search through the
file for a particular word or string of characters. We initiate the search via a forward slash
followed immediately by the string we are looking for. The less command works pretty
much the same way as the more command. The major advantage is that when we
initiate search, the search will actually highlight each time the search string is found. We
had initiated the search the same way we did with the more command, but with the less
command, each entry we search for is highlighted. The head command shows me (by
default) the 1st ten lines of a file. I can specify the number of lines to see. Conversely, the
tail command will show me the last lines in a file. Very useful for checking on the
successful completion of a command, say database backup.

Intended for Internal Service for reference purposes only.

Published by Articulate® Storyline www.articulate.com


NOTE: This document functions as a transcript/reference only. To receive full training
and have your training record updated, you must view the course in the ALP.
4.10 Top Command

Notes:

The top command provides an ongoing look at processor activity in real time. It
displays a listing of most CPU-intensive tasks on the system and can provide an
interactive interface for manipulating processes. The top command sorts the tasks by
CPU , memory and runtime usage.

Intended for Internal Service for reference purposes only.

Published by Articulate® Storyline www.articulate.com


NOTE: This document functions as a transcript/reference only. To receive full training
and have your training record updated, you must view the course in the ALP.
4.11 Current Space Utilization

Notes:

The df space dash h command reports the number of free disk blocks and inodes
available on all mounted file systems or on the given name. Besides the options listed,
there are additional options specific to different file system types or df Chapters.
du -h
The du command reports the sizes of directory trees including all of their contents and
the sizes of individual files. This command is very useful when tracking down space
hogs

Intended for Internal Service for reference purposes only.

Published by Articulate® Storyline www.articulate.com


NOTE: This document functions as a transcript/reference only. To receive full training
and have your training record updated, you must view the course in the ALP.
4.12 Current Space Utilization

Notes:

lsblk command displays a list of available block devices. Here are a few displays of the
ls block command, hover over them to see the block devices.

Intended for Internal Service for reference purposes only.

Published by Articulate® Storyline www.articulate.com


NOTE: This document functions as a transcript/reference only. To receive full training
and have your training record updated, you must view the course in the ALP.
4.13 Current Space Utilization

Notes:

Df -h shows you all of the currently mounted file systems, their size, amount of space
used, amount of space available, percentage of used space as well as the mount point
for the file system. Once you identified a file system that may be hogging space, you can
use du -h to further identify which directory in the file system may be the culprit. ls block
command gives you a different perspective on the current disk space usage.

Intended for Internal Service for reference purposes only.

Published by Articulate® Storyline www.articulate.com


NOTE: This document functions as a transcript/reference only. To receive full training
and have your training record updated, you must view the course in the ALP.
4.14 Command Summary

Notes:

Here is a command summary for Listing and viewing a file. Click on the commands to
obtain a full description.

Intended for Internal Service for reference purposes only.

Published by Articulate® Storyline www.articulate.com


NOTE: This document functions as a transcript/reference only. To receive full training
and have your training record updated, you must view the course in the ALP.

5. Critical Files

5.1 Critical Files - Agenda

Notes:

In Critical Files section we will discuss the following:


- Critical System Files
-/etc/hosts
-/etc/fstab
- Critical Log Files
- /var/log
- Bash Shell
- Keyboard Shortcuts (Tab Key)
- History
- Alias
- Environmental variables
- PATH
- SHELL

Intended for Internal Service for reference purposes only.

Published by Articulate® Storyline www.articulate.com


NOTE: This document functions as a transcript/reference only. To receive full training
and have your training record updated, you must view the course in the ALP.
5.2 Critical Systems Files

Notes:

As your machine gets started, it will need to know the mapping of some hostnames to IP
addresses before DNS can be referenced. This mapping is kept in the /etc/hosts file. In
the absence of a name server, any network program on your system consults this file to
determine the IP address that corresponds to a host name. IP to host name translation.

Intended for Internal Service for reference purposes only.

Published by Articulate® Storyline www.articulate.com


NOTE: This document functions as a transcript/reference only. To receive full training
and have your training record updated, you must view the course in the ALP.
5.3 Critical Systems Files

Notes:

/etc/fstab file contains information of where your partitions and storage


devices should be mounted and how. fs-tab is a plain text file, so we can edit it
with the text editor of our choice. The file is owned by root, so to edit the file, we
must log in as root or use the su command to become root.

Intended for Internal Service for reference purposes only.

Published by Articulate® Storyline www.articulate.com


NOTE: This document functions as a transcript/reference only. To receive full training
and have your training record updated, you must view the course in the ALP.
5.4 Critical Log Files

Notes:

/var/log contains more than 20 different critical log files.


/var/log/messages contains global system messages, including messages that are
logged during system startup. Here are a few items logged in messages: mail, cron,
daemon, kern, auth, etc.
For /var/log/dmesg when the system boots up, it prints a number of messages on the
screen that displays information about the hardware devices that the kernel detects
during boot process.

Intended for Internal Service for reference purposes only.

Published by Articulate® Storyline www.articulate.com


NOTE: This document functions as a transcript/reference only. To receive full training
and have your training record updated, you must view the course in the ALP.
5.5 Critical Log Files

Notes:

/var/log/yum.log contains information that are logged when a package is installed using
yum.
/var/log/cron Whenever a job, kicked off in cron runs it logs the information about that
cron job in this file.
/var/log/sssd is used by system security services daemon that manage access to
remote directories and authentication mechanisms.

Intended for Internal Service for reference purposes only.

Published by Articulate® Storyline www.articulate.com


NOTE: This document functions as a transcript/reference only. To receive full training
and have your training record updated, you must view the course in the ALP.
5.6 Bash Shell

Notes:

Linux shell programs interprets user commands: Entered by a user or read from
a file. Main task of a shell is providing a user environment, which can be
configured individually using shell resource configuration files. There are various
types of shells, with the Bash Shell being the most user friendly and flexible. To
determine the current shell, type: echo $SHELL. We see that the default shell is
bash shell.

Intended for Internal Service for reference purposes only.

Published by Articulate® Storyline www.articulate.com


NOTE: This document functions as a transcript/reference only. To receive full training
and have your training record updated, you must view the course in the ALP.
5.7 Useful Bash Shell Commands

Notes:

Typing the word history will return a list of the previously run commands. Use the up
and down arrow key's to scroll through previously typed commands. Press [Enter] to
execute them or use the left and right arrow keys to edit the command first.

Intended for Internal Service for reference purposes only.

Published by Articulate® Storyline www.articulate.com


NOTE: This document functions as a transcript/reference only. To receive full training
and have your training record updated, you must view the course in the ALP.
5.8 Useful Bash Shell Commands

Notes:

Tab Completion
Use Using the TAB key and bash will attempt to complete the command for you
automatically. It can be used to complete command (tool) names. Can also use
it when working with the file-system, changing directories, copying files, etc.

Intended for Internal Service for reference purposes only.

Published by Articulate® Storyline www.articulate.com


NOTE: This document functions as a transcript/reference only. To receive full training
and have your training record updated, you must view the course in the ALP.
5.9 Useful BASH Shell Commands

Notes:

The alias command will list your current aliases. An alias command allows one
command to be substituted for another. It’s used to make a command do something
else or to automatically add certain options. This command can be run during one
session using alias command or information can be added to .bashrc file. The .bashrc
file is found in users home directory.

Intended for Internal Service for reference purposes only.

Published by Articulate® Storyline www.articulate.com


NOTE: This document functions as a transcript/reference only. To receive full training
and have your training record updated, you must view the course in the ALP.
5.10 Environmental Variables

Notes:

When you start a program in Linux a new process is created. The process runs within
what is called an environment. That environment has certain characteristics which the
program/process interacts with. Every program runs in its own environment.
Environment parameters can be set so that the running program can find the desired
values when it runs. Environmental variables contain certain settings that various shells
can use. Variables are defined for current shell and are inherited by any child shells or
processes. They are used to pass information into processes that are spawned from the
shell.
All current environmental variables and their values can be seen by running the env
command without any options or commands. Permanent variables are defined within the
./bashrc file.

Intended for Internal Service for reference purposes only.

Published by Articulate® Storyline www.articulate.com


NOTE: This document functions as a transcript/reference only. To receive full training
and have your training record updated, you must view the course in the ALP.
5.11 Environmental Variables

Notes:

PATH is an Environmental variable that tells shell which directories to search for
executable files in response to commands issued by a user.
The command to display the path variable is echo $PATH.
SHELL defines the default shell for the current environment. The command for SHELL
is: echo $SHELL.
PS1 defines a shell prompt. By default, bash shell prompt is ' $ ‘. The command for
PS1 is: echo $PS1.

Intended for Internal Service for reference purposes only.

Published by Articulate® Storyline www.articulate.com


NOTE: This document functions as a transcript/reference only. To receive full training
and have your training record updated, you must view the course in the ALP.
5.12 Critical File Summary

Notes:

Here are is a command summary for the Critical File Summary. Click on the commands
to obtain a full description.

Intended for Internal Service for reference purposes only.

Published by Articulate® Storyline www.articulate.com


NOTE: This document functions as a transcript/reference only. To receive full training
and have your training record updated, you must view the course in the ALP.

6. File Permissions

6.1 File Permissions

Notes:

In the Files Permissions section we will discuss the following:


- Long Listing of Directory Contents
- File & Directory Permissions
- Changing permissions
- Changing owner
- Changing group
- Find a File
- SUDO
- Switching Users
- Searching a File - GREP
- Manipulating Files
- Copy
- Move
- Delete
- Rules to Live By
Intended for Internal Service for reference purposes only.

Published by Articulate® Storyline www.articulate.com


NOTE: This document functions as a transcript/reference only. To receive full training
and have your training record updated, you must view the course in the ALP.

6.2 Permissions

Notes:

Permissions control who can read, write (modify), or execute a file.


A permission string (rwx) is replicated three times:
- One set to define permissions for owner of a directory or file.
- One set to define permissions for the group associated with the directory or file.
- And One set to define permissions for everyone else.
We associate a value to the letter representation of the permission set in the following
way:
From a binary perspective, we define a numeric value to the place in the order of the
permission string: r w x
- Permission to read = 4
- Permission to Write = 2
- Permission to execute = 1

Intended for Internal Service for reference purposes only.

Published by Articulate® Storyline www.articulate.com


NOTE: This document functions as a transcript/reference only. To receive full training
and have your training record updated, you must view the course in the ALP.
6.3 Permissions

Notes:

Looking at the example below, get-server-status.sh has a permission string of rwxr-xr-


x (read,write,execute - read and execute and read and execute). A dash in
permission string indicates that permission has NOT been allocated. We can express
that permissions string, rwxr-xr-x(read,write,execute - read and execute and read
and execute), with a numerical value of 755.
As noted, the read permission has a numerical value of 4. the write permission has a
numerical value of 2. the execute permission has a numerical value of 1. The sum of
these is what defines the numerical permission value. The most common means of
changing a permission set is to reassign a new numerical value.

Intended for Internal Service for reference purposes only.

Published by Articulate® Storyline www.articulate.com


NOTE: This document functions as a transcript/reference only. To receive full training
and have your training record updated, you must view the course in the ALP.
6.4 Changing Permissions

Notes:

The chmod <permissions> <file name> command changes current permission set of a
file or directory. Particular care should be taken when a directory is the target because
the effect is not intuitive. In addition, it will not work on all file types. For example, it has
no effect on a symbolic link. chmod <permissions> followed by the <file name> Here
is an example $ chmod 744 myfile.
We build a directory within /root named jim.
Via an ls -l command we see that it is:
- a directory with the default permission set of rwxr-xr-x
- read, write and execute for the owner and read and execute for the group and
everyone else
- We associate a value to the letter representation of the permission set in the following
way
- From a binary perspective, we define a numeric value to the place in the order rwx
- Giving the right to read (R) = 4
- Giving the right to Write (W) = 2
- Giving the right to execute (X) = 1
So we can define a numeric value for each “section”. Owner, Group, Other.
Via the chmod 777 jim command, we change the permission set of the jim directory to
777. Read write and execute for everyone.
Via the chown (change own) command, we change the owner from root to oracle. Not
that you would have to be currently logged in as root to affect that change.

Intended for Internal Service for reference purposes only.

Published by Articulate® Storyline www.articulate.com


NOTE: This document functions as a transcript/reference only. To receive full training
and have your training record updated, you must view the course in the ALP.
6.5 Changing Owner / Group on a File

Notes:

The $ chown <new owner> <file name> command changes current owner of a file or
directory.
The $ chgrp <new group> <file name> command changes current group of a file or
directory.

Intended for Internal Service for reference purposes only.

Published by Articulate® Storyline www.articulate.com


NOTE: This document functions as a transcript/reference only. To receive full training
and have your training record updated, you must view the course in the ALP.
6.6 Find a File

Notes:

find the path name followed by a particular condition is a very useful command for
finding particular files. find works it’s way down the directory structure and locates files
that meet specified conditions. At least one pathname and one condition must be
specified. Most common conditions include -name and -type . Here are Some
Examples . In the example we are looking for the location of the control files. We’re
starting the search from root, searching by name. Using the star as a wild card in
conjunction with the suffix .ctl . The find command is a very powerful search tool. See
the man pages for all of the search options we can use with find.

Intended for Internal Service for reference purposes only.

Published by Articulate® Storyline www.articulate.com


NOTE: This document functions as a transcript/reference only. To receive full training
and have your training record updated, you must view the course in the ALP.
6.7 SUDO

Notes:

SUDO means Super User Do. Similar to Run as Administrator in Windows. It allows
various commands to be run with root privilege with having to actually become the root
user. hover over to see what The command is. The SUDO command allows the user to
restart the networking service (which is owned by root) without having to switch to the
root user.

Intended for Internal Service for reference purposes only.

Published by Articulate® Storyline www.articulate.com


NOTE: This document functions as a transcript/reference only. To receive full training
and have your training record updated, you must view the course in the ALP.
6.8 Switching Users (su -)

Notes:

Switch users (su) via the command su -. We pick up certain environmental elements
when we include a dash ( - ).
The command, su - oracle, will allow you to switch to oracle user. su - without a
designated user defaults to root user.
As we saw earlier in the course…..the whoami command returns to the current user.
Su - oracle allows us to switch users to oracle.

Intended for Internal Service for reference purposes only.

Published by Articulate® Storyline www.articulate.com


NOTE: This document functions as a transcript/reference only. To receive full training
and have your training record updated, you must view the course in the ALP.
6.9 Searching a File - GREP

Notes:

grep (globally search a regular expression & print) is a command line utility for
searching plain-text data sets for lines matching a regular expression. Search pattern
specified as an argument is case sensitive by default. Output can be viewed on the
screen or sent to a file. As you can see In this example, we are searching through the
daily incremental (L1) backup log file to confirm that the backup did successfully
complete. We had initially navigated to the location of the log file. Using the cat
command, we pipe (|) or push the output of the cat command to the grep command
The grep command reads through the entire messages file looking for lines with the
word complete. The -i makes the search case sensitive. In this example we then take the
output of the grep -i gets redirected to an output file we named backups. That output file
gets built dynamically in the local directory as long as you have permission to write in
that location.

Intended for Internal Service for reference purposes only.

Published by Articulate® Storyline www.articulate.com


NOTE: This document functions as a transcript/reference only. To receive full training
and have your training record updated, you must view the course in the ALP.
6.10 Copy a File

Notes:

cp [options] file1 file2 and cp [options] files directory. The cp command allows for a
copy of one file to another, for renaming. It also allows us to copy one or more files to
the same names under a specified directory. If destination is an existing file, the file is
overwritten. If destination is an existing directory, the file is copied into the specified
directory. Copy leaves the existing file in place. The Golden rule of editing critical
system files is that you always make a copy of that file PRIOR to making changes to that
file so that you can roll back to the original if needed. In this example, we made a copy of
the hosts table and stored it in /etc. We could have easily changed the storage location
of the file via the destination location. Once again keep in mind you have to have the
proper permissions to copy a file into the target directory. When logged in as root, you
have that permission.

Intended for Internal Service for reference purposes only.

Published by Articulate® Storyline www.articulate.com


NOTE: This document functions as a transcript/reference only. To receive full training
and have your training record updated, you must view the course in the ALP.
6.11 Copy a File

Notes:

Options
-i Prompt for confirmation (y for yes) before overwriting an existing file.
-p Preserve the modification time and permission modes for the copied file. (Normally
cp supplies the permissions of the invoking user.)
-r Allows you to copy recursively.
Hover over to see the example of the command for options. ALWAYS copy critical
system files BEFORE you edit them.

Intended for Internal Service for reference purposes only.

Published by Articulate® Storyline www.articulate.com


NOTE: This document functions as a transcript/reference only. To receive full training
and have your training record updated, you must view the course in the ALP.
6.12 Move a File

Notes:

mv [options] sources target


This Basic command is to move files and directories around on the system or to rename
them. Hover over to see the example of the mv command. It is NOT a good practice to
move (mv) critical systems files.

Intended for Internal Service for reference purposes only.

Published by Articulate® Storyline www.articulate.com


NOTE: This document functions as a transcript/reference only. To receive full training
and have your training record updated, you must view the course in the ALP.
6.13 Deleting a File

Notes:

rm <file name>
rm command deletes files or directories from file system. Deleting a file normally
requires write permission on parent directory. rm will not delete a directory structure that
is not empty. Hover over to see the example of the rm command
-f:(dash f) Forcefully removes file.
-r: (dash r) will Remove the contents of directories recursively.
Running the rm -r (rm dash r) (recursive) option is very powerful and potentially
dangerous. It will recursively delete the current directory and ALL child files and
directories.

Intended for Internal Service for reference purposes only.

Published by Articulate® Storyline www.articulate.com


NOTE: This document functions as a transcript/reference only. To receive full training
and have your training record updated, you must view the course in the ALP.
6.14 Deleting a File

Notes:

Flags can be set to force a check, but by default, Linux assumes that you KNOW what
you are deleting. There is no trash bin in Linux or Solaris.

Intended for Internal Service for reference purposes only.

Published by Articulate® Storyline www.articulate.com


NOTE: This document functions as a transcript/reference only. To receive full training
and have your training record updated, you must view the course in the ALP.
6.15 Rules to Live By

Notes:

Hare a some rules we’ve discussed in this course, please be aware that there are a
few new ones.
- Never login as root unless you have to
- After doing what you need to do as root, change back to your user
- Research commands before using them
- rm -r (rm space dash r) from the root will delete everything
- Before rebooting, make sure you are on the server you want to reboot
- Backup any configuration file before editing

Intended for Internal Service for reference purposes only.

Published by Articulate® Storyline www.articulate.com


NOTE: This document functions as a transcript/reference only. To receive full training
and have your training record updated, you must view the course in the ALP.
6.16 Command Summary

Notes:

Here are is a command summary for File Permissions. Click on the commands to obtain
a full description.

Intended for Internal Service for reference purposes only.

Published by Articulate® Storyline www.articulate.com


NOTE: This document functions as a transcript/reference only. To receive full training
and have your training record updated, you must view the course in the ALP.

7. Creating and Editing Files

7.1 Creating and Editing Files

Notes:

In the creating and Editing Files section we will discuss the following:
- Touch
- Introduction to VI
- Setting Environment in Putty
- Creating & Editing Files With VI
- Working in Command Mode
- Working in Insert Mode
- Changing Text
- Deleting Text
- Cutting & Pasting text
- and Saving & Quitting a File

Intended for Internal Service for reference purposes only.

Published by Articulate® Storyline www.articulate.com


NOTE: This document functions as a transcript/reference only. To receive full training
and have your training record updated, you must view the course in the ALP.
7.2 Creating a File

Notes:

touch [option] file_name(s)


When used without any arguments, touch creates new files for file name(s) that are
provided if files do not already exist. Touch can create any number of files
simultaneously. Touch can also be used to change timestamps on existing files and
directories. In this example, we are in the directory jim and that it is currently empty. As
noted the touch command can be used to create a single or multiple files.

Intended for Internal Service for reference purposes only.

Published by Articulate® Storyline www.articulate.com


NOTE: This document functions as a transcript/reference only. To receive full training
and have your training record updated, you must view the course in the ALP.
7.3 Creatin and Editing Files VI

Notes:

vi <file name> is Short for visual editor which is a Text / file editing tool. vi is the default
editor in Linux.
There are two primary modes in vi:
- The command mode, allows the user to issue commands.
- and the insert mode, we can enter text while in insert mode.

Intended for Internal Service for reference purposes only.

Published by Articulate® Storyline www.articulate.com


NOTE: This document functions as a transcript/reference only. To receive full training
and have your training record updated, you must view the course in the ALP.
7.4 Creating and Editing a File VI

Notes:

Here are the instructions on Setting Up the Proper Environment in Putty.


- Right mouse click on top frame of Putty.
- Change settings to Window to window size
- We would be changing the number of Columns to 80
- We would be changing the number of Rows to 24
At the command line: export TERM=vt100
You may run into frustrating issues when trying to edit a file via a putty window. To
ensure that vi and putty play well together, we would make the following adjustments to
the current putty window. To access the putty reconfiguration menu, do a right mouse
click on the command bar at the top of the putty window.
Choose the Change Settings option in the menu bar. Left mouse click the Window
option in the Putty Reconfiguration window. Make the adjustments in the Column and
row settings and Apply the changes.
In the putty window, type the command export TERM=vt100

Intended for Internal Service for reference purposes only.

Published by Articulate® Storyline www.articulate.com


NOTE: This document functions as a transcript/reference only. To receive full training
and have your training record updated, you must view the course in the ALP.
7.5 Creating and Editing a File VI

Notes:

$ vi <filename> is to Create or edit a file. New filename must be unique inside its
directory.
Filenames can consist of any combination of:
- Uppercase and lowercase letters
- Numbers
- Characters dot (.) & underscore (_)
Remember that Linux is case-sensitive. Lowercase letters are distinct from uppercase
letters.
There is no easy way to get comfortable using the vi editor other than practice. As we’ll
see there are a few tricks and tips that we can use to ease the pain that is vi. But as
noted, you have to work with it to get better. There are numerous on line cheat sheets
and as well as tutorials available online.

Intended for Internal Service for reference purposes only.

Published by Articulate® Storyline www.articulate.com


NOTE: This document functions as a transcript/reference only. To receive full training
and have your training record updated, you must view the course in the ALP.
7.6 Editing a File VI

Notes:

As stated, our two modes are the command mode and insert mode. Navigate in the file
while in command mode.
We can also issue file editing commands while in command mode. We normally start
out in command mode, where every keystroke represents a command. If we wanted to
move from line 1 to line 25, then edit a word on line 25, we would complete the
navigation while in command mode, then switch to insert mode to actually complete the
edit. Hitting the Esc key well bring you back into command mode.
Using vi can initially be a great source of frustration. One of the VERY nice things about
this version of Linux, that you will NOT find in Solaris is that once you have moved into
insert mode, that is reflected on your screen. It may seem like a small thing but it’s huge
when looking to determine if you are currently in command mode or insert mode. Hitting
the Esc key will bring you out of Insert mode back to Command mode.
To save your edits and exit the vi session enter the following: Esc:wq!
Just as valuable as knowing how to save is understanding that if you really mess up a
file during a vi session, you can ALWAYS quit out and start again. Enter the following:
Esc:q!

Intended for Internal Service for reference purposes only.

Published by Articulate® Storyline www.articulate.com


NOTE: This document functions as a transcript/reference only. To receive full training
and have your training record updated, you must view the course in the ALP.
7.7 Insert Mode

Notes:

For Insert mode Everything you type becomes text in your file.
There are certain characters that will “put” you into insert mode:
- Inserting or Adding text
- Break out of insert mode by hitting the <Esc> key
Click on the commands to obtain a full description.

Intended for Internal Service for reference purposes only.

Published by Articulate® Storyline www.articulate.com


NOTE: This document functions as a transcript/reference only. To receive full training
and have your training record updated, you must view the course in the ALP.
7.8 Changing Text in Command Mode

Notes:

Here is a command summary for Changing Text in Command Mode. Click on the
commands to obtain a full description.

7.9 Deleting Text

Intended for Internal Service for reference purposes only.

Published by Articulate® Storyline www.articulate.com


NOTE: This document functions as a transcript/reference only. To receive full training
and have your training record updated, you must view the course in the ALP.
Notes:

Here are is a command summary for Deleting Text.

7.10 Cutting and Pasting Text

Notes:

Here are is a command summary for Cutting and Pasting Text. Click on the commands
to obtain a full description.

Intended for Internal Service for reference purposes only.

Published by Articulate® Storyline www.articulate.com


NOTE: This document functions as a transcript/reference only. To receive full training
and have your training record updated, you must view the course in the ALP.
7.11 Saving and Quitting a File

Notes:

Saving and Quitting a File


We can save file edits, quit and return to the Linux prompt. Last command is a critical
command to remember for new vi users. Click on the commands to obtain a full
description.

Intended for Internal Service for reference purposes only.

Published by Articulate® Storyline www.articulate.com


NOTE: This document functions as a transcript/reference only. To receive full training
and have your training record updated, you must view the course in the ALP.
7.12 Copy and Paste into vi

Notes:

We can copy & paste from Notepad or Word into a vi editing session. However, many of
our edits do not require extensive typing. Ability to effectively use vi can be a time
saving tool. There will be situations where we will NOT be able to copy and paste. So a
rudimentary understanding of vi is an essential tool in our technical skills tool belt.
We have initiated a vi session on the file backups. Initially, we are in command
mode. In this case, by typing a lower case letter o, that will drop me down to a fresh line
and put my vi session into insert mode. As noted, we can use to insert or edit our text,
then copy & paste that into our vi session. However some vi enthusiasts would consider
that cheating.

Intended for Internal Service for reference purposes only.

Published by Articulate® Storyline www.articulate.com


NOTE: This document functions as a transcript/reference only. To receive full training
and have your training record updated, you must view the course in the ALP.
7.13 Command Summary

Notes:

Here are is a command summary for creating and editing files. Click on the commands
to obtain a full description.

Intended for Internal Service for reference purposes only.

Published by Articulate® Storyline www.articulate.com


NOTE: This document functions as a transcript/reference only. To receive full training
and have your training record updated, you must view the course in the ALP.

8. Confirm Your Participation

8.1 Confirm your participation

Notes:

This concludes the training. Please close this window to return to the course description
page in ALP. Once there, don't forget to confirm your participation by clicking the "here"
icon. This enables the ALP to set the training to complete. You can now exit this training
and complete the course appraisal. Thank you for completing this course.

Intended for Internal Service for reference purposes only.

Published by Articulate® Storyline www.articulate.com


NOTE: This document functions as a transcript/reference only. To receive full training
and have your training record updated, you must view the course in the ALP.

9. Author

9.1 Author Information

Intended for Internal Service for reference purposes only.

Published by Articulate® Storyline www.articulate.com

You might also like