This lab provides you with a basic overview of launching, resizing, managing, and
monitoring an Amazon EC2 instance.
Amazon Elastic Compute Cloud (Amazon EC2) is a web service that provides
resizable compute capacity in the cloud. It is designed to make web-scale cloud
computing easier for developers.
Amazon EC2's simple web service interface allows you to obtain and configure capacity
with minimal friction. It provides you with complete control of your computing resources
and lets you run on Amazon's proven computing environment. Amazon EC2 reduces the
time required to obtain and boot new server instances to minutes, allowing you to
quickly scale capacity, both up and down, as your computing requirements change.
Amazon EC2 changes the economics of computing by allowing you to pay only for
capacity that you actually use. Amazon EC2 provides developers the tools to build
failure resilient applications and isolate themselves from common failure scenarios.
Topics covered
By the end of this lab, you will be able to:
Launch a web server with termination protection enabled
Monitor Your EC2 instance
Modify the security group that your web server is using to allow HTTP access
Resize your Amazon EC2 instance to scale
Test termination protection
Terminate your EC2 instance
Duration
This lab takes approximately 45 minutes to complete.
Accessing the AWS Management Console
1. At the upper-right corner of these instructions, choose Start Lab
Troubleshooting tip: If you get an Access Denied error, close the error box, and
choose Start Lab again.
2. The lab status can be interpreted as follows:
o A red circle next to AWS at the upper-left corner of this page indicates the
lab has not been started.
o A yellow circle next to AWS at the upper-left corner of this page indicates
the lab is starting.
o A green circle next to AWS at the upper-left corner of this page indicates
the lab is ready.
Wait for the lab to be ready before proceeding.
3. At the top of these instructions, choose the green circle next to AWS
This option opens the AWS Management Console in a new browser tab. The system
automatically sign you in.
Tip: If a new browser tab does not open, a banner or icon at the top of your browser will
indicate that your browser is preventing the site from opening pop-up windows. Choose
the banner or icon, and choose Allow pop-ups.
4. Arrange the AWS Management Console tab so that it displays along side these
instructions. Ideally, you should be able to see both browser tabs at the same
time so that you can follow the lab steps.
Do not change the lab Region unless specifically instructed to do so.
It takes a few minutes to provision the resources necessary to complete this lab.
Task 1: Launching your EC2 instance
In this task, you will launch an Amazon EC2 instance with termination protection.
Termination protection prevents you from accidentally terminating an EC2 instance. You
will deploy your instance with a User Data script that will allow you to deploy a simple
web server.
5. In the AWS Management Console on the Services menu, choose EC2.
6. In the left navigation pane, choose EC2 Dashboard to ensure that you are on
the dashboard page.
7. Choose Launch instance, and then select Launch instance.
Step 1: Naming your EC2 instance
When you name your instance, AWS creates a key value pair. The key for this pair is
Name, and the value is the name you enter for your EC2 instance.
8. In the Name and tags pane, in the Name text box, enter Web Server.
Step 2: Choosing an Amazon Machine Image (AMI)
An AMI provides the information required to launch an instance, which is a virtual server
in the cloud. An AMI includes the following:
A template for the root volume for the instance (for example, an operating system
or an application server with applications)
Launch permissions that control which AWS accounts can use the AMI to launch
instances
A block device mapping that specifies the volumes to attach to the instance when
it is launched
The Quick Start list contains the most commonly used AMIs. You can also create your
own AMI or select an AMI from the AWS Marketplace, an online store where you can
sell or buy software that runs on AWS.
9. Locate the Application and OS Images (Amazon Machine Image) pane.
10. Under AMI Machine Image (AMI), notice that the Amazon Linux 2 AMI image is
selected by default. Keep this setting.
Step 3: Choosing an instance type
Amazon EC2 provides a wide selection of instance types optimized to fit different use
cases. Instance types comprise varying combinations of CPU, memory, storage, and
networking capacity and give you the flexibility to choose the appropriate mix of
resources for your applications. Each instance type includes one or more instance sizes
so that you can scale your resources to the requirements of your target workload.
Select a t3.micro instance. This instance type has 2 virtual CPU and 1 GiB of memory.
11. From the dropdown, select t3.micro.
NOTE: You may be restricted from using other instance types in this lab.
Step 4: Configuring a key pair
Amazon EC2 uses public–key cryptography to encrypt and decrypt login information. To
log in to your instance, you must create a key pair, specify the name of the key pair
when you launch the instance, and provide the private key when you connect to the
instance.
In this lab, you do not log in to your instance, so you do not require a key pair.
12. In the Key pair (login) pane, select Proceed without a key pair (Not
recommended).
Step 5: Configuring the network settings
You use this pane to configure networking settings.
The VPC indicates which virtual private cloud (VPC) you want to launch the instance
into. You can have multiple VPCs, including different ones for development, testing, and
production.
13. In the Network settings pane, choose Edit
14. For VPC - required, select Lab VPC.
15. Still in the Network settings pane, configure the Security Group as follows:
o Security group name - required: Web Server security group
o Description: Security group for my web server
A security group acts as a virtual firewall that controls the traffic for one or more
instances. When you launch an instance, you associate one or more security groups
with the instance. You add rules to each security group that allow traffic to or from its
associated instances. You can modify the rules for a security group at any time; the new
rules are automatically applied to all instances that are associated with the security
group.
16. Under Inbound security groups rules select the Remove
In this lab, you will not log into your instance using SSH. Removing SSH access will
improve the security of the instance.
Step 6: Adding storage
Amazon EC2 stores data on a network-attached virtual disk called Amazon Elastic
Block Store (Amazon EBS).
You launch the EC2 instance using a default 8 GiB disk volume. This is your root
volume (also known as a boot volume).
17. In the Configure storage pane, keep the default storage configuration.
Step 7: Configuring advanced details
18. Expand the Advanced details pane.
19. Select the dropdown for Termination protection, then choose Enable.
When you launch an instance in Amazon EC2, you have the option of passing user data
to the instance. These commands can be used to perform common automated
configuration tasks and even run scripts after the instance starts.
20. Copy the following commands, and paste them into the User data text box.
#!/bin/bash
yum -y install httpd
systemctl enable httpd
systemctl start httpd
echo '<html><h1>Hello From Your Web Server!</h1></html>' >
/var/www/html/index.html
The script does the following:
o Install an Apache web server (httpd)
o Configure the web server to automatically start on boot
o Activate the Web server
o Create a simple web page
Step 8: Launching an EC2 instance
Now that you have configured your EC2 instance settings, it is time to launch your
instance.
21. In the right pane, choose Launch instance
22. Choose View all instances
The instance appears in a Pending state, which means it is being launched. It then
changes to Running, which indicates that the instance has started booting. There will
be a short time before you can access the instance.
The instance receives a public DNS name that you can use to contact the instance from
the Internet.
23. Select the box next to your Web Server. The Details tab displays detailed
information about your instance.
To view more information in the Details tab, drag the window divider upward.
Review the information displayed in the Details, Security and Networking tabs.
24. Wait for your instance to display the following:
Note: Refresh if needed.
o Instance State: Running
o Status Checks: 2/2 checks passed
Task 2: Monitor Your Instance
Monitoring is an important part of maintaining the reliability, availability, and performance
of your Amazon Elastic Compute Cloud (Amazon EC2) instances and your AWS
solutions.
25. Select the instance by checking the box next to the instance and navigate to the
bottom of the screen to the Status checks tab.
With instance status monitoring, you can quickly determine whether Amazon EC2 has
detected any problems that might prevent your instances from running applications.
Amazon EC2 performs automated checks on every running EC2 instance to identify
hardware and software issues.
Notice that both the System reachability and Instance reachability checks have
passed.
26. Select the Monitoring tab.
This tab displays Amazon CloudWatch metrics for your instance. Currently, there are not
many metrics to display because the instance was recently launched.
You can choose a graph to see an expanded view.
Amazon EC2 sends metrics to Amazon CloudWatch for your EC2 instances. Basic (five-
minute) monitoring is enabled by default. You can enable detailed (one-minute)
monitoring.
27. In the Actions menu, select Monitor and troubleshoot Get Instance
Screenshot.
This shows you what your Amazon EC2 instance console would look like if a screen
were attached to it.
If you are unable to reach your instance via SSH or RDP, you can capture a screenshot
of your instance and view it as an image. This provides visibility as to the status of the
instance, and allows for quicker troubleshooting.
28. Select Cancel located at the bottom of the instance screenshot.
Congratulations! You have explored several ways to monitor your instance.
Task 3: Update Your Security Group and Access the Web Server
When you launched the EC2 instance, you provided a script that installed a web server
and created a simple web page. In this task, you will access content from the web
server.
29. Select the instance by checking the box and select the Details tab.
30. Copy the Public IPv4 address of your instance to your clipboard.
31. Open a new tab in your web browser, paste the IP address you just copied, then
press Enter.
Question: Are you able to access your web server? Why not?
You are not currently able to access your web server because the security group is not
permitting inbound traffic on port 80, which is used for HTTP web requests. This is a
demonstration of using a security group as a firewall to restrict the network traffic that is
allowed in and out of an instance.
To correct this, you will now update the security group to permit web traffic on port 80.
32. Keep the browser tab open, but return to the EC2 Management Console tab.
33. In the left navigation pane, select Security Groups located under Network &
Security.
34. Select Web Server security group.
35. Select the Inbound rules tab.
The security group currently has no rules.
36. Select Edit inbound rules then select Add rule and configure the rule with the
following settings:
o Type: HTTP
o Source: Anywhere-IPv4
o Select Save rules
37. Return to the web server tab that you previously opened and refresh the page.
You should see the message Hello From Your Web Server!
Congratulations! You have successfully modified your security group to permit HTTP
traffic into your Amazon EC2 Instance.
Task 4: Resize Your Instance: Instance Type and EBS Volume
As your needs change, you might find that your instance is over-utilized (too small) or
under-utilized (too large). If so, you can change the instance type. For example, if a
t3.micro instance is too small for its workload, you can change it to an m5.medium
instance. Similarly, you can change the size of a disk.
Stop Your Instance
Before you can resize an instance, you must stop it.
When you stop an instance, it is shut down. There is no charge for a stopped EC2
instance, but the storage charge for attached Amazon EBS volumes remains.
38. On the EC2 Management Console, in the left navigation pane, select
Instances.
Web Server should already be selected.
39. Select Instance state > Stop instance.
40. Select Stop
Your instance will perform a normal shutdown and then will stop running.
41. Wait for the Instance State to display: stopped
Change The Instance Type
42. In the Actions menu, select Instance Settings Change Instance Type, then
configure:
o Instance Type: t3.small
o Select Apply
When the instance is started again it will be a t3.small, which has twice as much
memory as a t3.micro instance. NOTE: You may be restricted from using other instance
types in this lab.
Resize the EBS Volume
43. In the left navigation menu, select Volumes located under Elastic Block Store.
44. Select the volume by checking the box, and navigate to the Actions menu,
select Modify Volume.
The disk volume currently has a size of 8 GiB. You will now increase the size of this
disk.
45. Change the size to: 10 NOTE: You may be restricted from creating large Amazon
EBS volumes in this lab.
46. Select Modify
47. Select Modify to confirm and increase the size of the volume.
Start the Resized Instance
You will now start the instance again, which will now have more memory and more disk
space.
48. In left navigation pane, select Instances.
49. Select the Web Server instance by checking the box, then navigate to Instance
state > Start instance.
Congratulations! You have successfully resized your Amazon EC2 Instance. In this
task you changed your instance type from t3.micro to t3.small. You also modified your
root disk volume from 8 GiB to 10 GiB.
Task 5: Test Termination Protection
You can delete your instance when you no longer need it. This is referred to as
terminating your instance. You cannot connect to or restart an instance after it has been
terminated.
In this task, you will learn how to use termination protection.
50. In left navigation pane, select Instances.
51. Select the Web Server instance by checking the box and navigate to the top and
select Instance state menu, select Terminate instance.
Note: There is a message that says: On an EBS-backed instance, the default action is
for the root EBS volume to be deleted when the instance is terminated. Storage on any
local drives will be lost. It will ask if you are sure that you want to terminate the instance.
You will be able to select the Terminate button.
Note: You will notice that the instance did not terminate and a red error message pops
up at the top that says: Failed to terminate an instance: The instance may not be
terminated. This is because it has termination protection enabled.
52. In the Actions menu, select Instance settings Change termination
protection.
53. Uncheck Enable followed by Save
You can now terminate the instance.
54. In the Actions menu, select Instance State Terminate instance.
55. Select Terminate
Congratulations! You have successfully tested termination protection and terminated
your instance.
Lab Complete
56. Choose End Lab at the top of this page, and then select Yes to confirm that you
want to end the lab.
A panel indicates that DELETE has been initiated... You may close this message box
now.
57. A message Ended AWS Lab Successfully is briefly displayed, indicating that the
lab has ended.
Additional Resources
Launch Your Instance
Amazon EC2 Instance Types
Amazon Machine Images (AMI)
Amazon EC2 - User Data and Shell Scripts
Amazon EC2 Root Device Volume
Tagging Your Amazon EC2 Resources
Security Groups
Amazon EC2 Key Pairs
Status Checks for Your Instances
Getting Console Output and Rebooting Instances
Amazon EC2 Metrics and Dimensions
Resizing Your Instance
Stop and Start Your Instance
Terminate Your Instance
Termination Protection for an Instance
For more information about AWS Training and Certification, see
https://aws.amazon.com/training/. Your feedback is welcome and appreciated. If you
would like to share any suggestions or corrections, please provide the details in our
AWS Training and Certification Contact Form. © 2023 Amazon Web Services, Inc. and
its affiliates. All rights reserved. This work may not be reproduced or redistributed, in
whole or in part, without prior written permission from Amazon Web Services, Inc.
Commercial copying, lending, or selling is prohibited.
INTODUCTION TO LINUX
RSLX EN-US SG M02 INTROLINUX
<> of 35+-<->Close
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Introduction to Linux
Linux Fundamentals
Welcome to Introduction to Linux.
2
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
You will learn how to:
•
Define Linux
•
Describe the main features and components of the Linux operating system
•
Distinguish the different Linux user interfaces
•
Use the built
-
in Linux documentation
•
List different Linux distributions
At the core of the lesson
What you will learn
In this lesson, you will learn how to:
•
Define Linux
•
Describe the main features and components of the Linux operating system (OS)
•
Distinguish the different Linux user interfaces
•
Use the built
-
in Linux documentation
•
List different Linux distributions
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
What is Linux?
First, define what Linux is.
4
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
•
Interface between user and hardware
•
Runs applications
Operating system
•
Central processing unit (CPU)
•
Random access memory (RAM)
•
Storage
•
Networking
Hardware
Hardware and operating systems
Computers consist
of hardware and software.
Hardware
refers to a computer’s physical components, such as its central processing
unit (CPU), memory, storage drive, and network card.
Software
is the collection of applications and programs that are installed on the
computer.
One key type of software that computers require is an operating system.
An operating system manages a computer’s hardware and software resources and
runs applications.
WHAT IS LINUX?
HARDWARE AND OPERATING SYSTEM
HARDWARE OPERATING SYSTEM
Central processing unit (CPU) Interface between user and hardware
Runs applications
•Random access memory (RAM)
•Storage
•Networking
RSLX EN-US SG M02 INTROLINUX
<> of 35+-<->Close
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Introduction to Linux
Linux Fundamentals
Welcome to Introduction to Linux.
2
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
You will learn how to:
•
Define Linux
•
Describe the main features and components of the Linux operating system
•
Distinguish the different Linux user interfaces
•
Use the built
-
in Linux documentation
•
List different Linux distributions
At the core of the lesson
What you will learn
In this lesson, you will learn how to:
•
Define Linux
•
Describe the main features and components of the Linux operating system (OS)
•
Distinguish the different Linux user interfaces
•
Use the built
-
in Linux documentation
•
List different Linux distributions
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
What is Linux?
First, define what Linux is.
4
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
•
Interface between user and hardware
•
Runs applications
Operating system
•
Central processing unit (CPU)
•
Random access memory (RAM)
•
Storage
•
Networking
Hardware
Hardware and operating systems
Computers consist
of hardware and software.
Hardware
refers to a computer’s physical components, such as its central processing
unit (CPU), memory, storage drive, and network card.
Software
is the collection of applications and programs that are installed on the
computer.
One key type of software that computers require is an operating system.
An operating system manages a computer’s hardware and software resources and
runs applications.
5
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
•
Is o
pen source
–
Code
is publicly available
,
and
users
can
m
odif
y
and expand
it
•
Supports multiple users and multi
-
tasking
•
Is b
uilt to handle networking
•
Provides system tools and utilities
The Linux
o
perating
s
ystem
Linux is an operating system that is freely distributable under the terms of the Gnu is
Not Unix (GNU) General Public License (GPL). It is open source because it provides
the source code for the core functionality of an operating system, called a
kernel
,
and users can modify and expand it. As a result, many
distributions
of Linux are
available today.
With Linux, multiple people can
use the same computer at the same time and can
run multiple applications simultaneously. It also supports network functionality and
provides system tools and utilities to increase usability.
6
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Was created in 1991 by Linux Torvalds
Is modular
Is stable
Is commonly used as a server operating system
Is also used as a desktop operating system
Linux history and benefits
Linus Torvalds, a graduate student at the University of Helsinki in Finland, created
Linux in 1991. Linux is similar to another operating system that is called
Unix
, which
was developed in the late 1960s.
In addition to being open source, Linux is modular, which means that you can extend
it. It is also stable and does not experience frequent system freezes that require
computer restarts. Because
of t
hese benefits, you can use Linux both as a desktop
system and a server operating system.
RSLX EN-US SG M02 INTROLINUX
<> of 35+-<->Close
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Introduction to Linux
Linux Fundamentals
Welcome to Introduction to Linux.
2
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
You will learn how to:
•
Define Linux
•
Describe the main features and components of the Linux operating system
•
Distinguish the different Linux user interfaces
•
Use the built
-
in Linux documentation
•
List different Linux distributions
At the core of the lesson
What you will learn
In this lesson, you will learn how to:
•
Define Linux
•
Describe the main features and components of the Linux operating system (OS)
•
Distinguish the different Linux user interfaces
•
Use the built
-
in Linux documentation
•
List different Linux distributions
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
What is Linux?
First, define what Linux is.
4
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
•
Interface between user and hardware
•
Runs applications
Operating system
•
Central processing unit (CPU)
•
Random access memory (RAM)
•
Storage
•
Networking
Hardware
Hardware and operating systems
Computers consist
of hardware and software.
Hardware
refers to a computer’s physical components, such as its central processing
unit (CPU), memory, storage drive, and network card.
Software
is the collection of applications and programs that are installed on the
computer.
One key type of software that computers require is an operating system.
An operating system manages a computer’s hardware and software resources and
runs applications.
5
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
•
Is o
pen source
–
Code
is publicly available
,
and
users
can
m
odif
y
and expand
it
•
Supports multiple users and multi
-
tasking
•
Is b
uilt to handle networking
•
Provides system tools and utilities
The Linux
o
perating
s
ystem
Linux is an operating system that is freely distributable under the terms of the Gnu is
Not Unix (GNU) General Public License (GPL). It is open source because it provides
the source code for the core functionality of an operating system, called a
kernel
,
and users can modify and expand it. As a result, many
distributions
of Linux are
available today.
With Linux, multiple people can
use the same computer at the same time and can
run multiple applications simultaneously. It also supports network functionality and
provides system tools and utilities to increase usability.
6
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Was created in 1991 by Linux Torvalds
Is modular
Is stable
Is commonly used as a server operating system
Is also used as a desktop operating system
Linux history and benefits
Linus Torvalds, a graduate student at the University of Helsinki in Finland, created
Linux in 1991. Linux is similar to another operating system that is called
Unix
, which
was developed in the late 1960s.
In addition to being open source, Linux is modular, which means that you can extend
it. It is also stable and does not experience frequent system freezes that require
computer restarts. Because
of t
hese benefits, you can use Linux both as a desktop
system and a server operating system.
7
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Amazon Linux 2
•
Because Linux is open source, anyone can make a distribution and tailor it for a given
purpose.
•
A distribution is typically downloaded and can be installed by using various formats.
–
For example, by using an
Amazon Machine Image (AMI)
for
Amazon Linux 2
•
Examples:
–
Amazon Linux 2
–
Red Hat Enterprise Linux (RHEL)
–
Debian
–
Ubuntu
A
distribution
or
distro
is a packaged version of Linux.
Definition
Distributions
A
Linux distribution
is a packaged version of Linux that a group of individuals or a
company develops. It includes the core operating system functionality (
kernel
) and
additional complementary tools and software applications.
Distributions are typically downloaded but can also be installed by using various
media and formats. Examples include
compact disk (CD), Universal Serial Bus
(
USB)
device, and downloadable International Standardization for Organization (ISO)
image.
Examples of Linux distribution include Amazon Linux 2, Red Hat Enterprise Linux
(RHEL), Debian, and Ubuntu.
In the AWS Cloud, the Amazon Linux 2 operating system is readily distributed by using
an Amazon Machine Image (AMI). An AMI contains an operating system and other
pre
-
installed software relevant to the image.
You will learn more about Amazon Linux
2 in a later section.
RSLX EN-US SG M02 INTROLINUX
<> of 35+-<->Close
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Introduction to Linux
Linux Fundamentals
Welcome to Introduction to Linux.
2
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
You will learn how to:
•
Define Linux
•
Describe the main features and components of the Linux operating system
•
Distinguish the different Linux user interfaces
•
Use the built
-
in Linux documentation
•
List different Linux distributions
At the core of the lesson
What you will learn
In this lesson, you will learn how to:
•
Define Linux
•
Describe the main features and components of the Linux operating system (OS)
•
Distinguish the different Linux user interfaces
•
Use the built
-
in Linux documentation
•
List different Linux distributions
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
What is Linux?
First, define what Linux is.
4
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
•
Interface between user and hardware
•
Runs applications
Operating system
•
Central processing unit (CPU)
•
Random access memory (RAM)
•
Storage
•
Networking
Hardware
Hardware and operating systems
Computers consist
of hardware and software.
Hardware
refers to a computer’s physical components, such as its central processing
unit (CPU), memory, storage drive, and network card.
Software
is the collection of applications and programs that are installed on the
computer.
One key type of software that computers require is an operating system.
An operating system manages a computer’s hardware and software resources and
runs applications.
5
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
•
Is o
pen source
–
Code
is publicly available
,
and
users
can
m
odif
y
and expand
it
•
Supports multiple users and multi
-
tasking
•
Is b
uilt to handle networking
•
Provides system tools and utilities
The Linux
o
perating
s
ystem
Linux is an operating system that is freely distributable under the terms of the Gnu is
Not Unix (GNU) General Public License (GPL). It is open source because it provides
the source code for the core functionality of an operating system, called a
kernel
,
and users can modify and expand it. As a result, many
distributions
of Linux are
available today.
With Linux, multiple people can
use the same computer at the same time and can
run multiple applications simultaneously. It also supports network functionality and
provides system tools and utilities to increase usability.
6
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Was created in 1991 by Linux Torvalds
Is modular
Is stable
Is commonly used as a server operating system
Is also used as a desktop operating system
Linux history and benefits
Linus Torvalds, a graduate student at the University of Helsinki in Finland, created
Linux in 1991. Linux is similar to another operating system that is called
Unix
, which
was developed in the late 1960s.
In addition to being open source, Linux is modular, which means that you can extend
it. It is also stable and does not experience frequent system freezes that require
computer restarts. Because
of t
hese benefits, you can use Linux both as a desktop
system and a server operating system.
7
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Amazon Linux 2
•
Because Linux is open source, anyone can make a distribution and tailor it for a given
purpose.
•
A distribution is typically downloaded and can be installed by using various formats.
–
For example, by using an
Amazon Machine Image (AMI)
for
Amazon Linux 2
•
Examples:
–
Amazon Linux 2
–
Red Hat Enterprise Linux (RHEL)
–
Debian
–
Ubuntu
A
distribution
or
distro
is a packaged version of Linux.
Definition
Distributions
A
Linux distribution
is a packaged version of Linux that a group of individuals or a
company develops. It includes the core operating system functionality (
kernel
) and
additional complementary tools and software applications.
Distributions are typically downloaded but can also be installed by using various
media and formats. Examples include
compact disk (CD), Universal Serial Bus
(
USB)
device, and downloadable International Standardization for Organization (ISO)
image.
Examples of Linux distribution include Amazon Linux 2, Red Hat Enterprise Linux
(RHEL), Debian, and Ubuntu.
In the AWS Cloud, the Amazon Linux 2 operating system is readily distributed by using
an Amazon Machine Image (AMI). An AMI contains an operating system and other
pre
-
installed software relevant to the image.
You will learn more about Amazon Linux
2 in a later section.
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Linux components
This section describes the main features and components of the Linux operating
system.
LINUX COMPONENTS
RSLX EN-US SG M02 INTROLINUX
<> of 35+-<->Close
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Introduction to Linux
Linux Fundamentals
Welcome to Introduction to Linux.
2
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
You will learn how to:
•
Define Linux
•
Describe the main features and components of the Linux operating system
•
Distinguish the different Linux user interfaces
•
Use the built
-
in Linux documentation
•
List different Linux distributions
At the core of the lesson
What you will learn
In this lesson, you will learn how to:
•
Define Linux
•
Describe the main features and components of the Linux operating system (OS)
•
Distinguish the different Linux user interfaces
•
Use the built
-
in Linux documentation
•
List different Linux distributions
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
What is Linux?
First, define what Linux is.
4
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
•
Interface between user and hardware
•
Runs applications
Operating system
•
Central processing unit (CPU)
•
Random access memory (RAM)
•
Storage
•
Networking
Hardware
Hardware and operating systems
Computers consist
of hardware and software.
Hardware
refers to a computer’s physical components, such as its central processing
unit (CPU), memory, storage drive, and network card.
Software
is the collection of applications and programs that are installed on the
computer.
One key type of software that computers require is an operating system.
An operating system manages a computer’s hardware and software resources and
runs applications.
5
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
•
Is o
pen source
–
Code
is publicly available
,
and
users
can
m
odif
y
and expand
it
•
Supports multiple users and multi
-
tasking
•
Is b
uilt to handle networking
•
Provides system tools and utilities
The Linux
o
perating
s
ystem
Linux is an operating system that is freely distributable under the terms of the Gnu is
Not Unix (GNU) General Public License (GPL). It is open source because it provides
the source code for the core functionality of an operating system, called a
kernel
,
and users can modify and expand it. As a result, many
distributions
of Linux are
available today.
With Linux, multiple people can
use the same computer at the same time and can
run multiple applications simultaneously. It also supports network functionality and
provides system tools and utilities to increase usability.
6
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Was created in 1991 by Linux Torvalds
Is modular
Is stable
Is commonly used as a server operating system
Is also used as a desktop operating system
Linux history and benefits
Linus Torvalds, a graduate student at the University of Helsinki in Finland, created
Linux in 1991. Linux is similar to another operating system that is called
Unix
, which
was developed in the late 1960s.
In addition to being open source, Linux is modular, which means that you can extend
it. It is also stable and does not experience frequent system freezes that require
computer restarts. Because
of t
hese benefits, you can use Linux both as a desktop
system and a server operating system.
7
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Amazon Linux 2
•
Because Linux is open source, anyone can make a distribution and tailor it for a given
purpose.
•
A distribution is typically downloaded and can be installed by using various formats.
–
For example, by using an
Amazon Machine Image (AMI)
for
Amazon Linux 2
•
Examples:
–
Amazon Linux 2
–
Red Hat Enterprise Linux (RHEL)
–
Debian
–
Ubuntu
A
distribution
or
distro
is a packaged version of Linux.
Definition
Distributions
A
Linux distribution
is a packaged version of Linux that a group of individuals or a
company develops. It includes the core operating system functionality (
kernel
) and
additional complementary tools and software applications.
Distributions are typically downloaded but can also be installed by using various
media and formats. Examples include
compact disk (CD), Universal Serial Bus
(
USB)
device, and downloadable International Standardization for Organization (ISO)
image.
Examples of Linux distribution include Amazon Linux 2, Red Hat Enterprise Linux
(RHEL), Debian, and Ubuntu.
In the AWS Cloud, the Amazon Linux 2 operating system is readily distributed by using
an Amazon Machine Image (AMI). An AMI contains an operating system and other
pre
-
installed software relevant to the image.
You will learn more about Amazon Linux
2 in a later section.
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Linux components
This section describes the main features and components of the Linux operating
system.
9
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
•
Provides the core functionality of the operating system
Kernel
•
Provide extra support for the system or the user
Daemons
•
Include programs such as text editors, web browsers, and
databases
Applications
•
Include user content such as text files, music files, and image
files
Data files
•
Contain settings for Linux, services, and applications that are
stored in text files
Configuration files
Major components of Linux
The major components of a Linux distribution consist of a kernel, daemons,
applications, data files, and configuration files. You will review them in more detail in
the next slides.
10
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
•
An operating system kernel
is
:
–
A computer program
–
Ac
ontrol
ler of
everything in the operating system
•
The Linux kernel manages:
–
Scheduling of processor time
–
Memory allocation for the operating system and for applications
–
Access to peripheral devices (sound card, hard disk drive, network card,
and others
)
The Linux
k
ernel
The kernel refers to the core component of an operating
system
. It controls
everything in the operating
system, i
ncluding the allocation of CPU time and memory
storage to running programs, and access to peripheral devices.
RSLX EN-US SG M02 INTROLINUX
<> of 35+-<->Close
2
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
You will learn how to:
•
Define Linux
•
Describe the main features and components of the Linux operating system
•
Distinguish the different Linux user interfaces
•
Use the built
-
in Linux documentation
•
List different Linux distributions
At the core of the lesson
What you will learn
In this lesson, you will learn how to:
•
Define Linux
•
Describe the main features and components of the Linux operating system (OS)
•
Distinguish the different Linux user interfaces
•
Use the built
-
in Linux documentation
•
List different Linux distributions
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
What is Linux?
First, define what Linux is.
4
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
•
Interface between user and hardware
•
Runs applications
Operating system
•
Central processing unit (CPU)
•
Random access memory (RAM)
•
Storage
•
Networking
Hardware
Hardware and operating systems
Computers consist
of hardware and software.
Hardware
refers to a computer’s physical components, such as its central processing
unit (CPU), memory, storage drive, and network card.
Software
is the collection of applications and programs that are installed on the
computer.
One key type of software that computers require is an operating system.
An operating system manages a computer’s hardware and software resources and
runs applications.
5
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
•
Is o
pen source
–
Code
is publicly available
,
and
users
can
m
odif
y
and expand
it
•
Supports multiple users and multi
-
tasking
•
Is b
uilt to handle networking
•
Provides system tools and utilities
The Linux
o
perating
s
ystem
Linux is an operating system that is freely distributable under the terms of the Gnu is
Not Unix (GNU) General Public License (GPL). It is open source because it provides
the source code for the core functionality of an operating system, called a
kernel
,
and users can modify and expand it. As a result, many
distributions
of Linux are
available today.
With Linux, multiple people can
use the same computer at the same time and can
run multiple applications simultaneously. It also supports network functionality and
provides system tools and utilities to increase usability.
6
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Was created in 1991 by Linux Torvalds
Is modular
Is stable
Is commonly used as a server operating system
Is also used as a desktop operating system
Linux history and benefits
Linus Torvalds, a graduate student at the University of Helsinki in Finland, created
Linux in 1991. Linux is similar to another operating system that is called
Unix
, which
was developed in the late 1960s.
In addition to being open source, Linux is modular, which means that you can extend
it. It is also stable and does not experience frequent system freezes that require
computer restarts. Because
of t
hese benefits, you can use Linux both as a desktop
system and a server operating system.
7
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Amazon Linux 2
•
Because Linux is open source, anyone can make a distribution and tailor it for a given
purpose.
•
A distribution is typically downloaded and can be installed by using various formats.
–
For example, by using an
Amazon Machine Image (AMI)
for
Amazon Linux 2
•
Examples:
–
Amazon Linux 2
–
Red Hat Enterprise Linux (RHEL)
–
Debian
–
Ubuntu
A
distribution
or
distro
is a packaged version of Linux.
Definition
Distributions
A
Linux distribution
is a packaged version of Linux that a group of individuals or a
company develops. It includes the core operating system functionality (
kernel
) and
additional complementary tools and software applications.
Distributions are typically downloaded but can also be installed by using various
media and formats. Examples include
compact disk (CD), Universal Serial Bus
(
USB)
device, and downloadable International Standardization for Organization (ISO)
image.
Examples of Linux distribution include Amazon Linux 2, Red Hat Enterprise Linux
(RHEL), Debian, and Ubuntu.
In the AWS Cloud, the Amazon Linux 2 operating system is readily distributed by using
an Amazon Machine Image (AMI). An AMI contains an operating system and other
pre
-
installed software relevant to the image.
You will learn more about Amazon Linux
2 in a later section.
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Linux components
This section describes the main features and components of the Linux operating
system.
9
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
•
Provides the core functionality of the operating system
Kernel
•
Provide extra support for the system or the user
Daemons
•
Include programs such as text editors, web browsers, and
databases
Applications
•
Include user content such as text files, music files, and image
files
Data files
•
Contain settings for Linux, services, and applications that are
stored in text files
Configuration files
Major components of Linux
The major components of a Linux distribution consist of a kernel, daemons,
applications, data files, and configuration files. You will review them in more detail in
the next slides.
10
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
•
An operating system kernel
is
:
–
A computer program
–
Ac
ontrol
ler of
everything in the operating system
•
The Linux kernel manages:
–
Scheduling of processor time
–
Memory allocation for the operating system and for applications
–
Access to peripheral devices (sound card, hard disk drive, network card,
and others
)
The Linux
k
ernel
The kernel refers to the core component of an operating
system
. It controls
everything in the operating
system, i
ncluding the allocation of CPU time and memory
storage to running programs, and access to peripheral devices.
11
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Processes
D
e
v
i
ce
s
Resource
allocation
File
system
access
Memory
Kernel
Kernel management as a map
What does the kernel do?
•
The kernel manages the running of
multiple applications and the
sharing of resources among multiple
users.
Functions of the Linux
kernel
The Linux kernel manages the running of multiple applications and the sharing of
resources among multiple users. It also controls the interface to the input/output
(I/O) devices that are connected to the computer, and it manages files and
directories.
RSLX EN-US SG M02 INTROLINUX
<> of 35+-<->Close
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
What is Linux?
First, define what Linux is.
4
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
•
Interface between user and hardware
•
Runs applications
Operating system
•
Central processing unit (CPU)
•
Random access memory (RAM)
•
Storage
•
Networking
Hardware
Hardware and operating systems
Computers consist
of hardware and software.
Hardware
refers to a computer’s physical components, such as its central processing
unit (CPU), memory, storage drive, and network card.
Software
is the collection of applications and programs that are installed on the
computer.
One key type of software that computers require is an operating system.
An operating system manages a computer’s hardware and software resources and
runs applications.
5
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
•
Is o
pen source
–
Code
is publicly available
,
and
users
can
m
odif
y
and expand
it
•
Supports multiple users and multi
-
tasking
•
Is b
uilt to handle networking
•
Provides system tools and utilities
The Linux
o
perating
s
ystem
Linux is an operating system that is freely distributable under the terms of the Gnu is
Not Unix (GNU) General Public License (GPL). It is open source because it provides
the source code for the core functionality of an operating system, called a
kernel
,
and users can modify and expand it. As a result, many
distributions
of Linux are
available today.
With Linux, multiple people can
use the same computer at the same time and can
run multiple applications simultaneously. It also supports network functionality and
provides system tools and utilities to increase usability.
6
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Was created in 1991 by Linux Torvalds
Is modular
Is stable
Is commonly used as a server operating system
Is also used as a desktop operating system
Linux history and benefits
Linus Torvalds, a graduate student at the University of Helsinki in Finland, created
Linux in 1991. Linux is similar to another operating system that is called
Unix
, which
was developed in the late 1960s.
In addition to being open source, Linux is modular, which means that you can extend
it. It is also stable and does not experience frequent system freezes that require
computer restarts. Because
of t
hese benefits, you can use Linux both as a desktop
system and a server operating system.
7
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Amazon Linux 2
•
Because Linux is open source, anyone can make a distribution and tailor it for a given
purpose.
•
A distribution is typically downloaded and can be installed by using various formats.
–
For example, by using an
Amazon Machine Image (AMI)
for
Amazon Linux 2
•
Examples:
–
Amazon Linux 2
–
Red Hat Enterprise Linux (RHEL)
–
Debian
–
Ubuntu
A
distribution
or
distro
is a packaged version of Linux.
Definition
Distributions
A
Linux distribution
is a packaged version of Linux that a group of individuals or a
company develops. It includes the core operating system functionality (
kernel
) and
additional complementary tools and software applications.
Distributions are typically downloaded but can also be installed by using various
media and formats. Examples include
compact disk (CD), Universal Serial Bus
(
USB)
device, and downloadable International Standardization for Organization (ISO)
image.
Examples of Linux distribution include Amazon Linux 2, Red Hat Enterprise Linux
(RHEL), Debian, and Ubuntu.
In the AWS Cloud, the Amazon Linux 2 operating system is readily distributed by using
an Amazon Machine Image (AMI). An AMI contains an operating system and other
pre
-
installed software relevant to the image.
You will learn more about Amazon Linux
2 in a later section.
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Linux components
This section describes the main features and components of the Linux operating
system.
9
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
•
Provides the core functionality of the operating system
Kernel
•
Provide extra support for the system or the user
Daemons
•
Include programs such as text editors, web browsers, and
databases
Applications
•
Include user content such as text files, music files, and image
files
Data files
•
Contain settings for Linux, services, and applications that are
stored in text files
Configuration files
Major components of Linux
The major components of a Linux distribution consist of a kernel, daemons,
applications, data files, and configuration files. You will review them in more detail in
the next slides.
10
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
•
An operating system kernel
is
:
–
A computer program
–
Ac
ontrol
ler of
everything in the operating system
•
The Linux kernel manages:
–
Scheduling of processor time
–
Memory allocation for the operating system and for applications
–
Access to peripheral devices (sound card, hard disk drive, network card,
and others
)
The Linux
k
ernel
The kernel refers to the core component of an operating
system
. It controls
everything in the operating
system, i
ncluding the allocation of CPU time and memory
storage to running programs, and access to peripheral devices.
11
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Processes
D
e
v
i
ce
s
Resource
allocation
File
system
access
Memory
Kernel
Kernel management as a map
What does the kernel do?
•
The kernel manages the running of
multiple applications and the
sharing of resources among multiple
users.
Functions of the Linux
kernel
The Linux kernel manages the running of multiple applications and the sharing of
resources among multiple users. It also controls the interface to the input/output
(I/O) devices that are connected to the computer, and it manages files and
directories.
12
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
•
Are computer programs that run in the background
•
Are not under the control of an interactive user
•
Typically provide a system service
•
Process names that traditionally end with the letter
d
•
Examples:
–
syslogd
–
sshd
Daemons
A daemon is computer program that runs in the background and is not under the
control of an interactive user. It typically provides a service to other running
programs.
Examples of daemons include the following:
•
syslogd
: When system or user applications generate messages, the
syslogd
daemon captures the messages and stores them to a file, which is called a
log
.
•
sshd
: The
sshd
daemon handles Secure Shell (SSH) connections to the computer.
This type of connection uses encryption to secure the communication between the
client and the server.
You will learn more about daemons in the
Managing Processes
lesson.
RSLX EN-US SG M02 INTROLINUX
<> of 35+-<->Close
4
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
•
Interface between user and hardware
•
Runs applications
Operating system
•
Central processing unit (CPU)
•
Random access memory (RAM)
•
Storage
•
Networking
Hardware
Hardware and operating systems
Computers consist
of hardware and software.
Hardware
refers to a computer’s physical components, such as its central processing
unit (CPU), memory, storage drive, and network card.
Software
is the collection of applications and programs that are installed on the
computer.
One key type of software that computers require is an operating system.
An operating system manages a computer’s hardware and software resources and
runs applications.
5
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
•
Is o
pen source
–
Code
is publicly available
,
and
users
can
m
odif
y
and expand
it
•
Supports multiple users and multi
-
tasking
•
Is b
uilt to handle networking
•
Provides system tools and utilities
The Linux
o
perating
s
ystem
Linux is an operating system that is freely distributable under the terms of the Gnu is
Not Unix (GNU) General Public License (GPL). It is open source because it provides
the source code for the core functionality of an operating system, called a
kernel
,
and users can modify and expand it. As a result, many
distributions
of Linux are
available today.
With Linux, multiple people can
use the same computer at the same time and can
run multiple applications simultaneously. It also supports network functionality and
provides system tools and utilities to increase usability.
6
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Was created in 1991 by Linux Torvalds
Is modular
Is stable
Is commonly used as a server operating system
Is also used as a desktop operating system
Linux history and benefits
Linus Torvalds, a graduate student at the University of Helsinki in Finland, created
Linux in 1991. Linux is similar to another operating system that is called
Unix
, which
was developed in the late 1960s.
In addition to being open source, Linux is modular, which means that you can extend
it. It is also stable and does not experience frequent system freezes that require
computer restarts. Because
of t
hese benefits, you can use Linux both as a desktop
system and a server operating system.
7
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Amazon Linux 2
•
Because Linux is open source, anyone can make a distribution and tailor it for a given
purpose.
•
A distribution is typically downloaded and can be installed by using various formats.
–
For example, by using an
Amazon Machine Image (AMI)
for
Amazon Linux 2
•
Examples:
–
Amazon Linux 2
–
Red Hat Enterprise Linux (RHEL)
–
Debian
–
Ubuntu
A
distribution
or
distro
is a packaged version of Linux.
Definition
Distributions
A
Linux distribution
is a packaged version of Linux that a group of individuals or a
company develops. It includes the core operating system functionality (
kernel
) and
additional complementary tools and software applications.
Distributions are typically downloaded but can also be installed by using various
media and formats. Examples include
compact disk (CD), Universal Serial Bus
(
USB)
device, and downloadable International Standardization for Organization (ISO)
image.
Examples of Linux distribution include Amazon Linux 2, Red Hat Enterprise Linux
(RHEL), Debian, and Ubuntu.
In the AWS Cloud, the Amazon Linux 2 operating system is readily distributed by using
an Amazon Machine Image (AMI). An AMI contains an operating system and other
pre
-
installed software relevant to the image.
You will learn more about Amazon Linux
2 in a later section.
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Linux components
This section describes the main features and components of the Linux operating
system.
9
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
•
Provides the core functionality of the operating system
Kernel
•
Provide extra support for the system or the user
Daemons
•
Include programs such as text editors, web browsers, and
databases
Applications
•
Include user content such as text files, music files, and image
files
Data files
•
Contain settings for Linux, services, and applications that are
stored in text files
Configuration files
Major components of Linux
The major components of a Linux distribution consist of a kernel, daemons,
applications, data files, and configuration files. You will review them in more detail in
the next slides.
10
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
•
An operating system kernel
is
:
–
A computer program
–
Ac
ontrol
ler of
everything in the operating system
•
The Linux kernel manages:
–
Scheduling of processor time
–
Memory allocation for the operating system and for applications
–
Access to peripheral devices (sound card, hard disk drive, network card,
and others
)
The Linux
k
ernel
The kernel refers to the core component of an operating
system
. It controls
everything in the operating
system, i
ncluding the allocation of CPU time and memory
storage to running programs, and access to peripheral devices.
11
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Processes
D
e
v
i
ce
s
Resource
allocation
File
system
access
Memory
Kernel
Kernel management as a map
What does the kernel do?
•
The kernel manages the running of
multiple applications and the
sharing of resources among multiple
users.
Functions of the Linux
kernel
The Linux kernel manages the running of multiple applications and the sharing of
resources among multiple users. It also controls the interface to the input/output
(I/O) devices that are connected to the computer, and it manages files and
directories.
12
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
•
Are computer programs that run in the background
•
Are not under the control of an interactive user
•
Typically provide a system service
•
Process names that traditionally end with the letter
d
•
Examples:
–
syslogd
–
sshd
Daemons
A daemon is computer program that runs in the background and is not under the
control of an interactive user. It typically provides a service to other running
programs.
Examples of daemons include the following:
•
syslogd
: When system or user applications generate messages, the
syslogd
daemon captures the messages and stores them to a file, which is called a
log
.
•
sshd
: The
sshd
daemon handles Secure Shell (SSH) connections to the computer.
This type of connection uses encryption to secure the communication between the
client and the server.
You will learn more about daemons in the
Managing Processes
lesson.
13
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Applications
•
Are s
oftware
that provides a set of functions that help a user
perform a type of task or activity
•
Examples:
–
Word processor
–
Web browser
–
Email client
–
Media player
An application, is a computer program that provides functions that help users
perform a type of task or activity. For example, with a word processor app, users can
create and edit text content, and this type of app facilitates document authoring and
modification. Likewise, with a web browser app, users
can
access the internet and
visit websites.
RSLX EN-US SG M02 INTROLINUX
<> of 35+-<->Close
5
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
•
Is o
pen source
–
Code
is publicly available
,
and
users
can
m
odif
y
and expand
it
•
Supports multiple users and multi
-
tasking
•
Is b
uilt to handle networking
•
Provides system tools and utilities
The Linux
o
perating
s
ystem
Linux is an operating system that is freely distributable under the terms of the Gnu is
Not Unix (GNU) General Public License (GPL). It is open source because it provides
the source code for the core functionality of an operating system, called a
kernel
,
and users can modify and expand it. As a result, many
distributions
of Linux are
available today.
With Linux, multiple people can
use the same computer at the same time and can
run multiple applications simultaneously. It also supports network functionality and
provides system tools and utilities to increase usability.
6
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Was created in 1991 by Linux Torvalds
Is modular
Is stable
Is commonly used as a server operating system
Is also used as a desktop operating system
Linux history and benefits
Linus Torvalds, a graduate student at the University of Helsinki in Finland, created
Linux in 1991. Linux is similar to another operating system that is called
Unix
, which
was developed in the late 1960s.
In addition to being open source, Linux is modular, which means that you can extend
it. It is also stable and does not experience frequent system freezes that require
computer restarts. Because
of t
hese benefits, you can use Linux both as a desktop
system and a server operating system.
7
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Amazon Linux 2
•
Because Linux is open source, anyone can make a distribution and tailor it for a given
purpose.
•
A distribution is typically downloaded and can be installed by using various formats.
–
For example, by using an
Amazon Machine Image (AMI)
for
Amazon Linux 2
•
Examples:
–
Amazon Linux 2
–
Red Hat Enterprise Linux (RHEL)
–
Debian
–
Ubuntu
A
distribution
or
distro
is a packaged version of Linux.
Definition
Distributions
A
Linux distribution
is a packaged version of Linux that a group of individuals or a
company develops. It includes the core operating system functionality (
kernel
) and
additional complementary tools and software applications.
Distributions are typically downloaded but can also be installed by using various
media and formats. Examples include
compact disk (CD), Universal Serial Bus
(
USB)
device, and downloadable International Standardization for Organization (ISO)
image.
Examples of Linux distribution include Amazon Linux 2, Red Hat Enterprise Linux
(RHEL), Debian, and Ubuntu.
In the AWS Cloud, the Amazon Linux 2 operating system is readily distributed by using
an Amazon Machine Image (AMI). An AMI contains an operating system and other
pre
-
installed software relevant to the image.
You will learn more about Amazon Linux
2 in a later section.
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Linux components
This section describes the main features and components of the Linux operating
system.
9
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
•
Provides the core functionality of the operating system
Kernel
•
Provide extra support for the system or the user
Daemons
•
Include programs such as text editors, web browsers, and
databases
Applications
•
Include user content such as text files, music files, and image
files
Data files
•
Contain settings for Linux, services, and applications that are
stored in text files
Configuration files
Major components of Linux
The major components of a Linux distribution consist of a kernel, daemons,
applications, data files, and configuration files. You will review them in more detail in
the next slides.
10
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
•
An operating system kernel
is
:
–
A computer program
–
Ac
ontrol
ler of
everything in the operating system
•
The Linux kernel manages:
–
Scheduling of processor time
–
Memory allocation for the operating system and for applications
–
Access to peripheral devices (sound card, hard disk drive, network card,
and others
)
The Linux
k
ernel
The kernel refers to the core component of an operating
system
. It controls
everything in the operating
system, i
ncluding the allocation of CPU time and memory
storage to running programs, and access to peripheral devices.
11
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Processes
D
e
v
i
ce
s
Resource
allocation
File
system
access
Memory
Kernel
Kernel management as a map
What does the kernel do?
•
The kernel manages the running of
multiple applications and the
sharing of resources among multiple
users.
Functions of the Linux
kernel
The Linux kernel manages the running of multiple applications and the sharing of
resources among multiple users. It also controls the interface to the input/output
(I/O) devices that are connected to the computer, and it manages files and
directories.
12
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
•
Are computer programs that run in the background
•
Are not under the control of an interactive user
•
Typically provide a system service
•
Process names that traditionally end with the letter
d
•
Examples:
–
syslogd
–
sshd
Daemons
A daemon is computer program that runs in the background and is not under the
control of an interactive user. It typically provides a service to other running
programs.
Examples of daemons include the following:
•
syslogd
: When system or user applications generate messages, the
syslogd
daemon captures the messages and stores them to a file, which is called a
log
.
•
sshd
: The
sshd
daemon handles Secure Shell (SSH) connections to the computer.
This type of connection uses encryption to secure the communication between the
client and the server.
You will learn more about daemons in the
Managing Processes
lesson.
13
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Applications
•
Are s
oftware
that provides a set of functions that help a user
perform a type of task or activity
•
Examples:
–
Word processor
–
Web browser
–
Email client
–
Media player
An application, is a computer program that provides functions that help users
perform a type of task or activity. For example, with a word processor app, users can
create and edit text content, and this type of app facilitates document authoring and
modification. Likewise, with a web browser app, users
can
access the internet and
visit websites.
14
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
•
Examples:
•
myFile
•
/pictures/dog.gif
[directoryName]
fileName
[.extension]
•
Files have a name that uniquely identifies
them and has the following format:
How to name a file?
•
Files contain the information that
programs use and can have different
types of data.
–
Examples:
music
file, t
ext
file, and
i
mage
file
•
Files can be grouped in directories.
What are data files?
Data
f
iles
A file contains information, or data, that
the user has created or
captured
. Files can
be of different types depending on the type of data that they contain. A program can
process the data in a file. Examples of data files include music, text, or image files.
Files are also typically grouped in directories for organizational purposes.
A file has a name that uniquely identifies it. The format of a complete file name
consists of an optional
directoryName
, the actual
fileName
, and an optional
extension
.A
period precedes
the extension
.
In the last file name example that is shown:
•
/pictures
is the directory name.
•
dog
is the file name.
•
.gif
is the extension.
RSLX EN-US SG M02 INTROLINUX
<> of 35+-<->Close
6
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Was created in 1991 by Linux Torvalds
Is modular
Is stable
Is commonly used as a server operating system
Is also used as a desktop operating system
Linux history and benefits
Linus Torvalds, a graduate student at the University of Helsinki in Finland, created
Linux in 1991. Linux is similar to another operating system that is called
Unix
, which
was developed in the late 1960s.
In addition to being open source, Linux is modular, which means that you can extend
it. It is also stable and does not experience frequent system freezes that require
computer restarts. Because
of t
hese benefits, you can use Linux both as a desktop
system and a server operating system.
7
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Amazon Linux 2
•
Because Linux is open source, anyone can make a distribution and tailor it for a given
purpose.
•
A distribution is typically downloaded and can be installed by using various formats.
–
For example, by using an
Amazon Machine Image (AMI)
for
Amazon Linux 2
•
Examples:
–
Amazon Linux 2
–
Red Hat Enterprise Linux (RHEL)
–
Debian
–
Ubuntu
A
distribution
or
distro
is a packaged version of Linux.
Definition
Distributions
A
Linux distribution
is a packaged version of Linux that a group of individuals or a
company develops. It includes the core operating system functionality (
kernel
) and
additional complementary tools and software applications.
Distributions are typically downloaded but can also be installed by using various
media and formats. Examples include
compact disk (CD), Universal Serial Bus
(
USB)
device, and downloadable International Standardization for Organization (ISO)
image.
Examples of Linux distribution include Amazon Linux 2, Red Hat Enterprise Linux
(RHEL), Debian, and Ubuntu.
In the AWS Cloud, the Amazon Linux 2 operating system is readily distributed by using
an Amazon Machine Image (AMI). An AMI contains an operating system and other
pre
-
installed software relevant to the image.
You will learn more about Amazon Linux
2 in a later section.
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Linux components
This section describes the main features and components of the Linux operating
system.
9
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
•
Provides the core functionality of the operating system
Kernel
•
Provide extra support for the system or the user
Daemons
•
Include programs such as text editors, web browsers, and
databases
Applications
•
Include user content such as text files, music files, and image
files
Data files
•
Contain settings for Linux, services, and applications that are
stored in text files
Configuration files
Major components of Linux
The major components of a Linux distribution consist of a kernel, daemons,
applications, data files, and configuration files. You will review them in more detail in
the next slides.
10
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
•
An operating system kernel
is
:
–
A computer program
–
Ac
ontrol
ler of
everything in the operating system
•
The Linux kernel manages:
–
Scheduling of processor time
–
Memory allocation for the operating system and for applications
–
Access to peripheral devices (sound card, hard disk drive, network card,
and others
)
The Linux
k
ernel
The kernel refers to the core component of an operating
system
. It controls
everything in the operating
system, i
ncluding the allocation of CPU time and memory
storage to running programs, and access to peripheral devices.
11
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Processes
D
e
v
i
ce
s
Resource
allocation
File
system
access
Memory
Kernel
Kernel management as a map
What does the kernel do?
•
The kernel manages the running of
multiple applications and the
sharing of resources among multiple
users.
Functions of the Linux
kernel
The Linux kernel manages the running of multiple applications and the sharing of
resources among multiple users. It also controls the interface to the input/output
(I/O) devices that are connected to the computer, and it manages files and
directories.
12
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
•
Are computer programs that run in the background
•
Are not under the control of an interactive user
•
Typically provide a system service
•
Process names that traditionally end with the letter
d
•
Examples:
–
syslogd
–
sshd
Daemons
A daemon is computer program that runs in the background and is not under the
control of an interactive user. It typically provides a service to other running
programs.
Examples of daemons include the following:
•
syslogd
: When system or user applications generate messages, the
syslogd
daemon captures the messages and stores them to a file, which is called a
log
.
•
sshd
: The
sshd
daemon handles Secure Shell (SSH) connections to the computer.
This type of connection uses encryption to secure the communication between the
client and the server.
You will learn more about daemons in the
Managing Processes
lesson.
13
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Applications
•
Are s
oftware
that provides a set of functions that help a user
perform a type of task or activity
•
Examples:
–
Word processor
–
Web browser
–
Email client
–
Media player
An application, is a computer program that provides functions that help users
perform a type of task or activity. For example, with a word processor app, users can
create and edit text content, and this type of app facilitates document authoring and
modification. Likewise, with a web browser app, users
can
access the internet and
visit websites.
14
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
•
Examples:
•
myFile
•
/pictures/dog.gif
[directoryName]
fileName
[.extension]
•
Files have a name that uniquely identifies
them and has the following format:
How to name a file?
•
Files contain the information that
programs use and can have different
types of data.
–
Examples:
music
file, t
ext
file, and
i
mage
file
•
Files can be grouped in directories.
What are data files?
Data
f
iles
A file contains information, or data, that
the user has created or
captured
. Files can
be of different types depending on the type of data that they contain. A program can
process the data in a file. Examples of data files include music, text, or image files.
Files are also typically grouped in directories for organizational purposes.
A file has a name that uniquely identifies it. The format of a complete file name
consists of an optional
directoryName
, the actual
fileName
, and an optional
extension
.A
period precedes
the extension
.
In the last file name example that is shown:
•
/pictures
is the directory name.
•
dog
is the file name.
•
.gif
is the extension.
15
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
•
Configuration files are a special type of file that contains initial settings or stores values
for a
system program.
–
Example: The
/etc/group
file
contains the list of users that are allowed to use the system.
•
Some config
uration
files run a set of commands at startup
.
•
Common
configuration
file
name extensions
are
:
–
.cnf
–
.conf
–
.cfg
–
.cf
–
.
ini
Configuration
f
iles
A Linux configuration file is a special type of file that stores initial settings or
important values for a system program. These values configure the behavior of the
associated program or capture the data that the program uses. For example, the
/etc/group
configuration file contains the list of authorized users for the system.
Some configuration files are used to run a set of commands when the system is
started or when the user logs in. With these
commands, the
Linux environment can
be customized to the specific preferences of the user.
Configuration file names use a common set of extensions, including
.cnf
and
.conf
.
RSLX EN-US SG M02 INTROLINUX
<> of 35+-<->Close
7
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Amazon Linux 2
•
Because Linux is open source, anyone can make a distribution and tailor it for a given
purpose.
•
A distribution is typically downloaded and can be installed by using various formats.
–
For example, by using an
Amazon Machine Image (AMI)
for
Amazon Linux 2
•
Examples:
–
Amazon Linux 2
–
Red Hat Enterprise Linux (RHEL)
–
Debian
–
Ubuntu
A
distribution
or
distro
is a packaged version of Linux.
Definition
Distributions
A
Linux distribution
is a packaged version of Linux that a group of individuals or a
company develops. It includes the core operating system functionality (
kernel
) and
additional complementary tools and software applications.
Distributions are typically downloaded but can also be installed by using various
media and formats. Examples include
compact disk (CD), Universal Serial Bus
(
USB)
device, and downloadable International Standardization for Organization (ISO)
image.
Examples of Linux distribution include Amazon Linux 2, Red Hat Enterprise Linux
(RHEL), Debian, and Ubuntu.
In the AWS Cloud, the Amazon Linux 2 operating system is readily distributed by using
an Amazon Machine Image (AMI). An AMI contains an operating system and other
pre
-
installed software relevant to the image.
You will learn more about Amazon Linux
2 in a later section.
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Linux components
This section describes the main features and components of the Linux operating
system.
9
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
•
Provides the core functionality of the operating system
Kernel
•
Provide extra support for the system or the user
Daemons
•
Include programs such as text editors, web browsers, and
databases
Applications
•
Include user content such as text files, music files, and image
files
Data files
•
Contain settings for Linux, services, and applications that are
stored in text files
Configuration files
Major components of Linux
The major components of a Linux distribution consist of a kernel, daemons,
applications, data files, and configuration files. You will review them in more detail in
the next slides.
10
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
•
An operating system kernel
is
:
–
A computer program
–
Ac
ontrol
ler of
everything in the operating system
•
The Linux kernel manages:
–
Scheduling of processor time
–
Memory allocation for the operating system and for applications
–
Access to peripheral devices (sound card, hard disk drive, network card,
and others
)
The Linux
k
ernel
The kernel refers to the core component of an operating
system
. It controls
everything in the operating
system, i
ncluding the allocation of CPU time and memory
storage to running programs, and access to peripheral devices.
11
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Processes
D
e
v
i
ce
s
Resource
allocation
File
system
access
Memory
Kernel
Kernel management as a map
What does the kernel do?
•
The kernel manages the running of
multiple applications and the
sharing of resources among multiple
users.
Functions of the Linux
kernel
The Linux kernel manages the running of multiple applications and the sharing of
resources among multiple users. It also controls the interface to the input/output
(I/O) devices that are connected to the computer, and it manages files and
directories.
12
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
•
Are computer programs that run in the background
•
Are not under the control of an interactive user
•
Typically provide a system service
•
Process names that traditionally end with the letter
d
•
Examples:
–
syslogd
–
sshd
Daemons
A daemon is computer program that runs in the background and is not under the
control of an interactive user. It typically provides a service to other running
programs.
Examples of daemons include the following:
•
syslogd
: When system or user applications generate messages, the
syslogd
daemon captures the messages and stores them to a file, which is called a
log
.
•
sshd
: The
sshd
daemon handles Secure Shell (SSH) connections to the computer.
This type of connection uses encryption to secure the communication between the
client and the server.
You will learn more about daemons in the
Managing Processes
lesson.
13
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Applications
•Are software that provides a set of functions that help a user
perform a type of task or activity
•Examples:
–Word processor
–Web browser
–Email client
–Media player
An application, is a computer program that provides functions that help users
perform a type of task or activity. For example, with a word processor app, users can
create and edit text content, and this type of app facilitates document authoring and
modification. Likewise, with a web browser app, users
can
access the internet and
visit websites.
14
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
•
Examples:
•
myFile
•
/pictures/dog.gif
[directoryName]
fileName
[.extension]
•
Files have a name that uniquely identifies
them and has the following format:
How to name a file?
•
Files contain the information that
programs use and can have different
types of data.
–
Examples:
music
file, t
ext
file, and
i
mage
file
•
Files can be grouped in directories.
What are data files?
Data
f
iles
A file contains information, or data, that
the user has created or
captured
. Files can
be of different types depending on the type of data that they contain. A program can
process the data in a file. Examples of data files include music, text, or image files.
Files are also typically grouped in directories for organizational purposes.
A file has a name that uniquely identifies it. The format of a complete file name
consists of an optional
directoryName
, the actual
fileName
, and an optional
extension
.A
period precedes
the extension
.
In the last file name example that is shown:
•
/pictures
is the directory name.
•
dog
is the file name.
•
.gif
is the extension.
15
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
•
Configuration files are a special type of file that contains initial settings or stores values
for a
system program.
–
Example: The
/etc/group
file
contains the list of users that are allowed to use the system.
•
Some config
uration
files run a set of commands at startup
.
•
Common
configuration
file
name extensions
are
:
–
.cnf
–
.conf
–
.cfg
–
.cf
–
.
ini
Configuration
f
iles
A Linux configuration file is a special type of file that stores initial settings or
important values for a system program. These values configure the behavior of the
associated program or capture the data that the program uses. For example, the
/etc/group
configuration file contains the list of authorized users for the system.
Some configuration files are used to run a set of commands when the system is
started or when the user logs in. With these
commands, the
Linux environment can
be customized to the specific preferences of the user.
Configuration file names use a common set of extensions, including
.cnf
and
.conf
.
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Linux user interface
This section covers
the different Linux user interfaces.
LINUX USER INTERFACE
RSLX EN-US SG M02 INTROLINUX
<> of 35+-<->Close
9
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
•
Provides the core functionality of the operating system
Kernel
•
Provide extra support for the system or the user
Daemons
•
Include programs such as text editors, web browsers, and
databases
Applications
•
Include user content such as text files, music files, and image
files
Data files
•
Contain settings for Linux, services, and applications that are
stored in text files
Configuration files
Major components of Linux
The major components of a Linux distribution consist of a kernel, daemons,
applications, data files, and configuration files. You will review them in more detail in
the next slides.
10
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
•
An operating system kernel
is
:
–
A computer program
–
Ac
ontrol
ler of
everything in the operating system
•
The Linux kernel manages:
–
Scheduling of processor time
–
Memory allocation for the operating system and for applications
–
Access to peripheral devices (sound card, hard disk drive, network card,
and others
)
The Linux
k
ernel
The kernel refers to the core component of an operating
system
. It controls
everything in the operating
system, i
ncluding the allocation of CPU time and memory
storage to running programs, and access to peripheral devices.
11
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Processes
D
e
v
i
ce
s
Resource
allocation
File
system
access
Memory
Kernel
Kernel management as a map
What does the kernel do?
•
The kernel manages the running of
multiple applications and the
sharing of resources among multiple
users.
Functions of the Linux
kernel
The Linux kernel manages the running of multiple applications and the sharing of
resources among multiple users. It also controls the interface to the input/output
(I/O) devices that are connected to the computer, and it manages files and
directories.
12
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
•
Are computer programs that run in the background
•
Are not under the control of an interactive user
•
Typically provide a system service
•
Process names that traditionally end with the letter
d
•
Examples:
–
syslogd
–
sshd
Daemons
A daemon is computer program that runs in the background and is not under the
control of an interactive user. It typically provides a service to other running
programs.
Examples of daemons include the following:
•
syslogd
: When system or user applications generate messages, the
syslogd
daemon captures the messages and stores them to a file, which is called a
log
.
•
sshd
: The
sshd
daemon handles Secure Shell (SSH) connections to the computer.
This type of connection uses encryption to secure the communication between the
client and the server.
You will learn more about daemons in the
Managing Processes
lesson.
13
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Applications
•
Are s
oftware
that provides a set of functions that help a user
perform a type of task or activity
•
Examples:
–
Word processor
–
Web browser
–
Email client
–
Media player
An application, is a computer program that provides functions that help users
perform a type of task or activity. For example, with a word processor app, users can
create and edit text content, and this type of app facilitates document authoring and
modification. Likewise, with a web browser app, users
can
access the internet and
visit websites.
14
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
•
Examples:
•
myFile
•
/pictures/dog.gif
[directoryName]
fileName
[.extension]
•
Files have a name that uniquely identifies
them and has the following format:
How to name a file?
•
Files contain the information that
programs use and can have different
types of data.
–
Examples:
music
file, t
ext
file, and
i
mage
file
•
Files can be grouped in directories.
What are data files?
Data
f
iles
A file contains information, or data, that
the user has created or
captured
. Files can
be of different types depending on the type of data that they contain. A program can
process the data in a file. Examples of data files include music, text, or image files.
Files are also typically grouped in directories for organizational purposes.
A file has a name that uniquely identifies it. The format of a complete file name
consists of an optional
directoryName
, the actual
fileName
, and an optional
extension
.A
period precedes
the extension
.
In the last file name example that is shown:
•
/pictures
is the directory name.
•
dog
is the file name.
•
.gif
is the extension.
15
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
•
Configuration files are a special type of file that contains initial settings or stores values
for a
system program.
–
Example: The
/etc/group
file
contains the list of users that are allowed to use the system.
•
Some config
uration
files run a set of commands at startup
.
•
Common
configuration
file
name extensions
are
:
–
.cnf
–
.conf
–
.cfg
–
.cf
–
.
ini
Configuration
f
iles
A Linux configuration file is a special type of file that stores initial settings or
important values for a system program. These values configure the behavior of the
associated program or capture the data that the program uses. For example, the
/etc/group
configuration file contains the list of authorized users for the system.
Some configuration files are used to run a set of commands when the system is
started or when the user logs in. With these
commands, the
Linux environment can
be customized to the specific preferences of the user.
Configuration file names use a common set of extensions, including
.cnf
and
.conf
.
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Linux user interface
This section covers
the different Linux user interfaces.
17
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
•
It is visual and intuitive to navigate.
•
It is similar in Linux, Microsoft Windows, and
macOS.
•
Most user workstations use the GUI.
Graphical user interface (GUI)
•
It consumes fewer hardware resources.
•
It can be automated with scripts.
•
It provides more options.
•
Most Linux servers use only the CLI.
Command line interface (CLI)
How to interface: CLI
compared with
GUI
You can use either the CLI or GUI based on
your preference.
18
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
The kernel functions
Processes
D
e
v
i
ce
s
Resource
allocation
File
system
access
Memory
Kernel
Bash shell
~] # sudo hi!
User interacts with
the shell
User
The
s
hell
When you use the CLI, the
shell
that you select defines the list of commands and
functions that you can run. A shell interprets the command that you type and invokes
the appropriate kernel component that runs the command.
You can use many types of shells, and each Linux distribution defines the types that it
can support.
RSLX EN-US SG M02 INTROLINUX
<> of 35+-<->Close
10
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
•
An operating system kernel
is
:
–
A computer program
–
Ac
ontrol
ler of
everything in the operating system
•
The Linux kernel manages:
–
Scheduling of processor time
–
Memory allocation for the operating system and for applications
–
Access to peripheral devices (sound card, hard disk drive, network card,
and others
)
The Linux
k
ernel
The kernel refers to the core component of an operating
system
. It controls
everything in the operating
system, i
ncluding the allocation of CPU time and memory
storage to running programs, and access to peripheral devices.
11
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Processes
D
e
v
i
ce
s
Resource
allocation
File
system
access
Memory
Kernel
Kernel management as a map
What does the kernel do?
•
The kernel manages the running of
multiple applications and the
sharing of resources among multiple
users.
Functions of the Linux
kernel
The Linux kernel manages the running of multiple applications and the sharing of
resources among multiple users. It also controls the interface to the input/output
(I/O) devices that are connected to the computer, and it manages files and
directories.
12
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
•
Are computer programs that run in the background
•
Are not under the control of an interactive user
•
Typically provide a system service
•
Process names that traditionally end with the letter
d
•
Examples:
–
syslogd
–
sshd
Daemons
A daemon is computer program that runs in the background and is not under the
control of an interactive user. It typically provides a service to other running
programs.
Examples of daemons include the following:
•
syslogd
: When system or user applications generate messages, the
syslogd
daemon captures the messages and stores them to a file, which is called a
log
.
•
sshd
: The
sshd
daemon handles Secure Shell (SSH) connections to the computer.
This type of connection uses encryption to secure the communication between the
client and the server.
You will learn more about daemons in the
Managing Processes
lesson.
13
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Applications
•
Are s
oftware
that provides a set of functions that help a user
perform a type of task or activity
•
Examples:
–
Word processor
–
Web browser
–
Email client
–
Media player
An application, is a computer program that provides functions that help users
perform a type of task or activity. For example, with a word processor app, users can
create and edit text content, and this type of app facilitates document authoring and
modification. Likewise, with a web browser app, users
can
access the internet and
visit websites.
14
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
•
Examples:
•
myFile
•
/pictures/dog.gif
[directoryName]
fileName
[.extension]
•
Files have a name that uniquely identifies
them and has the following format:
How to name a file?
•
Files contain the information that
programs use and can have different
types of data.
–
Examples:
music
file, t
ext
file, and
i
mage
file
•
Files can be grouped in directories.
What are data files?
Data
f
iles
A file contains information, or data, that
the user has created or
captured
. Files can
be of different types depending on the type of data that they contain. A program can
process the data in a file. Examples of data files include music, text, or image files.
Files are also typically grouped in directories for organizational purposes.
A file has a name that uniquely identifies it. The format of a complete file name
consists of an optional
directoryName
, the actual
fileName
, and an optional
extension
.A
period precedes
the extension
.
In the last file name example that is shown:
•
/pictures
is the directory name.
•
dog
is the file name.
•
.gif
is the extension.
15
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
•
Configuration files are a special type of file that contains initial settings or stores values
for a
system program.
–
Example: The
/etc/group
file
contains the list of users that are allowed to use the system.
•
Some config
uration
files run a set of commands at startup
.
•
Common
configuration
file
name extensions
are
:
–
.cnf
–
.conf
–
.cfg
–
.cf
–
.
ini
Configuration
f
iles
A Linux configuration file is a special type of file that stores initial settings or
important values for a system program. These values configure the behavior of the
associated program or capture the data that the program uses. For example, the
/etc/group
configuration file contains the list of authorized users for the system.
Some configuration files are used to run a set of commands when the system is
started or when the user logs in. With these
commands, the
Linux environment can
be customized to the specific preferences of the user.
Configuration file names use a common set of extensions, including
.cnf
and
.conf
.
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Linux user interface
This section covers
the different Linux user interfaces.
17
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
•
It is visual and intuitive to navigate.
•
It is similar in Linux, Microsoft Windows, and
macOS.
•
Most user workstations use the GUI.
Graphical user interface (GUI)
•
It consumes fewer hardware resources.
•
It can be automated with scripts.
•
It provides more options.
•
Most Linux servers use only the CLI.
Command line interface (CLI)
How to interface: CLI
compared with
GUI
You can use either the CLI or GUI based on
your preference.
18
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
The kernel functions
Processes
D
e
v
i
ce
s
Resource
allocation
File
system
access
Memory
Kernel
Bash shell
~] # sudo hi!
User interacts with
the shell
User
The
s
hell
When you use the CLI, the
shell
that you select defines the list of commands and
functions that you can run. A shell interprets the command that you type and invokes
the appropriate kernel component that runs the command.
You can use many types of shells, and each Linux distribution defines the types that it
can support.
19
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
•
Each shell has its own syntax or way of
formatting commands.
•
The shell provides the command prompt.
•
Note: Bash Shell
is the default Linux shell.
•
It is typically the only shell that you must
know for Linux.
•
It is the only shell that is covered in this
course.
Features of shell types
Shell
Description
sh
The
original
Bourne
shell
for
Unix
bash
The
Bourne
-
again
shel
l
and
the
default
Linux
shell
ksh
The
KornShell,
a
common
Unix
shell
Different shell types
Shell types
There are different shell types, but the only one you need to know for Linux is the
Bash Shell. An upcoming lesson will detail how to use the Bash Shell.
RSLX EN-US SG M02 INTROLINUX
<> of 35+-<->Close
11
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Processes
D
e
v
i
ce
s
Resource
allocation
File
system
access
Memory
Kernel
Kernel management as a map
What does the kernel do?
•
The kernel manages the running of
multiple applications and the
sharing of resources among multiple
users.
Functions of the Linux
kernel
The Linux kernel manages the running of multiple applications and the sharing of
resources among multiple users. It also controls the interface to the input/output
(I/O) devices that are connected to the computer, and it manages files and
directories.
12
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
•
Are computer programs that run in the background
•
Are not under the control of an interactive user
•
Typically provide a system service
•
Process names that traditionally end with the letter
d
•
Examples:
–
syslogd
–
sshd
Daemons
A daemon is computer program that runs in the background and is not under the
control of an interactive user. It typically provides a service to other running
programs.
Examples of daemons include the following:
•
syslogd
: When system or user applications generate messages, the
syslogd
daemon captures the messages and stores them to a file, which is called a
log
.
•
sshd
: The
sshd
daemon handles Secure Shell (SSH) connections to the computer.
This type of connection uses encryption to secure the communication between the
client and the server.
You will learn more about daemons in the
Managing Processes
lesson.
13
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Applications
•
Are s
oftware
that provides a set of functions that help a user
perform a type of task or activity
•
Examples:
–
Word processor
–
Web browser
–
Email client
–
Media player
An application, is a computer program that provides functions that help users
perform a type of task or activity. For example, with a word processor app, users can
create and edit text content, and this type of app facilitates document authoring and
modification. Likewise, with a web browser app, users
can
access the internet and
visit websites.
14
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
•
Examples:
•
myFile
•
/pictures/dog.gif
[directoryName]
fileName
[.extension]
•
Files have a name that uniquely identifies
them and has the following format:
How to name a file?
•
Files contain the information that
programs use and can have different
types of data.
–
Examples:
music
file, t
ext
file, and
i
mage
file
•
Files can be grouped in directories.
What are data files?
Data
f
iles
A file contains information, or data, that
the user has created or
captured
. Files can
be of different types depending on the type of data that they contain. A program can
process the data in a file. Examples of data files include music, text, or image files.
Files are also typically grouped in directories for organizational purposes.
A file has a name that uniquely identifies it. The format of a complete file name
consists of an optional
directoryName
, the actual
fileName
, and an optional
extension
.A
period precedes
the extension
.
In the last file name example that is shown:
•
/pictures
is the directory name.
•
dog
is the file name.
•
.gif
is the extension.
15
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
•
Configuration files are a special type of file that contains initial settings or stores values
for a
system program.
–
Example: The
/etc/group
file
contains the list of users that are allowed to use the system.
•
Some config
uration
files run a set of commands at startup
.
•
Common
configuration
file
name extensions
are
:
–
.cnf
–
.conf
–
.cfg
–
.cf
–
.
ini
Configuration
f
iles
A Linux configuration file is a special type of file that stores initial settings or
important values for a system program. These values configure the behavior of the
associated program or capture the data that the program uses. For example, the
/etc/group
configuration file contains the list of authorized users for the system.
Some configuration files are used to run a set of commands when the system is
started or when the user logs in. With these
commands, the
Linux environment can
be customized to the specific preferences of the user.
Configuration file names use a common set of extensions, including
.cnf
and
.conf
.
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Linux user interface
This section covers
the different Linux user interfaces.
17
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
•
It is visual and intuitive to navigate.
•
It is similar in Linux, Microsoft Windows, and
macOS.
•
Most user workstations use the GUI.
Graphical user interface (GUI)
•
It consumes fewer hardware resources.
•
It can be automated with scripts.
•
It provides more options.
•
Most Linux servers use only the CLI.
Command line interface (CLI)
How to interface: CLI
compared with
GUI
You can use either the CLI or GUI based on
your preference.
18
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
The kernel functions
Processes
D
e
v
i
ce
s
Resource
allocation
File
system
access
Memory
Kernel
Bash shell
~] # sudo hi!
User interacts with
the shell
User
The
s
hell
When you use the CLI, the
shell
that you select defines the list of commands and
functions that you can run. A shell interprets the command that you type and invokes
the appropriate kernel component that runs the command.
You can use many types of shells, and each Linux distribution defines the types that it
can support.
19
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
•
Each shell has its own syntax or way of
formatting commands.
•
The shell provides the command prompt.
•
Note: Bash Shell
is the default Linux shell.
•
It is typically the only shell that you must
know for Linux.
•
It is the only shell that is covered in this
course.
Features of shell types
Shell
Description
sh
The
original
Bourne
shell
for
Unix
bash
The
Bourne
-
again
shel
l
and
the
default
Linux
shell
ksh
The
KornShell,
a
common
Unix
shell
Different shell types
Shell types
There are different shell types, but the only one you need to know for Linux is the
Bash Shell. An upcoming lesson will detail how to use the Bash Shell.
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Linux documentation
In this section, you learn to use the built
-
in Linux documentation.
LINUX DOCUMENTATION
RSLX EN-US SG M02 INTROLINUX
<> of 35+-<->Close
13
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Applications
•
Are s
oftware
that provides a set of functions that help a user
perform a type of task or activity
•
Examples:
–
Word processor
–
Web browser
–
Email client
–
Media player
An application, is a computer program that provides functions that help users
perform a type of task or activity. For example, with a word processor app, users can
create and edit text content, and this type of app facilitates document authoring and
modification. Likewise, with a web browser app, users
can
access the internet and
visit websites.
14
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
•
Examples:
•
myFile
•
/pictures/dog.gif
[directoryName]
fileName
[.extension]
•
Files have a name that uniquely identifies
them and has the following format:
How to name a file?
•
Files contain the information that
programs use and can have different
types of data.
–
Examples:
music
file, t
ext
file, and
i
mage
file
•
Files can be grouped in directories.
What are data files?
Data
f
iles
A file contains information, or data, that
the user has created or
captured
. Files can
be of different types depending on the type of data that they contain. A program can
process the data in a file. Examples of data files include music, text, or image files.
Files are also typically grouped in directories for organizational purposes.
A file has a name that uniquely identifies it. The format of a complete file name
consists of an optional
directoryName
, the actual
fileName
, and an optional
extension
.A
period precedes
the extension
.
In the last file name example that is shown:
•
/pictures
is the directory name.
•
dog
is the file name.
•
.gif
is the extension.
15
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
•
Configuration files are a special type of file that contains initial settings or stores values
for a
system program.
–
Example: The
/etc/group
file
contains the list of users that are allowed to use the system.
•
Some config
uration
files run a set of commands at startup
.
•
Common
configuration
file
name extensions
are
:
–
.cnf
–
.conf
–
.cfg
–
.cf
–
.
ini
Configuration
f
iles
A Linux configuration file is a special type of file that stores initial settings or
important values for a system program. These values configure the behavior of the
associated program or capture the data that the program uses. For example, the
/etc/group
configuration file contains the list of authorized users for the system.
Some configuration files are used to run a set of commands when the system is
started or when the user logs in. With these
commands, the
Linux environment can
be customized to the specific preferences of the user.
Configuration file names use a common set of extensions, including
.cnf
and
.conf
.
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Linux user interface
This section covers
the different Linux user interfaces.
17
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
•
It is visual and intuitive to navigate.
•
It is similar in Linux, Microsoft Windows, and
macOS.
•
Most user workstations use the GUI.
Graphical user interface (GUI)
•
It consumes fewer hardware resources.
•
It can be automated with scripts.
•
It provides more options.
•
Most Linux servers use only the CLI.
Command line interface (CLI)
How to interface: CLI
compared with
GUI
You can use either the CLI or GUI based on
your preference.
18
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
The kernel functions
Processes
D
e
v
i
ce
s
Resource
allocation
File
system
access
Memory
Kernel
Bash shell
~] # sudo hi!
User interacts with
the shell
User
The
s
hell
When you use the CLI, the
shell
that you select defines the list of commands and
functions that you can run. A shell interprets the command that you type and invokes
the appropriate kernel component that runs the command.
You can use many types of shells, and each Linux distribution defines the types that it
can support.
19
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
•
Each shell has its own syntax or way of
formatting commands.
•
The shell provides the command prompt.
•
Note: Bash Shell
is the default Linux shell.
•
It is typically the only shell that you must
know for Linux.
•
It is the only shell that is covered in this
course.
Features of shell types
Shell
Description
sh
The
original
Bourne
shell
for
Unix
bash
The
Bourne
-
again
shel
l
and
the
default
Linux
shell
ksh
The
KornShell,
a
common
Unix
shell
Different shell types
Shell types
There are different shell types, but the only one you need to know for Linux is the
Bash Shell. An upcoming lesson will detail how to use the Bash Shell.
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Linux documentation
In this section, you learn to use the built
-
in Linux documentation.
21
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Did you check the man pages?
I'm lost and don’t understand this
command!
When you ask a Linux person for help:
•
The Linux manual pages, or
man pages
, contain the
documentation for Linux commands.
•
The man pages provide a brief summary of the
purpose, syntax, and options that are associated with
a particular command.
•
You access the man pages by using the
man
command.
Manual pages
The primary source of Linux documentation is the manual pages. They contain a
description of the purpose, syntax, and options for a Linux command.
When you ask a Linux person for help, the most likely first answer that you will get is,
“Did you check the man pages?”
You access the man pages by using the
man
command.
22
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
What is the man command?
•
You view the manual page for a
command
•
The following is common information
that is displayed for a command:
–
Name
–
Synopsis
–
Description
–
Options
The output that is displayed
The man command
Linux syntax:
man <commandName>
The command:
man man
Understanding the syntax
The man command displays documentation information for the command that you
specify as its argument. This information includes the following:
•
Name
: The name and a brief description of the purpose of the command
•
Synopsis
: The syntax of the command
•
Description
: A detailed description the command’s usage and functions
•
Options
: An explanation of the command’s options
The example screen capture shows the output of the
man
command.
RSLX EN-US SG M02 INTROLINUX
<> of 35+-<->Close
14
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
•
Examples:
•
myFile
•
/pictures/dog.gif
[directoryName]
fileName
[.extension]
•
Files have a name that uniquely identifies
them and has the following format:
How to name a file?
•
Files contain the information that
programs use and can have different
types of data.
–
Examples:
music
file, t
ext
file, and
i
mage
file
•
Files can be grouped in directories.
What are data files?
Data
f
iles
A file contains information, or data, that
the user has created or
captured
. Files can
be of different types depending on the type of data that they contain. A program can
process the data in a file. Examples of data files include music, text, or image files.
Files are also typically grouped in directories for organizational purposes.
A file has a name that uniquely identifies it. The format of a complete file name
consists of an optional
directoryName
, the actual
fileName
, and an optional
extension
.A
period precedes
the extension
.
In the last file name example that is shown:
•
/pictures
is the directory name.
•
dog
is the file name.
•
.gif
is the extension.
15
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
•
Configuration files are a special type of file that contains initial settings or stores values
for a
system program.
–
Example: The
/etc/group
file
contains the list of users that are allowed to use the system.
•
Some config
uration
files run a set of commands at startup
.
•
Common
configuration
file
name extensions
are
:
–
.cnf
–
.conf
–
.cfg
–
.cf
–
.
ini
Configuration
f
iles
A Linux configuration file is a special type of file that stores initial settings or
important values for a system program. These values configure the behavior of the
associated program or capture the data that the program uses. For example, the
/etc/group
configuration file contains the list of authorized users for the system.
Some configuration files are used to run a set of commands when the system is
started or when the user logs in. With these
commands, the
Linux environment can
be customized to the specific preferences of the user.
Configuration file names use a common set of extensions, including
.cnf
and
.conf
.
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Linux user interface
This section covers
the different Linux user interfaces.
17
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
•
It is visual and intuitive to navigate.
•
It is similar in Linux, Microsoft Windows, and
macOS.
•
Most user workstations use the GUI.
Graphical user interface (GUI)
•
It consumes fewer hardware resources.
•
It can be automated with scripts.
•
It provides more options.
•
Most Linux servers use only the CLI.
Command line interface (CLI)
How to interface: CLI
compared with
GUI
You can use either the CLI or GUI based on
your preference.
18
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
The kernel functions
Processes
D
e
v
i
ce
s
Resource
allocation
File
system
access
Memory
Kernel
Bash shell
~] # sudo hi!
User interacts with
the shell
User
The
s
hell
When you use the CLI, the
shell
that you select defines the list of commands and
functions that you can run. A shell interprets the command that you type and invokes
the appropriate kernel component that runs the command.
You can use many types of shells, and each Linux distribution defines the types that it
can support.
19
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
•
Each shell has its own syntax or way of
formatting commands.
•
The shell provides the command prompt.
•
Note: Bash Shell
is the default Linux shell.
•
It is typically the only shell that you must
know for Linux.
•
It is the only shell that is covered in this
course.
Features of shell types
Shell
Description
sh
The
original
Bourne
shell
for
Unix
bash
The
Bourne
-
again
shel
l
and
the
default
Linux
shell
ksh
The
KornShell,
a
common
Unix
shell
Different shell types
Shell types
There are different shell types, but the only one you need to know for Linux is the
Bash Shell. An upcoming lesson will detail how to use the Bash Shell.
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Linux documentation
In this section, you learn to use the built
-
in Linux documentation.
21
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Did you check the man pages?
I'm lost and don’t understand this
command!
When you ask a Linux person for help:
•
The Linux manual pages, or
man pages
, contain the
documentation for Linux commands.
•
The man pages provide a brief summary of the
purpose, syntax, and options that are associated with
a particular command.
•
You access the man pages by using the
man
command.
Manual pages
The primary source of Linux documentation is the manual pages. They contain a
description of the purpose, syntax, and options for a Linux command.
When you ask a Linux person for help, the most likely first answer that you will get is,
“Did you check the man pages?”
You access the man pages by using the
man
command.
22
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
What is the man command?
•
You view the manual page for a
command
•
The following is common information
that is displayed for a command:
–
Name
–
Synopsis
–
Description
–
Options
The output that is displayed
The man command
Linux syntax:
man <commandName>
The command:
man man
Understanding the syntax
The man command displays documentation information for the command that you
specify as its argument. This information includes the following:
•
Name
: The name and a brief description of the purpose of the command
•
Synopsis
: The syntax of the command
•
Description
: A detailed description the command’s usage and functions
•
Options
: An explanation of the command’s options
The example screen capture shows the output of the
man
command.
23
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
•
You typically
use
the man command
to
determine a command’s syntax and available options.
•
You can navigate through the multiple pages of documentation by using keyboard keys:
•
Up
or
Down arrow
key: Scrolls up or down one line, respectively
•
Page
-
up
or
Page
-
down
key: Scrolls up or down one page, respectively
•
Space bar
: Scrolls down one page
•
To search for a string in the documentation, use the forward slash key:
•
/<searchString>
•
Enter
q
to exit the documentation.
Command features of the man command
Using the man command, you can determine the syntax of a particular command. It is
also very useful in understanding a command’s options.
The documentation that is displayed for a command will typically consist of many
pages. To navigate through the pages, use the following keyboard keys:
•
Up arrow
or
Down arrow
key: Scrolls up or down one line, respectively
•
Page
-
up
or
Page
-
down
key: Scrolls up or down one page, respectively
•
Space bar
: Scrolls down one page
You can also search a command’s man page by using the forward slash (/) character:
/<searchString>
To exit the manual pages, enter
q
.
RSLX EN-US SG M02 INTROLINUX
<> of 35+-<->Close
15
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
•
Configuration files are a special type of file that contains initial settings or stores values
for a
system program.
–
Example: The
/etc/group
file
contains the list of users that are allowed to use the system.
•
Some config
uration
files run a set of commands at startup
.
•
Common
configuration
file
name extensions
are
:
–
.cnf
–
.conf
–
.cfg
–
.cf
–
.
ini
Configuration
f
iles
A Linux configuration file is a special type of file that stores initial settings or
important values for a system program. These values configure the behavior of the
associated program or capture the data that the program uses. For example, the
/etc/group
configuration file contains the list of authorized users for the system.
Some configuration files are used to run a set of commands when the system is
started or when the user logs in. With these
commands, the
Linux environment can
be customized to the specific preferences of the user.
Configuration file names use a common set of extensions, including
.cnf
and
.conf
.
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Linux user interface
This section covers
the different Linux user interfaces.
17
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
•
It is visual and intuitive to navigate.
•
It is similar in Linux, Microsoft Windows, and
macOS.
•
Most user workstations use the GUI.
Graphical user interface (GUI)
•
It consumes fewer hardware resources.
•
It can be automated with scripts.
•
It provides more options.
•
Most Linux servers use only the CLI.
Command line interface (CLI)
How to interface: CLI
compared with
GUI
You can use either the CLI or GUI based on
your preference.
18
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
The kernel functions
Processes
D
e
v
i
ce
s
Resource
allocation
File
system
access
Memory
Kernel
Bash shell
~] # sudo hi!
User interacts with
the shell
User
The
s
hell
When you use the CLI, the
shell
that you select defines the list of commands and
functions that you can run. A shell interprets the command that you type and invokes
the appropriate kernel component that runs the command.
You can use many types of shells, and each Linux distribution defines the types that it
can support.
19
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
•
Each shell has its own syntax or way of
formatting commands.
•
The shell provides the command prompt.
•
Note: Bash Shell
is the default Linux shell.
•
It is typically the only shell that you must
know for Linux.
•
It is the only shell that is covered in this
course.
Features of shell types
Shell
Description
sh
The
original
Bourne
shell
for
Unix
bash
The
Bourne
-
again
shel
l
and
the
default
Linux
shell
ksh
The
KornShell,
a
common
Unix
shell
Different shell types
Shell types
There are different shell types, but the only one you need to know for Linux is the
Bash Shell. An upcoming lesson will detail how to use the Bash Shell.
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Linux documentation
In this section, you learn to use the built
-
in Linux documentation.
21
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Did you check the man pages?
I'm lost and don’t understand this
command!
When you ask a Linux person for help:
•
The Linux manual pages, or
man pages
, contain the
documentation for Linux commands.
•
The man pages provide a brief summary of the
purpose, syntax, and options that are associated with
a particular command.
•
You access the man pages by using the
man
command.
Manual pages
The primary source of Linux documentation is the manual pages. They contain a
description of the purpose, syntax, and options for a Linux command.
When you ask a Linux person for help, the most likely first answer that you will get is,
“Did you check the man pages?”
You access the man pages by using the
man
command.
22
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
What is the man command?
•
You view the manual page for a
command
•
The following is common information
that is displayed for a command:
–
Name
–
Synopsis
–
Description
–
Options
The output that is displayed
The man command
Linux syntax:
man <commandName>
The command:
man man
Understanding the syntax
The man command displays documentation information for the command that you
specify as its argument. This information includes the following:
•
Name
: The name and a brief description of the purpose of the command
•
Synopsis
: The syntax of the command
•
Description
: A detailed description the command’s usage and functions
•
Options
: An explanation of the command’s options
The example screen capture shows the output of the
man
command.
23
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
•
You typically
use
the man command
to
determine a command’s syntax and available options.
•
You can navigate through the multiple pages of documentation by using keyboard keys:
•
Up
or
Down arrow
key: Scrolls up or down one line, respectively
•
Page
-
up
or
Page
-
down
key: Scrolls up or down one page, respectively
•
Space bar
: Scrolls down one page
•
To search for a string in the documentation, use the forward slash key:
•
/<searchString>
•
Enter
q
to exit the documentation.
Command features of the man command
Using the man command, you can determine the syntax of a particular command. It is
also very useful in understanding a command’s options.
The documentation that is displayed for a command will typically consist of many
pages. To navigate through the pages, use the following keyboard keys:
•
Up arrow
or
Down arrow
key: Scrolls up or down one line, respectively
•
Page
-
up
or
Page
-
down
key: Scrolls up or down one page, respectively
•
Space bar
: Scrolls down one page
You can also search a command’s man page by using the forward slash (/) character:
/<searchString>
To exit the manual pages, enter
q
.
Linux distributions
This section lists the different Linux distributions.
LINUX DISTRIBUTION
RSLX EN-US SG M02 INTROLINUX
<> of 35+-<->Close
17
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
•
It is visual and intuitive to navigate.
•
It is similar in Linux, Microsoft Windows, and
macOS.
•
Most user workstations use the GUI.
Graphical user interface (GUI)
•
It consumes fewer hardware resources.
•
It can be automated with scripts.
•
It provides more options.
•
Most Linux servers use only the CLI.
Command line interface (CLI)
How to interface: CLI
compared with
GUI
You can use either the CLI or GUI based on
your preference.
18
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
The kernel functions
Processes
D
e
v
i
ce
s
Resource
allocation
File
system
access
Memory
Kernel
Bash shell
~] # sudo hi!
User interacts with
the shell
User
The
s
hell
When you use the CLI, the
shell
that you select defines the list of commands and
functions that you can run. A shell interprets the command that you type and invokes
the appropriate kernel component that runs the command.
You can use many types of shells, and each Linux distribution defines the types that it
can support.
19
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
•
Each shell has its own syntax or way of
formatting commands.
•
The shell provides the command prompt.
•
Note: Bash Shell
is the default Linux shell.
•
It is typically the only shell that you must
know for Linux.
•
It is the only shell that is covered in this
course.
Features of shell types
Shell
Description
sh
The
original
Bourne
shell
for
Unix
bash
The
Bourne
-
again
shel
l
and
the
default
Linux
shell
ksh
The
KornShell,
a
common
Unix
shell
Different shell types
Shell types
There are different shell types, but the only one you need to know for Linux is the
Bash Shell. An upcoming lesson will detail how to use the Bash Shell.
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Linux documentation
In this section, you learn to use the built
-
in Linux documentation.
21
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Did you check the man pages?
I'm lost and don’t understand this
command!
When you ask a Linux person for help:
•
The Linux manual pages, or
man pages
, contain the
documentation for Linux commands.
•
The man pages provide a brief summary of the
purpose, syntax, and options that are associated with
a particular command.
•
You access the man pages by using the
man
command.
Manual pages
The primary source of Linux documentation is the manual pages. They contain a
description of the purpose, syntax, and options for a Linux command.
When you ask a Linux person for help, the most likely first answer that you will get is,
“Did you check the man pages?”
You access the man pages by using the
man
command.
22
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
What is the man command?
•
You view the manual page for a
command
•
The following is common information
that is displayed for a command:
–
Name
–
Synopsis
–
Description
–
Options
The output that is displayed
The man command
Linux syntax:
man <commandName>
The command:
man man
Understanding the syntax
The man command displays documentation information for the command that you
specify as its argument. This information includes the following:
•
Name
: The name and a brief description of the purpose of the command
•
Synopsis
: The syntax of the command
•
Description
: A detailed description the command’s usage and functions
•
Options
: An explanation of the command’s options
The example screen capture shows the output of the
man
command.
23
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
•
You typically
use
the man command
to
determine a command’s syntax and available options.
•
You can navigate through the multiple pages of documentation by using keyboard keys:
•
Up
or
Down arrow
key: Scrolls up or down one line, respectively
•
Page
-
up
or
Page
-
down
key: Scrolls up or down one page, respectively
•
Space bar
: Scrolls down one page
•
To search for a string in the documentation, use the forward slash key:
•
/<searchString>
•
Enter
q
to exit the documentation.
Command features of the man command
Using the man command, you can determine the syntax of a particular command. It is
also very useful in understanding a command’s options.
The documentation that is displayed for a command will typically consist of many
pages. To navigate through the pages, use the following keyboard keys:
•
Up arrow
or
Down arrow
key: Scrolls up or down one line, respectively
•
Page
-
up
or
Page
-
down
key: Scrolls up or down one page, respectively
•
Space bar
: Scrolls down one page
You can also search a command’s man page by using the forward slash (/) character:
/<searchString>
To exit the manual pages, enter
q
.
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Linux distributions
This section lists the different Linux distributions.
25
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Fedora
RHEL
CentOS
Debian
Ubuntu
OpenSUSE
SUSE
Enterprise
Linux
Amazon Linux 2
A distribution includes the Linux kernel and complementary tools and software
applications.
Sources of major distributions
A Linux distribution includes the Linux kernel and the tools, libraries, and other
software applications that the vendor has packaged. Most widely
used distributions
are derived from the following sources:
•
Fedora
: Red Hat, an IBM company, mainly sponsors this distribution. Fedora is
used to develop, test, and mature the Linux operating system. Fedora is the source
of the commercially distributed RHEL from which the Amazon Linux 2 and CentOS
distributions are derived.
•
Debian
: This
Linux distribution adheres strongly to the free software principles of
open source. The Ubuntu distribution is derived from Debian, and the British
company Canonical Ltd. maintains
it.
•
OpenSUSE
: The German company SUSE sponsors this distribution
, which is
used
as the basis for the company’s commercially supported SUSE Enterprise Linux
offering.
26
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Amazon Linux
2
Enterprise
-
class Linux
distribution
Derived from RHEL
Designed for use on AWS
virtual machines
Amazon Linux 2
Amazon Linux 2 is the latest Linux operating system that AWS offers. It is designed to
provide a stable, secure, and high
-
performance runtime environment for applications
that run on Amazon Elastic Compute Cloud (Amazon EC2). It supports the latest EC2
instance type features and includes packages that facilitate integration with AWS.
Amazon Linux 2 enhances security by automatically applying critical or important
security updates when an instance is booted.
For more information on Amazon Linux 2, see
https://aws.amazon.com/amazon
-
linux
-
2/
.
RSLX EN-US SG M02 INTROLINUX
<> of 35+-<->Close
18
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
The kernel functions
Processes
D
e
v
i
ce
s
Resource
allocation
File
system
access
Memory
Kernel
Bash shell
~] # sudo hi!
User interacts with
the shell
User
The
s
hell
When you use the CLI, the
shell
that you select defines the list of commands and
functions that you can run. A shell interprets the command that you type and invokes
the appropriate kernel component that runs the command.
You can use many types of shells, and each Linux distribution defines the types that it
can support.
19
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
•
Each shell has its own syntax or way of
formatting commands.
•
The shell provides the command prompt.
•
Note: Bash Shell
is the default Linux shell.
•
It is typically the only shell that you must
know for Linux.
•
It is the only shell that is covered in this
course.
Features of shell types
Shell
Description
sh
The
original
Bourne
shell
for
Unix
bash
The
Bourne
-
again
shel
l
and
the
default
Linux
shell
ksh
The
KornShell,
a
common
Unix
shell
Different shell types
Shell types
There are different shell types, but the only one you need to know for Linux is the
Bash Shell. An upcoming lesson will detail how to use the Bash Shell.
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Linux documentation
In this section, you learn to use the built
-
in Linux documentation.
21
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Did you check the man pages?
I'm lost and don’t understand this
command!
When you ask a Linux person for help:
•
The Linux manual pages, or
man pages
, contain the
documentation for Linux commands.
•
The man pages provide a brief summary of the
purpose, syntax, and options that are associated with
a particular command.
•
You access the man pages by using the
man
command.
Manual pages
The primary source of Linux documentation is the manual pages. They contain a
description of the purpose, syntax, and options for a Linux command.
When you ask a Linux person for help, the most likely first answer that you will get is,
“Did you check the man pages?”
You access the man pages by using the
man
command.
22
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
What is the man command?
•
You view the manual page for a
command
•
The following is common information
that is displayed for a command:
–
Name
–
Synopsis
–
Description
–
Options
The output that is displayed
The man command
Linux syntax:
man <commandName>
The command:
man man
Understanding the syntax
The man command displays documentation information for the command that you
specify as its argument. This information includes the following:
•
Name
: The name and a brief description of the purpose of the command
•
Synopsis
: The syntax of the command
•
Description
: A detailed description the command’s usage and functions
•
Options
: An explanation of the command’s options
The example screen capture shows the output of the
man
command.
23
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
•
You typically
use
the man command
to
determine a command’s syntax and available options.
•
You can navigate through the multiple pages of documentation by using keyboard keys:
•
Up
or
Down arrow
key: Scrolls up or down one line, respectively
•
Page
-
up
or
Page
-
down
key: Scrolls up or down one page, respectively
•
Space bar
: Scrolls down one page
•
To search for a string in the documentation, use the forward slash key:
•
/<searchString>
•
Enter
q
to exit the documentation.
Command features of the man command
Using the man command, you can determine the syntax of a particular command. It is
also very useful in understanding a command’s options.
The documentation that is displayed for a command will typically consist of many
pages. To navigate through the pages, use the following keyboard keys:
•
Up arrow
or
Down arrow
key: Scrolls up or down one line, respectively
•
Page
-
up
or
Page
-
down
key: Scrolls up or down one page, respectively
•
Space bar
: Scrolls down one page
You can also search a command’s man page by using the forward slash (/) character:
/<searchString>
To exit the manual pages, enter
q
.
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Linux distributions
This section lists the different Linux distributions.
25
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Fedora
RHEL
CentOS
Debian
Ubuntu
OpenSUSE
SUSE
Enterprise
Linux
Amazon Linux 2
A distribution includes the Linux kernel and complementary tools and software
applications.
Sources of major distributions
A Linux distribution includes the Linux kernel and the tools, libraries, and other
software applications that the vendor has packaged. Most widely
used distributions
are derived from the following sources:
•
Fedora
: Red Hat, an IBM company, mainly sponsors this distribution. Fedora is
used to develop, test, and mature the Linux operating system. Fedora is the source
of the commercially distributed RHEL from which the Amazon Linux 2 and CentOS
distributions are derived.
•
Debian
: This
Linux distribution adheres strongly to the free software principles of
open source. The Ubuntu distribution is derived from Debian, and the British
company Canonical Ltd. maintains
it.
•
OpenSUSE
: The German company SUSE sponsors this distribution
, which is
used
as the basis for the company’s commercially supported SUSE Enterprise Linux
offering.
26
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Amazon Linux
2
Enterprise
-
class Linux
distribution
Derived from RHEL
Designed for use on AWS
virtual machines
Amazon Linux 2
Amazon Linux 2 is the latest Linux operating system that AWS offers. It is designed to
provide a stable, secure, and high
-
performance runtime environment for applications
that run on Amazon Elastic Compute Cloud (Amazon EC2). It supports the latest EC2
instance type features and includes packages that facilitate integration with AWS.
Amazon Linux 2 enhances security by automatically applying critical or important
security updates when an instance is booted.
For more information on Amazon Linux 2, see
https://aws.amazon.com/amazon
-
linux
-
2/
.
27
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Stands for Community Enterprise Operating System
Is an enterprise
-
class Linux distribution
Is derived from RHEL
Was replaced by
CentOS Stream
as of December 2020
Cen
tOS
CentOS (or Community Enterprise Operating System)
is a free Linux distribution and is
functionally compatible with its upstream source, RHEL.
CentOS is currently used in the lab environment for this course.
As of December 2020, Red Hat has cancelled any further development for CentOS
Linux and replaced it with CentOS Stream.
RSLX EN-US SG M02 INTROLINUX
<> of 35+-<->Close
19
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
•
Each shell has its own syntax or way of
formatting commands.
•
The shell provides the command prompt.
•
Note: Bash Shell
is the default Linux shell.
•
It is typically the only shell that you must
know for Linux.
•
It is the only shell that is covered in this
course.
Features of shell types
Shell
Description
sh
The
original
Bourne
shell
for
Unix
bash
The
Bourne
-
again
shel
l
and
the
default
Linux
shell
ksh
The
KornShell,
a
common
Unix
shell
Different shell types
Shell types
There are different shell types, but the only one you need to know for Linux is the
Bash Shell. An upcoming lesson will detail how to use the Bash Shell.
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Linux documentation
In this section, you learn to use the built
-
in Linux documentation.
21
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Did you check the man pages?
I'm lost and don’t understand this
command!
When you ask a Linux person for help:
•
The Linux manual pages, or
man pages
, contain the
documentation for Linux commands.
•
The man pages provide a brief summary of the
purpose, syntax, and options that are associated with
a particular command.
•
You access the man pages by using the
man
command.
Manual pages
The primary source of Linux documentation is the manual pages. They contain a
description of the purpose, syntax, and options for a Linux command.
When you ask a Linux person for help, the most likely first answer that you will get is,
“Did you check the man pages?”
You access the man pages by using the
man
command.
22
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
What is the man command?
•
You view the manual page for a
command
•
The following is common information
that is displayed for a command:
–
Name
–
Synopsis
–
Description
–
Options
The output that is displayed
The man command
Linux syntax:
man <commandName>
The command:
man man
Understanding the syntax
The man command displays documentation information for the command that you
specify as its argument. This information includes the following:
•
Name
: The name and a brief description of the purpose of the command
•
Synopsis
: The syntax of the command
•
Description
: A detailed description the command’s usage and functions
•
Options
: An explanation of the command’s options
The example screen capture shows the output of the
man
command.
23
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
•
You typically
use
the man command
to
determine a command’s syntax and available options.
•
You can navigate through the multiple pages of documentation by using keyboard keys:
•
Up
or
Down arrow
key: Scrolls up or down one line, respectively
•
Page
-
up
or
Page
-
down
key: Scrolls up or down one page, respectively
•
Space bar
: Scrolls down one page
•
To search for a string in the documentation, use the forward slash key:
•
/<searchString>
•
Enter
q
to exit the documentation.
Command features of the man command
Using the man command, you can determine the syntax of a particular command. It is
also very useful in understanding a command’s options.
The documentation that is displayed for a command will typically consist of many
pages. To navigate through the pages, use the following keyboard keys:
•
Up arrow
or
Down arrow
key: Scrolls up or down one line, respectively
•
Page
-
up
or
Page
-
down
key: Scrolls up or down one page, respectively
•
Space bar
: Scrolls down one page
You can also search a command’s man page by using the forward slash (/) character:
/<searchString>
To exit the manual pages, enter
q
.
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Linux distributions
This section lists the different Linux distributions.
25
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Fedora
RHEL
CentOS
Debian
Ubuntu
OpenSUSE
SUSE
Enterprise
Linux
Amazon Linux 2
A distribution includes the Linux kernel and complementary tools and software
applications.
Sources of major distributions
A Linux distribution includes the Linux kernel and the tools, libraries, and other
software applications that the vendor has packaged. Most widely
used distributions
are derived from the following sources:
•
Fedora
: Red Hat, an IBM company, mainly sponsors this distribution. Fedora is
used to develop, test, and mature the Linux operating system. Fedora is the source
of the commercially distributed RHEL from which the Amazon Linux 2 and CentOS
distributions are derived.
•
Debian
: This
Linux distribution adheres strongly to the free software principles of
open source. The Ubuntu distribution is derived from Debian, and the British
company Canonical Ltd. maintains
it.
•
OpenSUSE
: The German company SUSE sponsors this distribution
, which is
used
as the basis for the company’s commercially supported SUSE Enterprise Linux
offering.
26
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Amazon Linux
2
Enterprise
-
class Linux
distribution
Derived from RHEL
Designed for use on AWS
virtual machines
Amazon Linux 2
Amazon Linux 2 is the latest Linux operating system that AWS offers. It is designed to
provide a stable, secure, and high
-
performance runtime environment for applications
that run on Amazon Elastic Compute Cloud (Amazon EC2). It supports the latest EC2
instance type features and includes packages that facilitate integration with AWS.
Amazon Linux 2 enhances security by automatically applying critical or important
security updates when an instance is booted.
For more information on Amazon Linux 2, see
https://aws.amazon.com/amazon
-
linux
-
2/
.
27
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Stands for Community Enterprise Operating System
Is an enterprise
-
class Linux distribution
Is derived from RHEL
Was replaced by
CentOS Stream
as of December 2020
Cen
tOS
CentOS (or Community Enterprise Operating System)
is a free Linux distribution and is
functionally compatible with its upstream source, RHEL.
CentOS is currently used in the lab environment for this course.
As of December 2020, Red Hat has cancelled any further development for CentOS
Linux and replaced it with CentOS Stream.
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Connecting to a remote Linux server
This section discusses how to connect to a remote Linux server.
CONNECTING TO A LINUX SERVER
RSLX EN-US SG M02 INTROLINUX
<> of 35+-<->Close
21
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Did you check the man pages?
I'm lost and don’t understand this
command!
When you ask a Linux person for help:
•
The Linux manual pages, or
man pages
, contain the
documentation for Linux commands.
•
The man pages provide a brief summary of the
purpose, syntax, and options that are associated with
a particular command.
•
You access the man pages by using the
man
command.
Manual pages
The primary source of Linux documentation is the manual pages. They contain a
description of the purpose, syntax, and options for a Linux command.
When you ask a Linux person for help, the most likely first answer that you will get is,
“Did you check the man pages?”
You access the man pages by using the
man
command.
22
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
What is the man command?
•
You view the manual page for a
command
•
The following is common information
that is displayed for a command:
–
Name
–
Synopsis
–
Description
–
Options
The output that is displayed
The man command
Linux syntax:
man <commandName>
The command:
man man
Understanding the syntax
The man command displays documentation information for the command that you
specify as its argument. This information includes the following:
•
Name
: The name and a brief description of the purpose of the command
•
Synopsis
: The syntax of the command
•
Description
: A detailed description the command’s usage and functions
•
Options
: An explanation of the command’s options
The example screen capture shows the output of the
man
command.
23
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
•
You typically
use
the man command
to
determine a command’s syntax and available options.
•
You can navigate through the multiple pages of documentation by using keyboard keys:
•
Up
or
Down arrow
key: Scrolls up or down one line, respectively
•
Page
-
up
or
Page
-
down
key: Scrolls up or down one page, respectively
•
Space bar
: Scrolls down one page
•
To search for a string in the documentation, use the forward slash key:
•
/<searchString>
•
Enter
q
to exit the documentation.
Command features of the man command
Using the man command, you can determine the syntax of a particular command. It is
also very useful in understanding a command’s options.
The documentation that is displayed for a command will typically consist of many
pages. To navigate through the pages, use the following keyboard keys:
•
Up arrow
or
Down arrow
key: Scrolls up or down one line, respectively
•
Page
-
up
or
Page
-
down
key: Scrolls up or down one page, respectively
•
Space bar
: Scrolls down one page
You can also search a command’s man page by using the forward slash (/) character:
/<searchString>
To exit the manual pages, enter
q
.
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Linux distributions
This section lists the different Linux distributions.
25
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Fedora
RHEL
CentOS
Debian
Ubuntu
OpenSUSE
SUSE
Enterprise
Linux
Amazon Linux 2
A distribution includes the Linux kernel and complementary tools and software
applications.
Sources of major distributions
A Linux distribution includes the Linux kernel and the tools, libraries, and other
software applications that the vendor has packaged. Most widely
used distributions
are derived from the following sources:
•
Fedora
: Red Hat, an IBM company, mainly sponsors this distribution. Fedora is
used to develop, test, and mature the Linux operating system. Fedora is the source
of the commercially distributed RHEL from which the Amazon Linux 2 and CentOS
distributions are derived.
•
Debian
: This
Linux distribution adheres strongly to the free software principles of
open source. The Ubuntu distribution is derived from Debian, and the British
company Canonical Ltd. maintains
it.
•
OpenSUSE
: The German company SUSE sponsors this distribution
, which is
used
as the basis for the company’s commercially supported SUSE Enterprise Linux
offering.
26
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Amazon Linux
2
Enterprise
-
class Linux
distribution
Derived from RHEL
Designed for use on AWS
virtual machines
Amazon Linux 2
Amazon Linux 2 is the latest Linux operating system that AWS offers. It is designed to
provide a stable, secure, and high
-
performance runtime environment for applications
that run on Amazon Elastic Compute Cloud (Amazon EC2). It supports the latest EC2
instance type features and includes packages that facilitate integration with AWS.
Amazon Linux 2 enhances security by automatically applying critical or important
security updates when an instance is booted.
For more information on Amazon Linux 2, see
https://aws.amazon.com/amazon
-
linux
-
2/
.
27
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Stands for Community Enterprise Operating System
Is an enterprise
-
class Linux distribution
Is derived from RHEL
Was replaced by
CentOS Stream
as of December 2020
Cen
tOS
CentOS (or Community Enterprise Operating System)
is a free Linux distribution and is
functionally compatible with its upstream source, RHEL.
CentOS is currently used in the lab environment for this course.
As of December 2020, Red Hat has cancelled any further development for CentOS
Linux and replaced it with CentOS Stream.
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Connecting to a remote Linux server
This section discusses how to connect to a remote Linux server.
29
Opens up the AWS console
Starts the lab environment
Opens up the details panel
Lab environment
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
You will connect to Vocareum to work on your labs. The interface offers all the lab
information and steps as well as buttons to start the AWS instance you will work with.
The
Start Lab
button will generate your
AWS
working environment.
The
Details
pane displays information such as the IP address of the EC2 instance that
you will work with. It also displays the URL to download the private SSH connection
key.
The
AWS
button opens up the AWS console. You will not need to access this console
when working on the Linux labs. However, you should get familiar with it because you
will use it later.
30
Lab architecture
Public subnet
VPC
AWS Cloud
Availability Zone 1
EC2 instance
Security group
Client
SSH
ec2
-
user
Private key
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
When starting to work on your labs, an Amazon Linux 2 EC2 instance instantiates
automatically.
You will download a key to connect securely to this instance through Secure Shell
(SSH) with the user
ec2
-
user
.
SSH is a network protocol that provides a secure way to access a computer. To
connect to a host by using SSH, you need an SSH client. MacOS or Linux usually gives
you access to an SSH client directly from the terminal. On Windows, you can use a
tool that is called
PuTTY
, which has a graphical interface.
The SSH connection usually uses port 22. The security group that is linked to the EC2
instance opens up this port.
RSLX EN-US SG M02 INTROLINUX
<> of 35+-<->Close
26
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Amazon Linux
2
Enterprise
-
class Linux
distribution
Derived from RHEL
Designed for use on AWS
virtual machines
Amazon Linux 2
Amazon Linux 2 is the latest Linux operating system that AWS offers. It is designed to
provide a stable, secure, and high
-
performance runtime environment for applications
that run on Amazon Elastic Compute Cloud (Amazon EC2). It supports the latest EC2
instance type features and includes packages that facilitate integration with AWS.
Amazon Linux 2 enhances security by automatically applying critical or important
security updates when an instance is booted.
For more information on Amazon Linux 2, see
https://aws.amazon.com/amazon
-
linux
-
2/
.
27
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Stands for Community Enterprise Operating System
Is an enterprise
-
class Linux distribution
Is derived from RHEL
Was replaced by
CentOS Stream
as of December 2020
Cen
tOS
CentOS (or Community Enterprise Operating System)
is a free Linux distribution and is
functionally compatible with its upstream source, RHEL.
CentOS is currently used in the lab environment for this course.
As of December 2020, Red Hat has cancelled any further development for CentOS
Linux and replaced it with CentOS Stream.
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Connecting to a remote Linux server
This section discusses how to connect to a remote Linux server.
29
Opens up the AWS console
Starts the lab environment
Opens up the details panel
Lab environment
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
You will connect to Vocareum to work on your labs. The interface offers all the lab
information and steps as well as buttons to start the AWS instance you will work with.
The
Start Lab
button will generate your
AWS
working environment.
The
Details
pane displays information such as the IP address of the EC2 instance that
you will work with. It also displays the URL to download the private SSH connection
key.
The
AWS
button opens up the AWS console. You will not need to access this console
when working on the Linux labs. However, you should get familiar with it because you
will use it later.
30
Lab architecture
Public subnet
VPC
AWS Cloud
Availability Zone 1
EC2 instance
Security group
Client
SSH
ec2
-
user
Private key
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
When starting to work on your labs, an Amazon Linux 2 EC2 instance instantiates
automatically.
You will download a key to connect securely to this instance through Secure Shell
(SSH) with the user
ec2
-
user
.
SSH is a network protocol that provides a secure way to access a computer. To
connect to a host by using SSH, you need an SSH client. MacOS or Linux usually gives
you access to an SSH client directly from the terminal. On Windows, you can use a
tool that is called
PuTTY
, which has a graphical interface.
The SSH connection usually uses port 22. The security group that is linked to the EC2
instance opens up this port.
31
•
Linux instances come with a
default user.
•
For the Amazon Linux 2 instance
that you will use, the default user
is ec2
-
user.
•
To connect to the instance, you
need a private key that is
automatically generated for you.
•
The format of the key is the .pem
format, which stands for Privacy
Enhanced Mail.
Additional details
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
On Windows. PuTTY uses a slightly different format, the
.ppk
(which stands for PuTTY
private key) format.
PuTTYgen
is a tool that can convert a
.pem
key into a
.ppk
key.
Both
.pem
and
.ppk
keys are provided in the lab.
32
How to access Linux AMI
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
•
Use
PuTTY
if you are using a
Windows machine.
•
Use SSH if you are using a Mac or Linux
machine.
After you launch an EC2 instance, you can connect to it and use it the way you'd use a
computer sitting in front of you.
Depending on the computer system, you
have two
ways to
access the EC2 instance.
The first way to connect is by using a client called PuTTY.
PuTTY
is an open
-
source SSH
and telnet client.
PuTTY
allows you to connect to your instance from a Windows
machine.
If you
are
using a macOS or Linux machine, you
access the EC2 instance differently
. If
you are using a Mac or Linux computer, it most likely includes an SSH client by
default.
You can check for an SSH client by entering
ssh
at the command line.
33
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
What is a Linux distribution?
True or false: The bash shell is the default shell for most Linux distributions.
Which command provides help for Linux commands?
Checkpoint questions
What is a Linux
distribution?
•
A Linux distribution is a packaged version of Linux that a group of
individuals or a company develops. It includes the core operating
system functionality (kernel) and additional complementary tools and
software applications.
True or false: The bash shell
is the default shell for most Linux distributions.
•
True
Which command provides help for Linux commands?
•
man
34
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
•
Linux is an operating system that is similar to Unix. It
is
free
and open source
, and
users can expand
it
.
•
A Linux
distribution
combines the Linux kernel with
other software applications to provide a complete
operating system environment.
•
All Linux distributions come with a
CLI
. Some also
offer a
GUI
.
•
The
bash
shell is the default shell in Linux.
•
You can use the
man
command to read the Linux
manual pages.
Key takeaways
Some key
takeaways from this lesson include:
•
Linux is an operating system that is similar to Unix. It is free and open source, and
users can expand it.
•
A Linux distribution combines the Linux kernel with other software applications to
provide a complete operating system environment.
•
All Linux distributions come with a CLI. Some also offer a GUI.
•
The bash shell is the default shell in Linux.
•
You can use the man command to read the Linux manual pages.
©
2021
Amazon
Web
Services,
Inc
.
or
its
affiliates
.
All
rights
reserved
.
This
work
may
not
be
reproduced
or
redistributed,
in
whole
or
in
part,
without
prior
written
permission
from
Amazon
Web
Services,
Inc
.
Commercial
copying,
lending,
or
selling
is
prohibited
.
Corrections,
feedback,
or
other
questions?
Contact
us
at
https
:
//support
.
aws
.
amazon
.
com/#/contacts/aws
-
training
.
All
Trademarks are the property of their owners
Submit
Details
AWS
Start Lab
End Lab
--:--
Grades
AR-SA
DE-DE EN-US
ES-ES ES-LA
FR-FR ID-ID
IT-IT KO-KR
PL-PL PT-BR
TH-TH UK-UA
VI-VN ZH-TW
Linux Command Line
Note: All labs rely on previous courseware and lab information.
Objectives
In this lab, you will:
Run commands to gain knowledge of your current system and current session
Search and run previous bash commands
Duration
This lab requires approximately 30 minutes to complete.
AWS service restrictions
In this lab environment, access to AWS services and service actions might be restricted
to the ones that you need to complete the lab instructions. You might encounter errors if
you attempt to access other services or perform actions beyond the ones that this lab
describes.
Accessing the AWS Management Console
1. At the top of these instructions, choose Start Lab to launch your lab. A Start Lab
panel opens, and it displays the lab status.
Tip: If you need more time to complete the lab, choose the Start Lab button again to
restart the timer for the environment.
2. Wait until you see the message Lab status: ready, then close the Start Lab panel
by choosing the X.
3. At the top of these instructions, choose AWS. This opens the AWS Management
Console in a new browser tab. The system will automatically log you in.
Tip: If a new browser tab does not open, a banner or icon is usually at the top of your
browser with a message that your browser is preventing the site from opening pop-up
windows. Choose the banner or icon and then choose Allow pop ups.
4. Arrange the AWS Management Console tab so that it displays along side these
instructions. Ideally, you will be able to see both browser tabs at the same time
so that you can follow the lab steps more easily.
Task 1: Use SSH to connect to an Amazon Linux EC2 instance
In this task, you will connect to a Amazon Linux EC2 instance. You will use an SSH
utility to perform all of these operations. The following instructions vary slightly
depending on whether you are using Windows or Mac/Linux.
Windows Users: Using SSH to Connect
These instructions are specifically for Windows users. If you are using macOS or Linux,
skip to the next section.
5. Select the Details drop-down menu above these instructions you are currently
reading, and then select Show. A Credentials window will be presented.
6. Select the Download PPK button and save the labsuser.ppk file. Typically your
browser will save it to the Downloads directory.
7. Make a note of the PublicIP address.
8. Then exit the Details panel by selecting the X.
9. Download PuTTY to SSH into the Amazon EC2 instance. If you do not have
PuTTY installed on your computer, download it here.
10. Open putty.exe
11. Configure your PuTTY session by following the directions in the following link:
Connect to your Linux instance using PuTTY
12. Windows Users: Select here to skip ahead to the next task.
macOS and Linux Users
These instructions are specifically for Mac/Linux users. If you are a Windows user, skip
ahead to the next task.
13. Select the Details drop-down menu above these instructions you are currently
reading, and then select Show. A Credentials window will be presented.
14. Select the Download PEM button and save the labsuser.pem file.
15. Make a note of the PublicIP address.
16. Then exit the Details panel by selecting the X.
17. Open a terminal window, and change directory cd to the directory where the
labsuser.pem file was downloaded. For example, if the labuser.pem file was
saved to your Downloads directory, run this command:
cd ~/Downloads
18. Change the permissions on the key to be read-only, by running this command:
chmod 400 labsuser.pem
19. Run the below command (replace <public-ip> with the PublicIP address you
copied earlier). Alternatively, return to the EC2 Console and select Instances.
Check the box next to the instance you want to connect to and in the Description
tab copy the IPv4 Public IP value.:
ssh -i labsuser.pem ec2-user@<public-ip>
20. Type yes when prompted to allow the first connection to this remote SSH server.
Because you are using a key pair for authentication, you will not be prompted for
a password.
Task 2: Run familiar commands
In this exercise, you run a few commands to gain some general knowledge of the
system and session that you are using.
21. From the terminal, enter whoa and press Tab. Notice that the auto complete
feature displays the full command, whoami.
22. Press Enter to display your current username.
23. Enter hostname -s and press Enter to display a shortened version of computer’s
host name.
24. Enter uptime -p and press Enter to display the uptime of the system in an easily
readable format.
Figure: The whoami, hostname, and uptime commands give basic information about the
system you are currently using. This can be useful if you need to find the user, IP
address, or how long your system has been running for troubleshooting purposes.
25. From the terminal, enter who -H -a and press Enter to display information about
the users who are logged in and some additional information.
Figure: The who -H -a command displays the information about the user such as the
name, line which gives information, time the event occured, idle time of the user,
Process Identifier (PID), comment and exit time.
26. Enter TZ=America/New_York date and press Enter. Then enter
TZ=America/Los_Angeles date
These commands identify the date and time of alternate locations in the world.
Figure: The TZ=America/New_York date and TZ=America/Los_Angeles date will give
you the output of the current weekday, month, date, time, timezone, and year. In this
example the output for Los Angeles is Wed Sep 1 18:27:35 PDT 2021.
Note
If your time on your system is not set properly, you will receive a time that is incorrect.
27. Some professions use the Julian date to conduct business. The Julian format
continues consecutively instead of restarting the date at 1 at the beginning of
each month. For example, in the Gregorian calendar format, the day after
January 31 is February 1. However, in the Julian format, the day after January 31
is February 32 instead of February 1. You can check this information by entering
cal -j in your terminal to see the Julian dates for your current month.
Figure: The cal -j command will gives the output of the current month in Julian date. In
this example, the output given is September 2021, Thursday, day 245.
28. Enter the cal -s or cal -m commands to display alternate views of the calendar.
Figure: The cal -s command gives the output of September from Sunday through
Saturday. The cal -m command gives the output from Monday through Sunday.
Note
There are many options to display calendars. Check the cal man page for details.
29. For your last command, enter id ec2-user into the terminal, and press Enter to
see your unique ID and group information about your specific user.
Figure: The output of the id ec2-user gives the user id, group id, and groups that the
user is apart of.
Task 3: Improve workflow through history and search
In this task, you attempt to ease your overall workload by reusing commands through
search techniques, manual visualization of the bash history log, and reuse of the last
command.
30. Start by viewing the current bash history. Enter history and press ENTER. In the
output, check if the commands that you see are the commands that you used in
task 2.
Figure: When the history command is entered, you should see a list of all of the
commands that were used within this lab.
31. To search your previous history, press CTRL+R to bring up a reverse history
search. In the reverse history search feature of the terminal, enter TZ and press
Tab. This step brings up an old use of the date command that you can edit.
Using your arrow buttons, you can now edit the command inline.
Note
This is a history searching feature that gives you the ability to edit the command that
you search for. You must use Tab autocomplete to edit and run the commands.
Figure: To run a reverse history search, press CTRL+R. Typing TZ (from the previous
steps) then the Tab button will bring up the use of the date command. In this example,
the up and down arrows were used to bring up the date command.
32. Enter date into the terminal, and press Enter. Enter !! and press Enter. This step
gives you the ability to to rerun the most recent command.
Figure: To run the last command that was entered into the keyboard, !! was used. For
this last example, date was the last command that was used. To run this command
again, !! was used.
Lab Complete
Congratulations! You have completed the lab.
33. Select End Lab at the top of this page and then select Yes to confirm that you
want to end the lab. A panel will appear, indicating that "DELETE has been
initiated... You may close this message box now."
34. Select the X in the top right corner to close the panel.
About the AWS component
Amazon EC2 provides a wide selection of instance types optimized to fit different use
cases. Instance types comprise varying combinations of CPU, memory, storage, and
networking capacity and give you the flexibility to choose the appropriate mix of
resources for your applications. Each instance type includes one or more instance sizes
so that you can scale your resources to the requirements of your target workload.
This lab uses a t3.micro instance, which should be selected by default. This instance
type has 1 virtual CPU and 1 GiB of memory.
Additional Resources
Amazon EC2 Instance Types
Amazon Machine Images (AMI)
Status Checks for Your Instances
Amazon EC2 Service Quotas
Terminate Your Instance
For more information about AWS Training and Certification, see
https://aws.amazon.com/training/.
Your feedback is welcome and appreciated. If you would like to share any suggestions
or corrections, please provide the details in our AWS Training and Certification Contact
Form.
© 2022 Amazon Web Services, Inc. and its affiliates. All rights reserved. This work may
not be reproduced or redistributed, in whole or in part, without prior written permission
from Amazon Web Services, Inc. Commercial copying, lending, or selling is prohibited.
Lab 229
Managing Users and Groups
Note
All labs rely on previous courseware and lab information.
Objectives
In this lab, you will:
Create new users with a default password
Create groups and assign the appropriate users
Log in as different users
Duration
This lab requires approximately 45 minutes to complete.
AWS service restrictions
In this lab environment, access to AWS services and service actions might be restricted
to the ones that you need to complete the lab instructions. You might encounter errors if
you attempt to access other services or perform actions beyond the ones that this lab
describes.
Accessing the AWS Management Console
1. At the top of these instructions, choose Start Lab to launch your lab. A Start Lab
panel opens, and it displays the lab status.
Tip: If you need more time to complete the lab, choose the Start Lab button again to
restart the timer for the environment.
2. Wait until you see the message Lab status: ready, then close the Start Lab panel
by choosing the X.
3. At the top of these instructions, choose AWS. This opens the AWS Management
Console in a new browser tab. The system will automatically log you in.
Tip: If a new browser tab does not open, a banner or icon is usually at the top of your
browser with a message that your browser is preventing the site from opening pop-up
windows. Choose the banner or icon and then choose Allow pop ups.
4. Arrange the AWS Management Console tab so that it displays along side these
instructions. Ideally, you will be able to see both browser tabs at the same time
so that you can follow the lab steps more easily.
Task 1: Use SSH to connect to an Amazon Linux EC2 instance
In this task, you will connect to a Amazon Linux EC2 instance. You will use an SSH
utility to perform all of these operations. The following instructions vary slightly
depending on whether you are using Windows or Mac/Linux.
Windows Users: Using SSH to Connect
These instructions are specifically for Windows users. If you are using macOS or Linux,
skip to the next section.
5. Select the Details drop-down menu above these instructions you are currently
reading, and then select Show. A Credentials window will be presented.
6. Select the Download PPK button and save the labsuser.ppk file. Typically your
browser will save it to the Downloads directory.
7. Make a note of the PublicIP address.
8. Then exit the Details panel by selecting the X.
9. Download PuTTY to SSH into the Amazon EC2 instance. If you do not have
PuTTY installed on your computer, download it here.
10. Open putty.exe
11. Configure your PuTTY session by following the directions in the following link:
Connect to your Linux instance using PuTTY
12. Windows Users: Select here to skip ahead to the next task.
macOS and Linux Users
These instructions are specifically for Mac/Linux users. If you are a Windows user, skip
ahead to the next task.
13. Select the Details drop-down menu above these instructions you are currently
reading, and then select Show. A Credentials window will be presented.
14. Select the Download PEM button and save the labsuser.pem file.
15. Make a note of the PublicIP address.
16. Then exit the Details panel by selecting the X.
17. Open a terminal window, and change directory cd to the directory where the
labsuser.pem file was downloaded. For example, if the labuser.pem file was
saved to your Downloads directory, run this command:
cd ~/Downloads
18. Change the permissions on the key to be read-only, by running this command:
chmod 400 labsuser.pem
19. Run the below command (replace <public-ip> with the PublicIP address you
copied earlier). Alternatively, return to the EC2 Console and select Instances.
Check the box next to the instance you want to connect to and in the Description
tab copy the IPv4 Public IP value.:
ssh -i labsuser.pem ec2-user@<public-ip>
20. Type yes when prompted to allow the first connection to this remote SSH server.
Because you are using a key pair for authentication, you will not be prompted for
a password.
Task 2: Create Users
In this section, you create users based on the following table:
First Name Last Name User ID Job Role
Alejandro Rosalez arosalez Sales Manager
Efua Owusu eowusu Shipping
First Name Last Name User ID Job Role
Jane Doe jdoe Shipping
Li Juan ljuan HR Manager
Mary Major mmajor Finance Manager
Mateo Jackson mjackson CEO
Nikki Wolf nwolf Sales Representative
Paulo Santos psantos Shipping
Sofia Martinez smartinez HR Specialist
Saanvi Sarkar ssarkar Finance Specialist
Ensure that you are spelling the user IDs correctly so that these users can use default
credentials to log in.
21. Validate that you are in the home folder of your current user by typing pwd and
pressing ENTER.
[ec2-user]$ pwd
/home/ec2-user
[ec2-user]$
22. To add the first user from the list above, Alejandro Rosalez, enter sudo useradd
arosalez and press Enter. This step creates the user arosalez.
23. Enter sudo passwd arosalez and press Enter. You are required to enter the
password twice. You can use the password P@ssword1234!
Note When entering the password, nothing appears on the screen, so type your
password and press Enter.
24. To validate that users have been created, enter sudo cat /etc/passwd | cut -d: -f1
and press Enter to look at the contents of the /etc/passwd file.
[ec2-user]$ sudo cat/etc/passwd | cut -d: -f1
........
ec2-user
arosalez
Note
This command helps visualize the created users and is not necessary for you to
remember for now. cat is one of the most popular command. One of its purposes is to
display files. You can also enter cat /etc/passwd to display the whole content of the file,
but this option displays more information and is less readable. Don't bother with the
second part of the command for now. You will learn more about the cat, cut, and |
commands later in this course.
25. Use the sudo useradd <User ID> and sudo passwd <User ID> commands to add
the remaining users from the table. Replace <User ID> with each User ID in the
table at the beginning of this task.
26. To validate that all users have been created, enter sudo cat /etc/passwd | cut -d: -
f1 and press Enter.
[ec2-user]$ sudo cat /etc/passwd | cut -d: -f1
........
ec2-user
arosalez
eowusu
jdoe
ljuan
mjackson
mmajor
nwolf
psantos
smartinez
ssarkar
Task 3: Create Groups
In this section you create groups of users and add users to the groups.
Sales
HR
Finance
Personnel
CEO
Shipping
Managers
Once you've created these groups, you add the users to the proper groups based on
the information provided in the table in Task 2.
Note You may have to use sudo to complete this exercise if you are not root.
Watch out! Managers are personnel, but not all personnel are managers. Some users
belong to multiple groups.
27. To validate that you are in the home folder of your current user, enter pwd and
press Enter.
28. To create the Sales group, enter sudo groupadd Sales and press Enter.
29. To verify that the group was added, enter cat /etc/group and press Enter.
...
ec2-user:x:1000:
......
Sales:x:1014
....
Note The /etc/group file contains all the groups. You should notice that there is already
one group for each user that you created earlier because a group is created for each
new user. You may have different numbers than the ones displayed. Don't worry about
other information behind the first colon. You will learn about the format of the /etc/group
later.
30. Use the sudo groupadd <Group> command to add the remaining groups.
Replace <Group> with HR, Finance, Shipping, and Managers and CEO to
create these groups.
31. To verify that all the groups were added, enter cat /etc/group and press Enter.
Sales:x:1014
HR:x:1015
Finance:x:1016
Shipping:x:1017
Managers:x:1018
CEO:x:1019
32. To add the user arosalez to the Sales group, enter sudo usermod -a -G Sales
arosalez into the terminal and press Enter.
33. To verify that the user was added, enter cat /etc/group and press Enter.
....
Sales:x:1014:arosalez
....
34. Use the sudo usermod -a -G <Group Name> <User ID> command to add the
remaining users to the appropriate groups. Using the information in the following
table, replace <Group Name> with the Group Name, and replace <User ID> with
each user ID in the User IDs columns.
Group Name User IDs Group Name User IDs G
Sales arosaleznwolf HR ljuansmartinez F
Shipping eowusujdoepsantos Managers arosalezljuanmmajor C
35. Add ec2-user to all groups.
36. To check the group memberships, enter sudo cat /etc/group into the terminal and
press Enter.
Sales:x:1014:arosalez,nwolf,ec2-user
HR:x:1015:ljuan,smartinez,ec2-user
Finance:x:1016:mmajor,ssarkar,ec2-user
Shipping:x:1017:eowusu,jdoe,psantos,ec2-user
Managers:x:1018:arosalez,ljuan,mmajor,ec2-user
CEO:x:1019:mjackson,ec2-user
Task 4: Log in using the new users
Now that you have some users in your machine, you can log in as a new user. You also
see what a sudoer is, what this enables, and how commands issued using sudo are
logged in the /var/log/secure file.
Note
You may have to use sudo to complete this exercise if you are not root.
37. Enter su arosalez
38. For the password, enter P@ssword1234! and press Enter. You are now logged in
as arosalez.
[arosalez@ec2-user]$
The trailing ec2-user indicates that you are located in the ec2-user home directory,
/home/ec2-user.
39. Enter pwd and press Enter to ensure that you are in the /home/ec2-user
directory.
40. Enter touch myFile.txt and press Enter.
[arosalez@ec2-user]$ touch myFile.txt
touch: cannot touch ‘myFile.txt’: Permission denied
You receive this message because the user arosalez does not have permission to write
files to the ec2-user home folder.
41. Now you try as an admin using the sudo command. Enter sudo touch myFile.txt
and press Enter.
42. Enter the password P@ssword1234! and press Enter.
[arosalez@ec2-user]$ touch myFile.txt
arosalez is not in the sudoers file. This incident will be reported.
You receive this message because the user arosalez is not on the list of the sudoers
file. Sudoers are users who have special rights to run commands that require root
rights. Only a few users should receive this permission.
43. Enter exit and press Enter to switch to the previous user, ec2-user.
44. Now you visualize the content of the /var/log/secure file. Enter sudo cat
/var/log/secure and press Enter to display the content of the secure file. Scroll to
the bottom of the file using the down arrow:
Aug 9 14:45:55 ip-10-0-10-217 sudo: arosalez : user NOT in sudoers ; TTY=pts/1 ;
PWD=/home/ec2-user ; USER=root ; COMMAND=/bin/touch myFile.txt
You can see how a sudo and not permitted action was logged into the /var/log/secure
file
Lab Complete
Congratulations! You have completed the lab.
45. Select End Lab at the top of this page and then select Yes to confirm that you
want to end the lab. A panel will appear, indicating that "DELETE has been
initiated... You may close this message box now."
46. Select the X in the top right corner to close the panel.
About the AWS component:
Amazon EC2 provides a wide selection of instance types optimized to fit different use
cases. Instance types comprise varying combinations of CPU, memory, storage, and
networking capacity and give you the flexibility to choose the appropriate mix of
resources for your applications. Each instance type includes one or more instance sizes
so that you can scale your resources to the requirements of your target workload.
This lab uses a t3.micro instance, which should be selected by default. This instance
type has 1 virtual CPU and 1 GiB of memory.
Additional Resources
Amazon EC2 Instance Types
Amazon Machine Images (AMI)
Status Checks for Your Instances
Amazon EC2 Service Limits
Terminate Your Instance
For more information about AWS Training and Certification, see
https://aws.amazon.com/training/.
Your feedback is welcome and appreciated. If you would like to share any suggestions
or corrections, please provide the details in our AWS Training and Certification Contact
Form.
© 2022 Amazon Web Services, Inc. and its affiliates. All rights reserved. This work may
not be reproduced or redistributed, in whole or in part, without prior written permission
from Amazon Web Services, Inc. Commercial copying, lending, or selling is prohibited.
Lab 231
Editing Files
Note
All labs rely on previous courseware and lab information.
Objectives
After completing this lab, you will be able to:
Use the vimtutor executable to conduct tasks 1-4
Copy content from the /var/log/secure file, and edit it with nano
Duration
This lab requires approximately 1 hour to complete.
AWS service restrictions
In this lab environment, access to AWS services and service actions might be restricted
to the ones that are needed to complete the lab instructions. You might encounter errors
if you attempt to access other services or perform actions beyond the ones that are
described in this lab.
Accessing the AWS Management Console
1. At the top of these instructions, choose Start Lab to launch your lab. A Start Lab
panel opens, and it displays the lab status.
Tip: If you need more time to complete the lab, choose the Start Lab button again to
restart the timer for the environment.
2. Wait until you see the message Lab status: ready, then close the Start Lab panel
by choosing the X.
3. At the top of these instructions, choose AWS. This opens the AWS Management
Console in a new browser tab. The system will automatically log you in.
Tip: If a new browser tab does not open, a banner or icon is usually at the top of your
browser with a message that your browser is preventing the site from opening pop-up
windows. Choose the banner or icon and then choose Allow pop ups.
4. Arrange the AWS Management Console tab so that it displays along side these
instructions. Ideally, you will be able to see both browser tabs at the same time
so that you can follow the lab steps more easily.
This lab launches an Amazon Elastic Compute Cloud (Amazon EC2) instance that's
named Command Host. You will connect to this instance to run Linux commands.
Task 1: Use SSH to connect to an Amazon Linux EC2 instance
In this task, you will connect to a Amazon Linux EC2 instance. You will use an SSH
utility to perform all of these operations. The following instructions vary slightly
depending on whether you are using Windows or Mac/Linux.
Windows Users: Using SSH to Connect
These instructions are specifically for Windows users. If you are using macOS or Linux,
skip to the next section.
5. Select the Details drop-down menu above these instructions you are currently
reading, and then select Show. A Credentials window will be presented.
6. Select the Download PPK button and save the labsuser.ppk file. Typically your
browser will save it to the Downloads directory.
7. Make a note of the PublicIP address.
8. Then exit the Details panel by selecting the X.
9. Download PuTTY to SSH into the Amazon EC2 instance. If you do not have
PuTTY installed on your computer, download it here.
10. Open putty.exe
11. Configure your PuTTY session by following the directions in the following link:
Connect to your Linux instance using PuTTY
12. Windows Users: Select here to skip ahead to the next task.
macOS and Linux Users
These instructions are specifically for Mac/Linux users. If you are a Windows user, skip
ahead to the next task.
13. Select the Details drop-down menu above these instructions you are currently
reading, and then select Show. A Credentials window will be presented.
14. Select the Download PEM button and save the labsuser.pem file.
15. Make a note of the PublicIP address.
16. Then exit the Details panel by selecting the X.
17. Open a terminal window, and change directory cd to the directory where the
labsuser.pem file was downloaded. For example, if the labuser.pem file was
saved to your Downloads directory, run this command:
cd ~/Downloads
18. Change the permissions on the key to be read-only, by running this command:
chmod 400 labsuser.pem
19. Run the below command (replace <public-ip> with the PublicIP address you
copied earlier). Alternatively, return to the EC2 Console and select Instances.
Check the box next to the instance you want to connect to and in the Description
tab copy the IPv4 Public IP value.:
ssh -i labsuser.pem ec2-user@<public-ip>
20. Type yes when prompted to allow the first connection to this remote SSH server.
Because you are using a key pair for authentication, you will not be prompted for
a password.
Task 2: Exercise - run the Vim tutorial
In this exercise, you run the ./vimtutor and follow all directions in the file for tasks 1-4.
Vimtutor is an application that teaches you the basics of how to use Vim, which is one of
the text editors for Linux.
21. From your current location in the terminal, enter vimtutor and press Enter. This
step starts the vimtutor session:
vimtutor
Note: You may have to use sudo to conduct this step if you are not root. If vimtutor does
not work, you may need to install Vim by entering the following command:
sudo yum install vim
Note: You may have to use sudo to conduct this step if you are not root. If vimtutor does
not work, you may need to install Vim using sudo yum install vim.
22. Complete lessons 1-3 in vimtutor.

*Figure: Vimtutor consists of tutorials that teaches a user how to use Vim.*
23. Enter :q! and press Enter to exit vimtutor.
Task 3: Exercise - edit a file in Vim
In this exercise, you use the Vim command-line editor program. Use Vim to create and
edit a file using the following steps.
24. From your current location in the terminal, enter vim helloworld and press Enter.
You are using Vim to create a file called helloworld, and you open this file when
you press Enter.

*Figure: The command vim followed by the file name, in this example the file is named
helloworld.*
25. Now that you are in the file that you created called helloworld, use Vim to insert
a few lines of text. Enter i to use insert mode, and enter the following text:
Hello World!
This is my first file in Linux and I am editing it in Vim!
Note: The bottom left of the terminal indicates if you are in insert mode.
Once complete, press ESC to exit insert mode.
26. Save your changes to the file, and enter the following command to quit:
:wq
Next, type of the following into the command prompt:
vim helloworld
Note: Because the vim helloworld command was the last command that you used, you
can use the up arrow to recall the last command and press Enter.
27. Add the following line to the editor:
I learned how to create a file, edit and save them too!
It should look like the following picture:

*Figure: The example displays the second line that has been placed in the terminal.*
28. Once complete, press ESC to exit insert mode and use the following command:
:q!
29. You are back in the main terminal. Use Vim to go back to the helloworld file and
analyze what happened. What was the difference?
Additional Challenge
Try additional useful commands.
30. Use the following command to delete the entire line:
dd
31. Use the following command to undo the last command:
u
32. Use the following command to save changes without quitting:
:w
Task 4: Exercise - edit a file in nano
In this exercise, you use an alternative command-line editor program called nano. Use
nano to create and edit a text file.
33. Similar to Vim, in the main terminal, enter nano cloudworld and press Enter. You
are using nano to create a file called cloudworld, and pressing Enter opens this
file.
![The terminal window displays the command nano followed by the word cloudworld.]
(images/nano.jpg)
*Figure: The command nano followed by the file name, in this example the file is named
cloudworld.*
34. Now that you are in the file that you created called cloudworld, unlike vim, you
do not have to enter insert mode. Instead, you can start typing. Enter the
following text:
We are using nano this time! We can simply start typing! No insert mode needed.
35. To save your changes to the file, press CTRL+O. Press Enter to confirm the file
name once you save it.
36. Now that you have saved the file, press CTRL+X to exit the nano editor.
37. Now that you are at the main terminal, check to make sure our file saved
correctly. Enter nano cloudworld to go back into the file using nano. Confirm that
everything is correct as the following image shows, and exit the editor:
![The terminal window displays the command CTRL +X which is used to end nano.]
(images/nanoEnd.jpg)
*Figure: The keys CTRL + X is used to will end the nano editor.*
Lab Complete
Congratulations! You have completed the lab.
38. Select End Lab at the top of this page and then select Yes to confirm that you
want to end the lab. A panel will appear, indicating that "DELETE has been
initiated... You may close this message box now."
39. Select the X in the top right corner to close the panel.
About the AWS component:
Amazon EC2 provides a wide selection of instance types optimized to fit different use
cases. Instance types comprise varying combinations of CPU, memory, storage, and
networking capacity and give you the flexibility to choose the appropriate mix of
resources for your applications. Each instance type includes one or more instance
sizes, allowing you to scale your resources to the requirements of your target workload.
You will use a t3.micro instance which should be selected by default. This instance type
has 1 virtual CPU and 1 GiB of memory.
Additional Resources
Amazon EC2 Instance Types Amazon Machine Images (AMI) Status Checks for Your
Instances Amazon EC2 Service Limits Terminate Your Instance
For more information about AWS Training and Certification, see
https://aws.amazon.com/training/.
Your feedback is welcome and appreciated. If you would like to share any suggestions
or corrections, please provide the details in our AWS Training and Certification Contact
Form.
© 2022 Amazon Web Services, Inc. and its affiliates. All rights reserved. This work may
not be reproduced or redistributed, in whole or in part, without prior written permission
from Amazon Web Services, Inc. Commercial copying, lending, or selling is prohibited.
Working with the File System
Linux Fundamentals
Welcome to Working with the File System.
RSLX EN-US SG M02 WORKWITHFILESYSTEM
<> of 32+-<->Close
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Working with the File System
Linux Fundamentals
Welcome to Working with the File System.
2
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
You will learn how to:
•
Navigate files and directories in Linux
•
Explain basic commands for managing files and directories
•
Compare absolute and relative paths
At the core of the lesson
What you will learn
In this lesson, you will learn how to:
•
Navigate files and directories in Linux
•
Explain basic commands for managing files and directories
•
Compare absolute and relative paths
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Navigating files and directories
Introducing the Linux file system.
4
Commands
Documents
Directories
Devices
Files allow for transparency.
•
Commands, hardware, and directories are
represented as files.
•
Most system configurations are in files.
In Linux:
Everything in Linux is a file
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Files allow for transparency. Drives, processes, and other elements are all
represented as files. They can be browsed and accessed for information (for example,
ls /proc
gives you access to processes).
Files allow for interoperability.
T
he same tools can be used for different types of files
and can be combined (for example,
ls
–
l | grep .txt
).
5
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
The
ls
command
can
be
used
with
other
commands
to
create
a
search
condition for .
txt
documents.
ls
command
with
the option
–
l
can
list
the
ls
command
configuration file
because
it
is
also
a
file.
A
directory
Files
In the first screenshot, both the directory and the text file are
considered
files. The
directory is a special kind of file, hence the
d
and the blue
color
.
In the second screenshot, you see that you can
list
the
ls
command because it is
also a file.
The third screenshot shows how
you
can operate between commands.
Navigating files and directories
Introducing the Linux file system.
RSLX EN-US SG M02 WORKWITHFILESYSTEM
<> of 32+-<->Close
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Working with the File System
Linux Fundamentals
Welcome to Working with the File System.
2
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
You will learn how to:
•
Navigate files and directories in Linux
•
Explain basic commands for managing files and directories
•
Compare absolute and relative paths
At the core of the lesson
What you will learn
In this lesson, you will learn how to:
•
Navigate files and directories in Linux
•
Explain basic commands for managing files and directories
•
Compare absolute and relative paths
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Navigating files and directories
Introducing the Linux file system.
4
Commands
Documents
Directories
Devices
Files allow for transparency.
•
Commands, hardware, and directories are
represented as files.
•
Most system configurations are in files.
In Linux:
Everything in Linux is a file
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Files allow for transparency. Drives, processes, and other elements are all
represented as files. They can be browsed and accessed for information (for example,
ls /proc
gives you access to processes).
Files allow for interoperability.
T
he same tools can be used for different types of files
and can be combined (for example,
ls
–
l | grep .txt
).
5
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
The
ls
command
can
be
used
with
other
commands
to
create
a
search
condition for .
txt
documents.
ls
command
with
the option
–
l
can
list
the
ls
command
configuration file
because
it
is
also
a
file.
A
directory
Files
In the first screenshot, both the directory and the text file are
considered
files. The
directory is a special kind of file, hence the
d
and the blue
color
.
In the second screenshot, you see that you can list the ls command because it is also a
file.
The third screenshot shows how you can operate between commands.
RSLX EN-US SG M02 WORKWITHFILESYSTEM
<> of 32+-<->Close
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Working with the File System
Linux Fundamentals
Welcome to Working with the File System.
2
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
You will learn how to:
•
Navigate files and directories in Linux
•
Explain basic commands for managing files and directories
•
Compare absolute and relative paths
At the core of the lesson
What you will learn
In this lesson, you will learn how to:
•
Navigate files and directories in Linux
•
Explain basic commands for managing files and directories
•
Compare absolute and relative paths
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Navigating files and directories
Introducing the Linux file system.
4
Commands
Documents
Directories
Devices
Files allow for transparency.
•
Commands, hardware, and directories are
represented as files.
•
Most system configurations are in files.
In Linux:
Everything in Linux is a file
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Files allow for transparency. Drives, processes, and other elements are all
represented as files. They can be browsed and accessed for information (for example,
ls /proc
gives you access to processes).
Files allow for interoperability.
T
he same tools can be used for different types of files
and can be combined (for example,
ls
–
l | grep .txt
).
5
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
The
ls
command
can
be
used
with
other
commands
to
create
a
search
condition for .
txt
documents.
ls
command
with
the option
–
l
can
list
the
ls
command
configuration file
because
it
is
also
a
file.
A
directory
Files
In the first screenshot, both the directory and the text file are
considered
files. The
directory is a special kind of file, hence the
d
and the blue
color
.
In the second screenshot, you see that you can
list
the
ls
command because it is
also a file.
The third screenshot shows how
you
can operate between commands.
6
~]$ ls
–
l m*
myFile
MyFilesList.txt
myFile.txt
~]$
This example shows three different text files
with valid file names.
An example
•
Extensions are optional and not necessarily
mapped to applications.
Understanding file
extensions
•
They are case sensitive.
•
They must be unique within the directory.
•
They should not contain
/
or spaces.
Understanding file names
Linux file names and extensions
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
You are strongly advised to have consistent extensions. For instance, a .jpg image
could be named image.txt even though this extension would not make sense. A user
might think that this file is a description file and try to open it with a text editor
instead of an image viewer. A better option is to
name
it
image.jpeg or image.jpg.
RSLX EN-US SG M02 WORKWITHFILESYSTEM
<> of 32+-<->Close
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Working with the File System
Linux Fundamentals
Welcome to Working with the File System.
2
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
You will learn how to:
•
Navigate files and directories in Linux
•
Explain basic commands for managing files and directories
•
Compare absolute and relative paths
At the core of the lesson
What you will learn
In this lesson, you will learn how to:
•
Navigate files and directories in Linux
•
Explain basic commands for managing files and directories
•
Compare absolute and relative paths
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Navigating files and directories
Introducing the Linux file system.
4
Commands
Documents
Directories
Devices
Files allow for transparency.
•
Commands, hardware, and directories are
represented as files.
•
Most system configurations are in files.
In Linux:
Everything in Linux is a file
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Files allow for transparency. Drives, processes, and other elements are all
represented as files. They can be browsed and accessed for information (for example,
ls /proc
gives you access to processes).
Files allow for interoperability.
T
he same tools can be used for different types of files
and can be combined (for example,
ls
–
l | grep .txt
).
5
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
The
ls
command
can
be
used
with
other
commands
to
create
a
search
condition for .
txt
documents.
ls
command
with
the option
–
l
can
list
the
ls
command
configuration file
because
it
is
also
a
file.
A
directory
Files
In the first screenshot, both the directory and the text file are
considered
files. The
directory is a special kind of file, hence the
d
and the blue
color
.
In the second screenshot, you see that you can
list
the
ls
command because it is
also a file.
The third screenshot shows how
you
can operate between commands.
6
~]$ ls
–
l m*
myFile
MyFilesList.txt
myFile.txt
~]$
This example shows three different text files
with valid file names.
An example
•
Extensions are optional and not necessarily
mapped to applications.
Understanding file
extensions
•
They are case sensitive.
•
They must be unique within the directory.
•
They should not contain
/
or spaces.
Understanding file names
Linux file names and extensions
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
You are strongly advised to have consistent extensions. For instance, a .jpg image
could be named image.txt even though this extension would not make sense. A user
might think that this file is a description file and try to open it with a text editor
instead of an image viewer. A better option is to
name
it
image.jpeg or image.jpg.
7
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
File
Directory
Hard disk
File system
File systems
File systems: A way of naming, retrieving, and organizing data on the storage disk
The file system organizes how files are stored on the hard drive. A file is located
inside a directory.
RSLX EN-US SG M02 WORKWITHFILESYSTEM
<> of 32+-<->Close
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Working with the File System
Linux Fundamentals
Welcome to Working with the File System.
2
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
You will learn how to:
•
Navigate files and directories in Linux
•
Explain basic commands for managing files and directories
•
Compare absolute and relative paths
At the core of the lesson
What you will learn
In this lesson, you will learn how to:
•
Navigate files and directories in Linux
•
Explain basic commands for managing files and directories
•
Compare absolute and relative paths
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Navigating files and directories
Introducing the Linux file system.
4
Commands
Documents
Directories
Devices
Files allow for transparency.
•
Commands, hardware, and directories are
represented as files.
•
Most system configurations are in files.
In Linux:
Everything in Linux is a file
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Files allow for transparency. Drives, processes, and other elements are all
represented as files. They can be browsed and accessed for information (for example,
ls /proc
gives you access to processes).
Files allow for interoperability.
T
he same tools can be used for different types of files
and can be combined (for example,
ls
–
l | grep .txt
).
5
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
The
ls
command
can
be
used
with
other
commands
to
create
a
search
condition for .
txt
documents.
ls
command
with
the option
–
l
can
list
the
ls
command
configuration file
because
it
is
also
a
file.
A
directory
Files
In the first screenshot, both the directory and the text file are
considered
files. The
directory is a special kind of file, hence the
d
and the blue
color
.
In the second screenshot, you see that you can
list
the
ls
command because it is
also a file.
The third screenshot shows how
you
can operate between commands.
6
~]$ ls
–
l m*
myFile
MyFilesList.txt
myFile.txt
~]$
This example shows three different text files
with valid file names.
An example
•
Extensions are optional and not necessarily
mapped to applications.
Understanding file
extensions
•
They are case sensitive.
•
They must be unique within the directory.
•
They should not contain
/
or spaces.
Understanding file names
Linux file names and extensions
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
You are strongly advised to have consistent extensions. For instance, a .jpg image
could be named image.txt even though this extension would not make sense. A user
might think that this file is a description file and try to open it with a text editor
instead of an image viewer. A better option is to
name
it
image.jpeg or image.jpg.
7
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
File
Directory
Hard disk
File system
File systems
File systems: A way of naming, retrieving, and organizing data on the storage disk
The file system organizes how files are stored on the hard drive. A file is located
inside a directory.
8
Directory
Function
/
Root of the file system
/boot
Boot files and kernel
/dev
Devices
/etc
Configuration files
/home
Standard users' home directories
/media
Removable media
/mnt
Network drives
/root
Root user home directory
/var
Log files, print spool, network services
Other FHS directories
•
/
etc
typically contains configuration
files.
•
/var/log
typically contains log
files.
Examples:
File system hierarchy standard (FHS)
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Most Linux distributions use this standard, but some distributions might differ slightly
or intentionally use a different file system.
There are some commonalities between some of these distributions. For example,
there are standard locations and functions of directories across Linux distribution.
Most Linux distributions:
•
Allow software to be compatible with various distributions
•
Allow administrators to predict where certain types of files will be found
Most distributions follow the file system hierarchy standard (FHS).
The FHS has many other directories. The table shows a list of the other available
directories.
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Commands for managing files and directories
The following commands are important. They are used to manage files and
directories.
RSLX EN-US SG M02 WORKWITHFILESYSTEM
<> of 32+-<->Close
2
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
You will learn how to:
•
Navigate files and directories in Linux
•
Explain basic commands for managing files and directories
•
Compare absolute and relative paths
At the core of the lesson
What you will learn
In this lesson, you will learn how to:
•
Navigate files and directories in Linux
•
Explain basic commands for managing files and directories
•
Compare absolute and relative paths
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Navigating files and directories
Introducing the Linux file system.
4
Commands
Documents
Directories
Devices
Files allow for transparency.
•
Commands, hardware, and directories are
represented as files.
•
Most system configurations are in files.
In Linux:
Everything in Linux is a file
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Files allow for transparency. Drives, processes, and other elements are all
represented as files. They can be browsed and accessed for information (for example,
ls /proc
gives you access to processes).
Files allow for interoperability.
T
he same tools can be used for different types of files
and can be combined (for example,
ls
–
l | grep .txt
).
5
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
The
ls
command
can
be
used
with
other
commands
to
create
a
search
condition for .
txt
documents.
ls
command
with
the option
–
l
can
list
the
ls
command
configuration file
because
it
is
also
a
file.
A
directory
Files
In the first screenshot, both the directory and the text file are
considered
files. The
directory is a special kind of file, hence the
d
and the blue
color
.
In the second screenshot, you see that you can
list
the
ls
command because it is
also a file.
The third screenshot shows how
you
can operate between commands.
6
~]$ ls
–
l m*
myFile
MyFilesList.txt
myFile.txt
~]$
This example shows three different text files
with valid file names.
An example
•
Extensions are optional and not necessarily
mapped to applications.
Understanding file
extensions
•
They are case sensitive.
•
They must be unique within the directory.
•
They should not contain
/
or spaces.
Understanding file names
Linux file names and extensions
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
You are strongly advised to have consistent extensions. For instance, a .jpg image
could be named image.txt even though this extension would not make sense. A user
might think that this file is a description file and try to open it with a text editor
instead of an image viewer. A better option is to
name
it
image.jpeg or image.jpg.
7
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
File
Directory
Hard disk
File system
File systems
File systems: A way of naming, retrieving, and organizing data on the storage disk
The file system organizes how files are stored on the hard drive. A file is located
inside a directory.
8
Directory
Function
/
Root of the file system
/boot
Boot files and kernel
/dev
Devices
/etc
Configuration files
/home
Standard users' home directories
/media
Removable media
/mnt
Network drives
/root
Root user home directory
/var
Log files, print spool, network services
Other FHS directories
•
/
etc
typically contains configuration
files.
•
/var/log
typically contains log
files.
Examples:
File system hierarchy standard (FHS)
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Most Linux distributions use this standard, but some distributions might differ slightly
or intentionally use a different file system.
There are some commonalities between some of these distributions. For example,
there are standard locations and functions of directories across Linux distribution.
Most Linux distributions:
•
Allow software to be compatible with various distributions
•
Allow administrators to predict where certain types of files will be found
Most distributions follow the file system hierarchy standard (FHS).
The FHS has many other directories. The table shows a list of the other available
directories.
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Commands for managing files and directories
The following commands are important. They are used to manage files and
directories.
10
ls /var command output
•
Different
colors represent different types of
files.
•
l
s
command lists the content of the current
directory.
•
l
s
dir
command lists the content of the
dir
directory.
What the command does
•
The
ls
command displays a list of files in a
directory.
ls command
Understanding command syntax with the
ls
command
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Colors are not defined according to a standard. They depend on the configuration of
the shell that you are using.
You can list several multiple directories, for
example
,
ls directory1
directory2
.
11
Examples of the ls
command
Option
Description
-
l
Long format (shows permissions)
-
h
File sizes reported in a human
-
friendly
format
-
a
Shows all files, including hidden files
-
R
Lists subdirectories
--
sort=extension
or
-
X
Sorts alphabetically by file extension
--
sort=size
or
-
S
Sorts by file size
--
sort=time
or
-
t
Sorts by modification time
--
sort=version
or
-
v
Sorts by
version
number
Useful options
ls
command options and examples
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
By default, the ls command uses the natural sort order.
T
o get results in the reverse
order, add the
–
r
option.
You can combine options:
ls
–
al
displays hidden files and file details.
•
ls
–
l
lists
the contents of the current directory with details. It does not display
the hidden files.
•
ls
–
a
displays the hidden files.
•
ls
–
al
displays the hidden files and the file’s details (not all of the list is
displayed on the screenshot because it would take too much space).
RSLX EN-US SG M02 WORKWITHFILESYSTEM
<> of 32+-<->Close
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Navigating files and directories
Introducing the Linux file system.
4
Commands
Documents
Directories
Devices
Files allow for transparency.
•
Commands, hardware, and directories are
represented as files.
•
Most system configurations are in files.
In Linux:
Everything in Linux is a file
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Files allow for transparency. Drives, processes, and other elements are all
represented as files. They can be browsed and accessed for information (for example,
ls /proc
gives you access to processes).
Files allow for interoperability.
T
he same tools can be used for different types of files
and can be combined (for example,
ls
–
l | grep .txt
).
5
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
The
ls
command
can
be
used
with
other
commands
to
create
a
search
condition for .
txt
documents.
ls
command
with
the option
–
l
can
list
the
ls
command
configuration file
because
it
is
also
a
file.
A
directory
Files
In the first screenshot, both the directory and the text file are
considered
files. The
directory is a special kind of file, hence the
d
and the blue
color
.
In the second screenshot, you see that you can
list
the
ls
command because it is
also a file.
The third screenshot shows how
you
can operate between commands.
6
~]$ ls
–
l m*
myFile
MyFilesList.txt
myFile.txt
~]$
This example shows three different text files
with valid file names.
An example
•
Extensions are optional and not necessarily
mapped to applications.
Understanding file
extensions
•
They are case sensitive.
•
They must be unique within the directory.
•
They should not contain
/
or spaces.
Understanding file names
Linux file names and extensions
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
You are strongly advised to have consistent extensions. For instance, a .jpg image
could be named image.txt even though this extension would not make sense. A user
might think that this file is a description file and try to open it with a text editor
instead of an image viewer. A better option is to
name
it
image.jpeg or image.jpg.
7
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
File
Directory
Hard disk
File system
File systems
File systems: A way of naming, retrieving, and organizing data on the storage disk
The file system organizes how files are stored on the hard drive. A file is located
inside a directory.
8
Directory
Function
/
Root of the file system
/boot
Boot files and kernel
/dev
Devices
/etc
Configuration files
/home
Standard users' home directories
/media
Removable media
/mnt
Network drives
/root
Root user home directory
/var
Log files, print spool, network services
Other FHS directories
•
/
etc
typically contains configuration
files.
•
/var/log
typically contains log
files.
Examples:
File system hierarchy standard (FHS)
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Most Linux distributions use this standard, but some distributions might differ slightly
or intentionally use a different file system.
There are some commonalities between some of these distributions. For example,
there are standard locations and functions of directories across Linux distribution.
Most Linux distributions:
•
Allow software to be compatible with various distributions
•
Allow administrators to predict where certain types of files will be found
Most distributions follow the file system hierarchy standard (FHS).
The FHS has many other directories. The table shows a list of the other available
directories.
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Commands for managing files and directories
The following commands are important. They are used to manage files and
directories.
10
ls /var command output
•
Different
colors represent different types of
files.
•
l
s
command lists the content of the current
directory.
•
l
s
dir
command lists the content of the
dir
directory.
What the command does
•
The
ls
command displays a list of files in a
directory.
ls command
Understanding command syntax with the
ls
command
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Colors are not defined according to a standard. They depend on the configuration of
the shell that you are using.
You can list several multiple directories, for
example
,
ls directory1
directory2
.
11
Examples of the ls
command
Option
Description
-
l
Long format (shows permissions)
-
h
File sizes reported in a human
-
friendly
format
-
a
Shows all files, including hidden files
-
R
Lists subdirectories
--
sort=extension
or
-
X
Sorts alphabetically by file extension
--
sort=size
or
-
S
Sorts by file size
--
sort=time
or
-
t
Sorts by modification time
--
sort=version
or
-
v
Sorts by
version
number
Useful options
ls
command options and examples
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
By default, the ls command uses the natural sort order.
T
o get results in the reverse
order, add the
–
r
option.
You can combine options:
ls
–
al
displays hidden files and file details.
•
ls
–
l
lists
the contents of the current directory with details. It does not display
the hidden files.
•
ls
–
a
displays the hidden files.
•
ls
–
al
displays the hidden files and the file’s details (not all of the list is
displayed on the screenshot because it would take too much space).
12
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
In this demonstration, the instructor will show how to use
the
ls
command with various options to view information
about files on a Linux system.
Demonstration:
Exploring files and
directories
Follow along as the instructor demonstrates the use of the
ls
command.
RSLX EN-US SG M02 WORKWITHFILESYSTEM
<> of 32+-<->Close
4
Commands
Documents
Directories
Devices
Files allow for transparency.
•
Commands, hardware, and directories are
represented as files.
•
Most system configurations are in files.
In Linux:
Everything in Linux is a file
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Files allow for transparency. Drives, processes, and other elements are all
represented as files. They can be browsed and accessed for information (for example,
ls /proc
gives you access to processes).
Files allow for interoperability.
T
he same tools can be used for different types of files
and can be combined (for example,
ls
–
l | grep .txt
).
5
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
The
ls
command
can
be
used
with
other
commands
to
create
a
search
condition for .
txt
documents.
ls
command
with
the option
–
l
can
list
the
ls
command
configuration file
because
it
is
also
a
file.
A
directory
Files
In the first screenshot, both the directory and the text file are
considered
files. The
directory is a special kind of file, hence the
d
and the blue
color
.
In the second screenshot, you see that you can
list
the
ls
command because it is
also a file.
The third screenshot shows how
you
can operate between commands.
6
~]$ ls
–
l m*
myFile
MyFilesList.txt
myFile.txt
~]$
This example shows three different text files
with valid file names.
An example
•
Extensions are optional and not necessarily
mapped to applications.
Understanding file
extensions
•
They are case sensitive.
•
They must be unique within the directory.
•
They should not contain
/
or spaces.
Understanding file names
Linux file names and extensions
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
You are strongly advised to have consistent extensions. For instance, a .jpg image
could be named image.txt even though this extension would not make sense. A user
might think that this file is a description file and try to open it with a text editor
instead of an image viewer. A better option is to
name
it
image.jpeg or image.jpg.
7
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
File
Directory
Hard disk
File system
File systems
File systems: A way of naming, retrieving, and organizing data on the storage disk
The file system organizes how files are stored on the hard drive. A file is located
inside a directory.
8
Directory
Function
/
Root of the file system
/boot
Boot files and kernel
/dev
Devices
/etc
Configuration files
/home
Standard users' home directories
/media
Removable media
/mnt
Network drives
/root
Root user home directory
/var
Log files, print spool, network services
Other FHS directories
•
/
etc
typically contains configuration
files.
•
/var/log
typically contains log
files.
Examples:
File system hierarchy standard (FHS)
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Most Linux distributions use this standard, but some distributions might differ slightly
or intentionally use a different file system.
There are some commonalities between some of these distributions. For example,
there are standard locations and functions of directories across Linux distribution.
Most Linux distributions:
•
Allow software to be compatible with various distributions
•
Allow administrators to predict where certain types of files will be found
Most distributions follow the file system hierarchy standard (FHS).
The FHS has many other directories. The table shows a list of the other available
directories.
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Commands for managing files and directories
The following commands are important. They are used to manage files and
directories.
10
ls /var command output
•
Different
colors represent different types of
files.
•
l
s
command lists the content of the current
directory.
•
l
s
dir
command lists the content of the
dir
directory.
What the command does
•
The
ls
command displays a list of files in a
directory.
ls command
Understanding command syntax with the
ls
command
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Colors are not defined according to a standard. They depend on the configuration of
the shell that you are using.
You can list several multiple directories, for
example
,
ls directory1
directory2
.
11
Examples of the ls
command
Option
Description
-
l
Long format (shows permissions)
-
h
File sizes reported in a human
-
friendly
format
-
a
Shows all files, including hidden files
-
R
Lists subdirectories
--
sort=extension
or
-
X
Sorts alphabetically by file extension
--
sort=size
or
-
S
Sorts by file size
--
sort=time
or
-
t
Sorts by modification time
--
sort=version
or
-
v
Sorts by
version
number
Useful options
ls
command options and examples
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
By default, the ls command uses the natural sort order.
T
o get results in the reverse
order, add the
–
r
option.
You can combine options:
ls
–
al
displays hidden files and file details.
•
ls
–
l
lists
the contents of the current directory with details. It does not display
the hidden files.
•
ls
–
a
displays the hidden files.
•
ls
–
al
displays the hidden files and the file’s details (not all of the list is
displayed on the screenshot because it would take too much space).
12
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
In this demonstration, the instructor will show how to use
the
ls
command with various options to view information
about files on a Linux system.
Demonstration:
Exploring files and
directories
Follow along as the instructor demonstrates the use of the
ls
command.
13
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
•
Used to view file contents
that don't fit on one screen.
•
Loads entire contents of files
before displaying results
•
Can only scroll down
•
Can be used in conjunction
with other commands:
cat file.txt | more
more
command
Usage:
more [
-
options] [
-
num] [+/pattern] [+linenum] [file_name]
•
Options:
o
-
d
: Displays information about how to navigate at the bottom of the screen
o
-
f
: Prevents line wrap
o
-
p
: Clears the screen before displaying the content
o
-
s
: Squeezes multiple blank lines into one line
•
num
: Number of lines to display
•
/pattern
: String to find in the file
•
linenum
: The line
number
where
the content starts to display
•
file_name
: Name of the file to display the content of
–
Use
-
number to define how many lines a page should contain
RSLX EN-US SG M02 WORKWITHFILESYSTEM
<> of 32+-<->Close
5
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
The
ls
command
can
be
used
with
other
commands
to
create
a
search
condition for .
txt
documents.
ls
command
with
the option
–
l
can
list
the
ls
command
configuration file
because
it
is
also
a
file.
A
directory
Files
In the first screenshot, both the directory and the text file are
considered
files. The
directory is a special kind of file, hence the
d
and the blue
color
.
In the second screenshot, you see that you can
list
the
ls
command because it is
also a file.
The third screenshot shows how
you
can operate between commands.
6
~]$ ls
–
l m*
myFile
MyFilesList.txt
myFile.txt
~]$
This example shows three different text files
with valid file names.
An example
•
Extensions are optional and not necessarily
mapped to applications.
Understanding file
extensions
•
They are case sensitive.
•
They must be unique within the directory.
•
They should not contain
/
or spaces.
Understanding file names
Linux file names and extensions
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
You are strongly advised to have consistent extensions. For instance, a .jpg image
could be named image.txt even though this extension would not make sense. A user
might think that this file is a description file and try to open it with a text editor
instead of an image viewer. A better option is to
name
it
image.jpeg or image.jpg.
7
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
File
Directory
Hard disk
File system
File systems
File systems: A way of naming, retrieving, and organizing data on the storage disk
The file system organizes how files are stored on the hard drive. A file is located
inside a directory.
8
Directory
Function
/
Root of the file system
/boot
Boot files and kernel
/dev
Devices
/etc
Configuration files
/home
Standard users' home directories
/media
Removable media
/mnt
Network drives
/root
Root user home directory
/var
Log files, print spool, network services
Other FHS directories
•
/
etc
typically contains configuration
files.
•
/var/log
typically contains log
files.
Examples:
File system hierarchy standard (FHS)
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Most Linux distributions use this standard, but some distributions might differ slightly
or intentionally use a different file system.
There are some commonalities between some of these distributions. For example,
there are standard locations and functions of directories across Linux distribution.
Most Linux distributions:
•
Allow software to be compatible with various distributions
•
Allow administrators to predict where certain types of files will be found
Most distributions follow the file system hierarchy standard (FHS).
The FHS has many other directories. The table shows a list of the other available
directories.
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Commands for managing files and directories
The following commands are important. They are used to manage files and
directories.
10
ls /var command output
•
Different
colors represent different types of
files.
•
l
s
command lists the content of the current
directory.
•
l
s
dir
command lists the content of the
dir
directory.
What the command does
•
The
ls
command displays a list of files in a
directory.
ls command
Understanding command syntax with the
ls
command
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Colors are not defined according to a standard. They depend on the configuration of
the shell that you are using.
You can list several multiple directories, for
example
,
ls directory1
directory2
.
11
Examples of the ls
command
Option
Description
-
l
Long format (shows permissions)
-
h
File sizes reported in a human
-
friendly
format
-
a
Shows all files, including hidden files
-
R
Lists subdirectories
--
sort=extension
or
-
X
Sorts alphabetically by file extension
--
sort=size
or
-
S
Sorts by file size
--
sort=time
or
-
t
Sorts by modification time
--
sort=version
or
-
v
Sorts by
version
number
Useful options
ls
command options and examples
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
By default, the ls command uses the natural sort order.
T
o get results in the reverse
order, add the
–
r
option.
You can combine options:
ls
–
al
displays hidden files and file details.
•
ls
–
l
lists
the contents of the current directory with details. It does not display
the hidden files.
•
ls
–
a
displays the hidden files.
•
ls
–
al
displays the hidden files and the file’s details (not all of the list is
displayed on the screenshot because it would take too much space).
12
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
In this demonstration, the instructor will show how to use
the
ls
command with various options to view information
about files on a Linux system.
Demonstration:
Exploring files and
directories
Follow along as the instructor demonstrates the use of the
ls
command.
13
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
•
Used to view file contents
that don't fit on one screen.
•
Loads entire contents of files
before displaying results
•
Can only scroll down
•
Can be used in conjunction
with other commands:
cat file.txt | more
more
command
Usage:
more [
-
options] [
-
num] [+/pattern] [+linenum] [file_name]
•
Options:
o
-
d
: Displays information about how to navigate at the bottom of the screen
o
-
f
: Prevents line wrap
o
-
p
: Clears the screen before displaying the content
o
-
s
: Squeezes multiple blank lines into one line
•
num
: Number of lines to display
•
/pattern
: String to find in the file
•
linenum
: The line
number
where
the content starts to display
•
file_name
: Name of the file to display the content of
–
Use
-
number to define how many lines a page should contain
14
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
•
Displays file contents that
don't fit on one screen
•
Can scroll up and down
through content
•
Loads faster than
more
because
less
doesn’t
load every page before it
displays results
•
Used mostly for large files
less
command
Usage:
less [OPTIONS] filename
•
U
se
Q
to quit.
•
Options:
o
-
N
: Shows line numbers
o
-
X
: Displays the content after the last command and does not
clear
the
screen when exiting
o
+F
: Watches for file content changes
RSLX EN-US SG M02 WORKWITHFILESYSTEM
<> of 32+-<->Close
6
~]$ ls
–
l m*
myFile
MyFilesList.txt
myFile.txt
~]$
This example shows three different text files
with valid file names.
An example
•
Extensions are optional and not necessarily
mapped to applications.
Understanding file
extensions
•
They are case sensitive.
•
They must be unique within the directory.
•
They should not contain
/
or spaces.
Understanding file names
Linux file names and extensions
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
You are strongly advised to have consistent extensions. For instance, a .jpg image
could be named image.txt even though this extension would not make sense. A user
might think that this file is a description file and try to open it with a text editor
instead of an image viewer. A better option is to
name
it
image.jpeg or image.jpg.
7
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
File
Directory
Hard disk
File system
File systems
File systems: A way of naming, retrieving, and organizing data on the storage disk
The file system organizes how files are stored on the hard drive. A file is located
inside a directory.
8
Directory
Function
/
Root of the file system
/boot
Boot files and kernel
/dev
Devices
/etc
Configuration files
/home
Standard users' home directories
/media
Removable media
/mnt
Network drives
/root
Root user home directory
/var
Log files, print spool, network services
Other FHS directories
•
/
etc
typically contains configuration
files.
•
/var/log
typically contains log
files.
Examples:
File system hierarchy standard (FHS)
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Most Linux distributions use this standard, but some distributions might differ slightly
or intentionally use a different file system.
There are some commonalities between some of these distributions. For example,
there are standard locations and functions of directories across Linux distribution.
Most Linux distributions:
•
Allow software to be compatible with various distributions
•
Allow administrators to predict where certain types of files will be found
Most distributions follow the file system hierarchy standard (FHS).
The FHS has many other directories. The table shows a list of the other available
directories.
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Commands for managing files and directories
The following commands are important. They are used to manage files and
directories.
10
ls /var command output
•
Different
colors represent different types of
files.
•
l
s
command lists the content of the current
directory.
•
l
s
dir
command lists the content of the
dir
directory.
What the command does
•
The
ls
command displays a list of files in a
directory.
ls command
Understanding command syntax with the
ls
command
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Colors are not defined according to a standard. They depend on the configuration of
the shell that you are using.
You can list several multiple directories, for
example
,
ls directory1
directory2
.
11
Examples of the ls
command
Option
Description
-
l
Long format (shows permissions)
-
h
File sizes reported in a human
-
friendly
format
-
a
Shows all files, including hidden files
-
R
Lists subdirectories
--
sort=extension
or
-
X
Sorts alphabetically by file extension
--
sort=size
or
-
S
Sorts by file size
--
sort=time
or
-
t
Sorts by modification time
--
sort=version
or
-
v
Sorts by
version
number
Useful options
ls
command options and examples
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
By default, the ls command uses the natural sort order.
T
o get results in the reverse
order, add the
–
r
option.
You can combine options:
ls
–
al
displays hidden files and file details.
•
ls
–
l
lists
the contents of the current directory with details. It does not display
the hidden files.
•
ls
–
a
displays the hidden files.
•
ls
–
al
displays the hidden files and the file’s details (not all of the list is
displayed on the screenshot because it would take too much space).
12
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
In this demonstration, the instructor will show how to use
the
ls
command with various options to view information
about files on a Linux system.
Demonstration:
Exploring files and
directories
Follow along as the instructor demonstrates the use of the
ls
command.
13
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
•
Used to view file contents
that don't fit on one screen.
•
Loads entire contents of files
before displaying results
•
Can only scroll down
•
Can be used in conjunction
with other commands:
cat file.txt | more
more
command
Usage:
more [
-
options] [
-
num] [+/pattern] [+linenum] [file_name]
•
Options:
o
-
d
: Displays information about how to navigate at the bottom of the screen
o
-
f
: Prevents line wrap
o
-
p
: Clears the screen before displaying the content
o
-
s
: Squeezes multiple blank lines into one line
•
num
: Number of lines to display
•
/pattern
: String to find in the file
•
linenum
: The line
number
where
the content starts to display
•
file_name
: Name of the file to display the content of
–
Use
-
number to define how many lines a page should contain
14
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
•
Displays file contents that
don't fit on one screen
•
Can scroll up and down
through content
•
Loads faster than
more
because
less
doesn’t
load every page before it
displays results
•
Used mostly for large files
less
command
Usage:
less [OPTIONS] filename
•
U
se
Q
to quit.
•
Options:
o
-
N
: Shows line numbers
o
-
X
: Displays the content after the last command and does not
clear
the
screen when exiting
o
+F
: Watches for file content changes
15
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Sudo
head
–
n5/
etc.passwd
When the
head
command is used in
conjunction with the
-
n
option, you can
specify the number of lines to display.
Head
myFile
my
File.txt
•
Displays the first 10 lines of a file by
default
•
C
an display multiple files
head
command
Usage:
head [OPTIONS] filename(s)
•
Options:
o
-
n <number>
: First
n
lines to display
o
-
c <number>
: First
c
bytes to display
RSLX EN-US SG M02 WORKWITHFILESYSTEM
<> of 32+-<->Close
7
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
File
Directory
Hard disk
File system
File systems
File systems: A way of naming, retrieving, and organizing data on the storage disk
The file system organizes how files are stored on the hard drive. A file is located
inside a directory.
8
Directory
Function
/
Root of the file system
/boot
Boot files and kernel
/dev
Devices
/etc
Configuration files
/home
Standard users' home directories
/media
Removable media
/mnt
Network drives
/root
Root user home directory
/var
Log files, print spool, network services
Other FHS directories
•
/
etc
typically contains configuration
files.
•
/var/log
typically contains log
files.
Examples:
File system hierarchy standard (FHS)
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Most Linux distributions use this standard, but some distributions might differ slightly
or intentionally use a different file system.
There are some commonalities between some of these distributions. For example,
there are standard locations and functions of directories across Linux distribution.
Most Linux distributions:
•
Allow software to be compatible with various distributions
•
Allow administrators to predict where certain types of files will be found
Most distributions follow the file system hierarchy standard (FHS).
The FHS has many other directories. The table shows a list of the other available
directories.
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Commands for managing files and directories
The following commands are important. They are used to manage files and
directories.
10
ls /var command output
•
Different
colors represent different types of
files.
•
l
s
command lists the content of the current
directory.
•
l
s
dir
command lists the content of the
dir
directory.
What the command does
•
The
ls
command displays a list of files in a
directory.
ls command
Understanding command syntax with the
ls
command
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Colors are not defined according to a standard. They depend on the configuration of
the shell that you are using.
You can list several multiple directories, for
example
,
ls directory1
directory2
.
11
Examples of the ls
command
Option
Description
-
l
Long format (shows permissions)
-
h
File sizes reported in a human
-
friendly
format
-
a
Shows all files, including hidden files
-
R
Lists subdirectories
--
sort=extension
or
-
X
Sorts alphabetically by file extension
--
sort=size
or
-
S
Sorts by file size
--
sort=time
or
-
t
Sorts by modification time
--
sort=version
or
-
v
Sorts by
version
number
Useful options
ls
command options and examples
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
By default, the ls command uses the natural sort order.
T
o get results in the reverse
order, add the
–
r
option.
You can combine options:
ls
–
al
displays hidden files and file details.
•
ls
–
l
lists
the contents of the current directory with details. It does not display
the hidden files.
•
ls
–
a
displays the hidden files.
•
ls
–
al
displays the hidden files and the file’s details (not all of the list is
displayed on the screenshot because it would take too much space).
12
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
In this demonstration, the instructor will show how to use
the
ls
command with various options to view information
about files on a Linux system.
Demonstration:
Exploring files and
directories
Follow along as the instructor demonstrates the use of the
ls
command.
13
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
•
Used to view file contents
that don't fit on one screen.
•
Loads entire contents of files
before displaying results
•
Can only scroll down
•
Can be used in conjunction
with other commands:
cat file.txt | more
more
command
Usage:
more [
-
options] [
-
num] [+/pattern] [+linenum] [file_name]
•
Options:
o
-
d
: Displays information about how to navigate at the bottom of the screen
o
-
f
: Prevents line wrap
o
-
p
: Clears the screen before displaying the content
o
-
s
: Squeezes multiple blank lines into one line
•
num
: Number of lines to display
•
/pattern
: String to find in the file
•
linenum
: The line
number
where
the content starts to display
•
file_name
: Name of the file to display the content of
–
Use
-
number to define how many lines a page should contain
14
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
•
Displays file contents that
don't fit on one screen
•
Can scroll up and down
through content
•
Loads faster than
more
because
less
doesn’t
load every page before it
displays results
•
Used mostly for large files
less
command
Usage:
less [OPTIONS] filename
•
U
se
Q
to quit.
•
Options:
o
-
N
: Shows line numbers
o
-
X
: Displays the content after the last command and does not
clear
the
screen when exiting
o
+F
: Watches for file content changes
15
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Sudo
head
–
n5/
etc.passwd
When the
head
command is used in
conjunction with the
-
n
option, you can
specify the number of lines to display.
Head
myFile
my
File.txt
•
Displays the first 10 lines of a file by
default
•
C
an display multiple files
head
command
Usage:
head [OPTIONS] filename(s)
•
Options:
o
-
n <number>
: First
n
lines to display
o
-
c <number>
: First
c
bytes to display
16
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
•
Displays the last 10 lines of a file by default
•
Use the
tail
command w
ith the
-
n
option to specify the number of
lines to display.
tail
command
Usage:
tail [OPTIONS] filename(s)
•
Options:
o
-
n <number>
: Last
n
lines to display
o
-
c <number>
: Last
c
bytes to display
o
-
f
: Monitor for file changes
The
tail
-
f
command is useful for log files that are regularly updated and where
the most recent entries are at the bottom of the file.
RSLX EN-US SG M02 WORKWITHFILESYSTEM
<> of 32+-<->Close
8
Directory
Function
/
Root of the file system
/boot
Boot files and kernel
/dev
Devices
/etc
Configuration files
/home
Standard users' home directories
/media
Removable media
/mnt
Network drives
/root
Root user home directory
/var
Log files, print spool, network services
Other FHS directories
•
/
etc
typically contains configuration
files.
•
/var/log
typically contains log
files.
Examples:
File system hierarchy standard (FHS)
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Most Linux distributions use this standard, but some distributions might differ slightly
or intentionally use a different file system.
There are some commonalities between some of these distributions. For example,
there are standard locations and functions of directories across Linux distribution.
Most Linux distributions:
•
Allow software to be compatible with various distributions
•
Allow administrators to predict where certain types of files will be found
Most distributions follow the file system hierarchy standard (FHS).
The FHS has many other directories. The table shows a list of the other available
directories.
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Commands for managing files and directories
The following commands are important. They are used to manage files and
directories.
10
ls /var command output
•
Different
colors represent different types of
files.
•
l
s
command lists the content of the current
directory.
•
l
s
dir
command lists the content of the
dir
directory.
What the command does
•
The
ls
command displays a list of files in a
directory.
ls command
Understanding command syntax with the
ls
command
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Colors are not defined according to a standard. They depend on the configuration of
the shell that you are using.
You can list several multiple directories, for
example
,
ls directory1
directory2
.
11
Examples of the ls
command
Option
Description
-
l
Long format (shows permissions)
-
h
File sizes reported in a human
-
friendly
format
-
a
Shows all files, including hidden files
-
R
Lists subdirectories
--
sort=extension
or
-
X
Sorts alphabetically by file extension
--
sort=size
or
-
S
Sorts by file size
--
sort=time
or
-
t
Sorts by modification time
--
sort=version
or
-
v
Sorts by
version
number
Useful options
ls
command options and examples
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
By default, the ls command uses the natural sort order.
T
o get results in the reverse
order, add the
–
r
option.
You can combine options:
ls
–
al
displays hidden files and file details.
•
ls
–
l
lists
the contents of the current directory with details. It does not display
the hidden files.
•
ls
–
a
displays the hidden files.
•
ls
–
al
displays the hidden files and the file’s details (not all of the list is
displayed on the screenshot because it would take too much space).
12
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
In this demonstration, the instructor will show how to use
the
ls
command with various options to view information
about files on a Linux system.
Demonstration:
Exploring files and
directories
Follow along as the instructor demonstrates the use of the
ls
command.
13
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
•
Used to view file contents
that don't fit on one screen.
•
Loads entire contents of files
before displaying results
•
Can only scroll down
•
Can be used in conjunction
with other commands:
cat file.txt | more
more
command
Usage:
more [
-
options] [
-
num] [+/pattern] [+linenum] [file_name]
•
Options:
o
-
d
: Displays information about how to navigate at the bottom of the screen
o
-
f
: Prevents line wrap
o
-
p
: Clears the screen before displaying the content
o
-
s
: Squeezes multiple blank lines into one line
•
num
: Number of lines to display
•
/pattern
: String to find in the file
•
linenum
: The line
number
where
the content starts to display
•
file_name
: Name of the file to display the content of
–
Use
-
number to define how many lines a page should contain
14
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
•
Displays file contents that
don't fit on one screen
•
Can scroll up and down
through content
•
Loads faster than
more
because
less
doesn’t
load every page before it
displays results
•
Used mostly for large files
less
command
Usage:
less [OPTIONS] filename
•
U
se
Q
to quit.
•
Options:
o
-
N
: Shows line numbers
o
-
X
: Displays the content after the last command and does not
clear
the
screen when exiting
o
+F
: Watches for file content changes
15
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Sudo
head
–
n5/
etc.passwd
When the
head
command is used in
conjunction with the
-
n
option, you can
specify the number of lines to display.
Head
myFile
my
File.txt
•
Displays the first 10 lines of a file by
default
•
C
an display multiple files
head
command
Usage:
head [OPTIONS] filename(s)
•
Options:
o
-
n <number>
: First
n
lines to display
o
-
c <number>
: First
c
bytes to display
16
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
•
Displays the last 10 lines of a file by default
•
Use the
tail
command w
ith the
-
n
option to specify the number of
lines to display.
tail
command
Usage:
tail [OPTIONS] filename(s)
•
Options:
o
-
n <number>
: Last
n
lines to display
o
-
c <number>
: Last
c
bytes to display
o
-
f
: Monitor for file changes
The
tail
-
f
command is useful for log files that are regularly updated and where
the most recent entries are at the bottom of the file.
17
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
•
The
cp
command copies files and
directories.
•
By default, the
cp
command overwrites
existing files that have the same name.
Example:
cp
<
file
-
name
>
<
destination
>
•
For more options, refer to the next slide.
cp
command
Usage:
cp
folderA
/
srcfile
folderB
/
destfile
•
Copies the
srcfile
that
is located in folderA to folderB and names
it
destfile
cp
folderA/srcfile
folderB
/
•
Copies the srcfile that is located in folderA to
folderB
(and
both
files have
the same
name
)
cp folderA/srcfile folderB/
folderC
/
destfile
•
C
opies the srcfile that is located in folderA to folderB and to folderC with
the
name
destfile
RSLX EN-US SG M02 WORKWITHFILESYSTEM
<> of 32+-<->Close
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Commands for managing files and directories
The following commands are important. They are used to manage files and
directories.
10
ls /var command output
•
Different
colors represent different types of
files.
•
l
s
command lists the content of the current
directory.
•
l
s
dir
command lists the content of the
dir
directory.
What the command does
•
The
ls
command displays a list of files in a
directory.
ls command
Understanding command syntax with the
ls
command
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Colors are not defined according to a standard. They depend on the configuration of
the shell that you are using.
You can list several multiple directories, for
example
,
ls directory1
directory2
.
11
Examples of the ls
command
Option
Description
-
l
Long format (shows permissions)
-
h
File sizes reported in a human
-
friendly
format
-
a
Shows all files, including hidden files
-
R
Lists subdirectories
--
sort=extension
or
-
X
Sorts alphabetically by file extension
--
sort=size
or
-
S
Sorts by file size
--
sort=time
or
-
t
Sorts by modification time
--
sort=version
or
-
v
Sorts by
version
number
Useful options
ls
command options and examples
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
By default, the ls command uses the natural sort order.
T
o get results in the reverse
order, add the
–
r
option.
You can combine options:
ls
–
al
displays hidden files and file details.
•
ls
–
l
lists
the contents of the current directory with details. It does not display
the hidden files.
•
ls
–
a
displays the hidden files.
•
ls
–
al
displays the hidden files and the file’s details (not all of the list is
displayed on the screenshot because it would take too much space).
12
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
In this demonstration, the instructor will show how to use
the
ls
command with various options to view information
about files on a Linux system.
Demonstration:
Exploring files and
directories
Follow along as the instructor demonstrates the use of the
ls
command.
13
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
•
Used to view file contents
that don't fit on one screen.
•
Loads entire contents of files
before displaying results
•
Can only scroll down
•
Can be used in conjunction
with other commands:
cat file.txt | more
more
command
Usage:
more [
-
options] [
-
num] [+/pattern] [+linenum] [file_name]
•
Options:
o
-
d
: Displays information about how to navigate at the bottom of the screen
o
-
f
: Prevents line wrap
o
-
p
: Clears the screen before displaying the content
o
-
s
: Squeezes multiple blank lines into one line
•
num
: Number of lines to display
•
/pattern
: String to find in the file
•
linenum
: The line
number
where
the content starts to display
•
file_name
: Name of the file to display the content of
–
Use
-
number to define how many lines a page should contain
14
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
•
Displays file contents that
don't fit on one screen
•
Can scroll up and down
through content
•
Loads faster than
more
because
less
doesn’t
load every page before it
displays results
•
Used mostly for large files
less
command
Usage:
less [OPTIONS] filename
•
U
se
Q
to quit.
•
Options:
o
-
N
: Shows line numbers
o
-
X
: Displays the content after the last command and does not
clear
the
screen when exiting
o
+F
: Watches for file content changes
15
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Sudo
head
–
n5/
etc.passwd
When the
head
command is used in
conjunction with the
-
n
option, you can
specify the number of lines to display.
Head
myFile
my
File.txt
•
Displays the first 10 lines of a file by
default
•
C
an display multiple files
head
command
Usage:
head [OPTIONS] filename(s)
•
Options:
o
-
n <number>
: First
n
lines to display
o
-
c <number>
: First
c
bytes to display
16
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
•
Displays the last 10 lines of a file by default
•
Use the
tail
command w
ith the
-
n
option to specify the number of
lines to display.
tail
command
Usage:
tail [OPTIONS] filename(s)
•
Options:
o
-
n <number>
: Last
n
lines to display
o
-
c <number>
: Last
c
bytes to display
o
-
f
: Monitor for file changes
The
tail
-
f
command is useful for log files that are regularly updated and where
the most recent entries are at the bottom of the file.
17
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
•
The
cp
command copies files and
directories.
•
By default, the
cp
command overwrites
existing files that have the same name.
Example:
cp
<
file
-
name
>
<
destination
>
•
For more options, refer to the next slide.
cp
command
Usage:
cp
folderA
/
srcfile
folderB
/
destfile
•
Copies the
srcfile
that
is located in folderA to folderB and names
it
destfile
cp
folderA/srcfile
folderB
/
•
Copies the srcfile that is located in folderA to
folderB
(and
both
files have
the same
name
)
cp folderA/srcfile folderB/
folderC
/
destfile
•
C
opies the srcfile that is located in folderA to folderB and to folderC with
the
name
destfile
18
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Option
Description
cp
-
a
Archive files
cp
-
f
Force copy by overwriting the destination file if needed
cp
-
i
Interactive
–
Ask before overwrite
cp
-
l
Link files instead of copy
cp
-
L
Follow symbolic links
cp
-
n
No file overwrite
cp
-
R
Recursive copy (including hidden files)
cp
-
u
Update
–
Copy when source is newer than destination
cp
-
v
Verbose
–
Print informative messages
cp
command: Additional options
This slide shows additional options for the cp command that you can use.
RSLX EN-US SG M02 WORKWITHFILESYSTEM
<> of 32+-<->Close
10
ls /var command output
•
Different
colors represent different types of
files.
•
l
s
command lists the content of the current
directory.
•
l
s
dir
command lists the content of the
dir
directory.
What the command does
•
The
ls
command displays a list of files in a
directory.
ls command
Understanding command syntax with the
ls
command
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Colors are not defined according to a standard. They depend on the configuration of
the shell that you are using.
You can list several multiple directories, for
example
,
ls directory1
directory2
.
11
Examples of the ls
command
Option
Description
-
l
Long format (shows permissions)
-
h
File sizes reported in a human
-
friendly
format
-
a
Shows all files, including hidden files
-
R
Lists subdirectories
--
sort=extension
or
-
X
Sorts alphabetically by file extension
--
sort=size
or
-
S
Sorts by file size
--
sort=time
or
-
t
Sorts by modification time
--
sort=version
or
-
v
Sorts by
version
number
Useful options
ls
command options and examples
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
By default, the ls command uses the natural sort order.
T
o get results in the reverse
order, add the
–
r
option.
You can combine options:
ls
–
al
displays hidden files and file details.
•
ls
–
l
lists
the contents of the current directory with details. It does not display
the hidden files.
•
ls
–
a
displays the hidden files.
•
ls
–
al
displays the hidden files and the file’s details (not all of the list is
displayed on the screenshot because it would take too much space).
12
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
In this demonstration, the instructor will show how to use
the
ls
command with various options to view information
about files on a Linux system.
Demonstration:
Exploring files and
directories
Follow along as the instructor demonstrates the use of the
ls
command.
13
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
•
Used to view file contents
that don't fit on one screen.
•
Loads entire contents of files
before displaying results
•
Can only scroll down
•
Can be used in conjunction
with other commands:
cat file.txt | more
more
command
Usage:
more [
-
options] [
-
num] [+/pattern] [+linenum] [file_name]
•
Options:
o
-
d
: Displays information about how to navigate at the bottom of the screen
o
-
f
: Prevents line wrap
o
-
p
: Clears the screen before displaying the content
o
-
s
: Squeezes multiple blank lines into one line
•
num
: Number of lines to display
•
/pattern
: String to find in the file
•
linenum
: The line
number
where
the content starts to display
•
file_name
: Name of the file to display the content of
–
Use
-
number to define how many lines a page should contain
14
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
•
Displays file contents that
don't fit on one screen
•
Can scroll up and down
through content
•
Loads faster than
more
because
less
doesn’t
load every page before it
displays results
•
Used mostly for large files
less
command
Usage:
less [OPTIONS] filename
•
U
se
Q
to quit.
•
Options:
o
-
N
: Shows line numbers
o
-
X
: Displays the content after the last command and does not
clear
the
screen when exiting
o
+F
: Watches for file content changes
15
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Sudo
head
–
n5/
etc.passwd
When the
head
command is used in
conjunction with the
-
n
option, you can
specify the number of lines to display.
Head
myFile
my
File.txt
•
Displays the first 10 lines of a file by
default
•
C
an display multiple files
head
command
Usage:
head [OPTIONS] filename(s)
•
Options:
o
-
n <number>
: First
n
lines to display
o
-
c <number>
: First
c
bytes to display
16
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
•
Displays the last 10 lines of a file by default
•
Use the
tail
command w
ith the
-
n
option to specify the number of
lines to display.
tail
command
Usage:
tail [OPTIONS] filename(s)
•
Options:
o
-
n <number>
: Last
n
lines to display
o
-
c <number>
: Last
c
bytes to display
o
-
f
: Monitor for file changes
The
tail
-
f
command is useful for log files that are regularly updated and where
the most recent entries are at the bottom of the file.
17
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
•
The
cp
command copies files and
directories.
•
By default, the
cp
command overwrites
existing files that have the same name.
Example:
cp
<
file
-
name
>
<
destination
>
•
For more options, refer to the next slide.
cp
command
Usage:
cp
folderA
/
srcfile
folderB
/
destfile
•
Copies the
srcfile
that
is located in folderA to folderB and names
it
destfile
cp
folderA/srcfile
folderB
/
•
Copies the srcfile that is located in folderA to
folderB
(and
both
files have
the same
name
)
cp folderA/srcfile folderB/
folderC
/
destfile
•
C
opies the srcfile that is located in folderA to folderB and to folderC with
the
name
destfile
18
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Option
Description
cp
-
a
Archive files
cp
-
f
Force copy by overwriting the destination file if needed
cp
-
i
Interactive
–
Ask before overwrite
cp
-
l
Link files instead of copy
cp
-
L
Follow symbolic links
cp
-
n
No file overwrite
cp
-
R
Recursive copy (including hidden files)
cp
-
u
Update
–
Copy when source is newer than destination
cp
-
v
Verbose
–
Print informative messages
cp
command: Additional options
This slide shows additional options for the cp command that you can use.
19
An example
]$
rm [OPTIONS] filename(s)
Usage
•
If a file
is
write
protected
, a prompt
will
ask
the user for confirmation.
•
Several
files
can
be
removed
at once.
•
If you want to remove a complete
directory, use the
–
r and
–
f option:
rm
–
rf
dir
Key features
The
rm
command
deletes
files.
rm
command
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Usage:
rm [OPTIONS] filename(s)
•
Options:
o
-
d
: Removes a directory; the directory must be empty:
rm
–
d dir
o
-
r
:
Allows
you to remove a non
-
empty directory:
rm
–
r dir
o
-
f
: Never prompt user (useful when deleting a directory with many files)
o
-
i
: Prompts the user for confirmation for
each
file
o
-
v
: Display the names of deleted files
•
If a file is write protected, a prompt will ask the user for confirmation.
•
Several files can be removed at once.
•
If you want to remove a complete directory, use the
–
r and
–
f option:
rm
–
rf
dir
•
You
can use a regular expression:
rm *.png
removes all files that end with .png.
RSLX EN-US SG M02 WORKWITHFILESYSTEM
<> of 32+-<->Close
11
Examples of the ls
command
Option
Description
-
l
Long format (shows permissions)
-
h
File sizes reported in a human
-
friendly
format
-
a
Shows all files, including hidden files
-
R
Lists subdirectories
--
sort=extension
or
-
X
Sorts alphabetically by file extension
--
sort=size
or
-
S
Sorts by file size
--
sort=time
or
-
t
Sorts by modification time
--
sort=version
or
-
v
Sorts by
version
number
Useful options
ls
command options and examples
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
By default, the ls command uses the natural sort order.
T
o get results in the reverse
order, add the
–
r
option.
You can combine options:
ls
–
al
displays hidden files and file details.
•
ls
–
l
lists
the contents of the current directory with details. It does not display
the hidden files.
•
ls
–
a
displays the hidden files.
•
ls
–
al
displays the hidden files and the file’s details (not all of the list is
displayed on the screenshot because it would take too much space).
12
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
In this demonstration, the instructor will show how to use
the
ls
command with various options to view information
about files on a Linux system.
Demonstration:
Exploring files and
directories
Follow along as the instructor demonstrates the use of the
ls
command.
13
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
•
Used to view file contents
that don't fit on one screen.
•
Loads entire contents of files
before displaying results
•
Can only scroll down
•
Can be used in conjunction
with other commands:
cat file.txt | more
more
command
Usage:
more [
-
options] [
-
num] [+/pattern] [+linenum] [file_name]
•
Options:
o
-
d
: Displays information about how to navigate at the bottom of the screen
o
-
f
: Prevents line wrap
o
-
p
: Clears the screen before displaying the content
o
-
s
: Squeezes multiple blank lines into one line
•
num
: Number of lines to display
•
/pattern
: String to find in the file
•
linenum
: The line
number
where
the content starts to display
•
file_name
: Name of the file to display the content of
–
Use
-
number to define how many lines a page should contain
14
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
•
Displays file contents that
don't fit on one screen
•
Can scroll up and down
through content
•
Loads faster than
more
because
less
doesn’t
load every page before it
displays results
•
Used mostly for large files
less
command
Usage:
less [OPTIONS] filename
•
U
se
Q
to quit.
•
Options:
o
-
N
: Shows line numbers
o
-
X
: Displays the content after the last command and does not
clear
the
screen when exiting
o
+F
: Watches for file content changes
15
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Sudo
head
–
n5/
etc.passwd
When the
head
command is used in
conjunction with the
-
n
option, you can
specify the number of lines to display.
Head
myFile
my
File.txt
•
Displays the first 10 lines of a file by
default
•
C
an display multiple files
head
command
Usage:
head [OPTIONS] filename(s)
•
Options:
o
-
n <number>
: First
n
lines to display
o
-
c <number>
: First
c
bytes to display
16
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
•
Displays the last 10 lines of a file by default
•
Use the
tail
command w
ith the
-
n
option to specify the number of
lines to display.
tail
command
Usage:
tail [OPTIONS] filename(s)
•
Options:
o
-
n <number>
: Last
n
lines to display
o
-
c <number>
: Last
c
bytes to display
o
-
f
: Monitor for file changes
The
tail
-
f
command is useful for log files that are regularly updated and where
the most recent entries are at the bottom of the file.
17
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
•
The
cp
command copies files and
directories.
•
By default, the
cp
command overwrites
existing files that have the same name.
Example:
cp
<
file
-
name
>
<
destination
>
•
For more options, refer to the next slide.
cp
command
Usage:
cp
folderA
/
srcfile
folderB
/
destfile
•
Copies the
srcfile
that
is located in folderA to folderB and names
it
destfile
cp
folderA/srcfile
folderB
/
•
Copies the srcfile that is located in folderA to
folderB
(and
both
files have
the same
name
)
cp folderA/srcfile folderB/
folderC
/
destfile
•
C
opies the srcfile that is located in folderA to folderB and to folderC with
the
name
destfile
18
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Option
Description
cp
-
a
Archive files
cp
-
f
Force copy by overwriting the destination file if needed
cp
-
i
Interactive
–
Ask before overwrite
cp
-
l
Link files instead of copy
cp
-
L
Follow symbolic links
cp
-
n
No file overwrite
cp
-
R
Recursive copy (including hidden files)
cp
-
u
Update
–
Copy when source is newer than destination
cp
-
v
Verbose
–
Print informative messages
cp
command: Additional options
This slide shows additional options for the cp command that you can use.
19
An example
]$
rm [OPTIONS] filename(s)
Usage
•
If a file
is
write
protected
, a prompt
will
ask
the user for confirmation.
•
Several
files
can
be
removed
at once.
•
If you want to remove a complete
directory, use the
–
r and
–
f option:
rm
–
rf
dir
Key features
The
rm
command
deletes
files.
rm
command
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Usage:
rm [OPTIONS] filename(s)
•
Options:
o
-
d
: Removes a directory; the directory must be empty:
rm
–
d dir
o
-
r
:
Allows
you to remove a non
-
empty directory:
rm
–
r dir
o
-
f
: Never prompt user (useful when deleting a directory with many files)
o
-
i
: Prompts the user for confirmation for
each
file
o
-
v
: Display the names of deleted files
•
If a file is write protected, a prompt will ask the user for confirmation.
•
Several files can be removed at once.
•
If you want to remove a complete directory, use the
–
r and
–
f option:
rm
–
rf
dir
•
You
can use a regular expression:
rm *.png
removes all files that end with .png.
20
An example
]$
mkdir
[OPTIONS] filename(s)
Usage
•
-
m<
mask
>
: Sets a permission to the
directory
•
-
p
:
Creates
a parent directory
Options
The
mkdir
command creates new
directories.
mkdir
command
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Usage:
mkdir
[OPTIONS] filename(s)
Options:
•
-
m<
mask
>
: Sets a permission to the directory
•
-
p
:
Creates
a parent directory
You can
create
several
directories
with
one command:
mkdir
dir1
dir2
dir3
.
mkdir
–
m 700
dir1
creates
the
dir1
directory
with
the
mask
700
for
permissions.
mkdir
–
p /home/user/dir1/dir2
: If
dir1
does
not
exist
, the
creation
will
fail
without
the
–
p
option.
RSLX EN-US SG M02 WORKWITHFILESYSTEM
<> of 32+-<->Close
12
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
In this demonstration, the instructor will show how to use
the
ls
command with various options to view information
about files on a Linux system.
Demonstration:
Exploring files and
directories
Follow along as the instructor demonstrates the use of the
ls
command.
13
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
•
Used to view file contents
that don't fit on one screen.
•
Loads entire contents of files
before displaying results
•
Can only scroll down
•
Can be used in conjunction
with other commands:
cat file.txt | more
more
command
Usage:
more [
-
options] [
-
num] [+/pattern] [+linenum] [file_name]
•
Options:
o
-
d
: Displays information about how to navigate at the bottom of the screen
o
-
f
: Prevents line wrap
o
-
p
: Clears the screen before displaying the content
o
-
s
: Squeezes multiple blank lines into one line
•
num
: Number of lines to display
•
/pattern
: String to find in the file
•
linenum
: The line
number
where
the content starts to display
•
file_name
: Name of the file to display the content of
–
Use
-
number to define how many lines a page should contain
14
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
•
Displays file contents that
don't fit on one screen
•
Can scroll up and down
through content
•
Loads faster than
more
because
less
doesn’t
load every page before it
displays results
•
Used mostly for large files
less
command
Usage:
less [OPTIONS] filename
•
U
se
Q
to quit.
•
Options:
o
-
N
: Shows line numbers
o
-
X
: Displays the content after the last command and does not
clear
the
screen when exiting
o
+F
: Watches for file content changes
15
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Sudo
head
–
n5/
etc.passwd
When the
head
command is used in
conjunction with the
-
n
option, you can
specify the number of lines to display.
Head
myFile
my
File.txt
•
Displays the first 10 lines of a file by
default
•
C
an display multiple files
head
command
Usage:
head [OPTIONS] filename(s)
•
Options:
o
-
n <number>
: First
n
lines to display
o
-
c <number>
: First
c
bytes to display
16
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
•
Displays the last 10 lines of a file by default
•
Use the
tail
command w
ith the
-
n
option to specify the number of
lines to display.
tail
command
Usage:
tail [OPTIONS] filename(s)
•
Options:
o
-
n <number>
: Last
n
lines to display
o
-
c <number>
: Last
c
bytes to display
o
-
f
: Monitor for file changes
The
tail
-
f
command is useful for log files that are regularly updated and where
the most recent entries are at the bottom of the file.
17
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
•
The
cp
command copies files and
directories.
•
By default, the
cp
command overwrites
existing files that have the same name.
Example:
cp
<
file
-
name
>
<
destination
>
•
For more options, refer to the next slide.
cp
command
Usage:
cp
folderA
/
srcfile
folderB
/
destfile
•
Copies the
srcfile
that
is located in folderA to folderB and names
it
destfile
cp
folderA/srcfile
folderB
/
•
Copies the srcfile that is located in folderA to
folderB
(and
both
files have
the same
name
)
cp folderA/srcfile folderB/
folderC
/
destfile
•
C
opies the srcfile that is located in folderA to folderB and to folderC with
the
name
destfile
18
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Option
Description
cp
-
a
Archive files
cp
-
f
Force copy by overwriting the destination file if needed
cp
-
i
Interactive
–
Ask before overwrite
cp
-
l
Link files instead of copy
cp
-
L
Follow symbolic links
cp
-
n
No file overwrite
cp
-
R
Recursive copy (including hidden files)
cp
-
u
Update
–
Copy when source is newer than destination
cp
-
v
Verbose
–
Print informative messages
cp
command: Additional options
This slide shows additional options for the cp command that you can use.
19
An example
]$
rm [OPTIONS] filename(s)
Usage
•
If a file
is
write
protected
, a prompt
will
ask
the user for confirmation.
•
Several
files
can
be
removed
at once.
•
If you want to remove a complete
directory, use the
–
r and
–
f option:
rm
–
rf
dir
Key features
The
rm
command
deletes
files.
rm
command
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Usage:
rm [OPTIONS] filename(s)
•
Options:
o
-
d
: Removes a directory; the directory must be empty:
rm
–
d dir
o
-
r
:
Allows
you to remove a non
-
empty directory:
rm
–
r dir
o
-
f
: Never prompt user (useful when deleting a directory with many files)
o
-
i
: Prompts the user for confirmation for
each
file
o
-
v
: Display the names of deleted files
•
If a file is write protected, a prompt will ask the user for confirmation.
•
Several files can be removed at once.
•
If you want to remove a complete directory, use the
–
r and
–
f option:
rm
–
rf
dir
•
You
can use a regular expression:
rm *.png
removes all files that end with .png.
20
An example
]$
mkdir
[OPTIONS] filename(s)
Usage
•
-
m<
mask
>
: Sets a permission to the
directory
•
-
p
:
Creates
a parent directory
Options
The
mkdir
command creates new
directories.
mkdir
command
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Usage:
mkdir
[OPTIONS] filename(s)
Options:
•
-
m<
mask
>
: Sets a permission to the directory
•
-
p
:
Creates
a parent directory
You can
create
several
directories
with
one command:
mkdir
dir1
dir2
dir3
.
mkdir
–
m 700
dir1
creates
the
dir1
directory
with
the
mask
700
for
permissions.
mkdir
–
p /home/user/dir1/dir2
: If
dir1
does
not
exist
, the
creation
will
fail
without
the
–
p
option.
21
An example
]$
mv [OPTIONS] destination
Usage
By default, the
mv
command overwrites existing
files that have the same name.
Note:
The
mv
command moves a file from one
directory to another.
The
mv
command renames a file if the
source and destination are the same
mv
command
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Usage:
mv [OPTIONS] source destination
Options:
•
-
i
: Prompts
before
overwritting
a file
•
-
f
:
Avoids
being
prompted
•
-
n
:
Does
not
overwrite
existing
files
•
-
v
:
Verbose
option,
prints
the
name
of files
that
are
moved
or
renamed
•
m
v file1 dir1
:
Moves file1 to dir1
•
m
v dir1 dir2
:
Moves dir1 to dir2
•
m
v file1 file2 dir1 dir2
:
Moves file1, file2, and dir1 to dir2; there can
only be one target directory here, dir2
•
m
v file1 dir1/file2
:
Moves file1 to dir1 and renames it file2
•
m
v file1 file2
:
Renames file1 as file2
You
can use a regular expression to move files of the same type:
m
v *.
png
dir1
moves all
files with extension .
png
into
dir1
.
RSLX EN-US SG M02 WORKWITHFILESYSTEM
<> of 32+-<->Close
13
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
•
Used to view file contents
that don't fit on one screen.
•
Loads entire contents of files
before displaying results
•
Can only scroll down
•
Can be used in conjunction
with other commands:
cat file.txt | more
more
command
Usage:
more [
-
options] [
-
num] [+/pattern] [+linenum] [file_name]
•
Options:
o
-
d
: Displays information about how to navigate at the bottom of the screen
o
-
f
: Prevents line wrap
o
-
p
: Clears the screen before displaying the content
o
-
s
: Squeezes multiple blank lines into one line
•
num
: Number of lines to display
•
/pattern
: String to find in the file
•
linenum
: The line
number
where
the content starts to display
•
file_name
: Name of the file to display the content of
–
Use
-
number to define how many lines a page should contain
14
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
•
Displays file contents that
don't fit on one screen
•
Can scroll up and down
through content
•
Loads faster than
more
because
less
doesn’t
load every page before it
displays results
•
Used mostly for large files
less
command
Usage:
less [OPTIONS] filename
•
U
se
Q
to quit.
•
Options:
o
-
N
: Shows line numbers
o
-
X
: Displays the content after the last command and does not
clear
the
screen when exiting
o
+F
: Watches for file content changes
15
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Sudo
head
–
n5/
etc.passwd
When the
head
command is used in
conjunction with the
-
n
option, you can
specify the number of lines to display.
Head
myFile
my
File.txt
•
Displays the first 10 lines of a file by
default
•
C
an display multiple files
head
command
Usage:
head [OPTIONS] filename(s)
•
Options:
o
-
n <number>
: First
n
lines to display
o
-
c <number>
: First
c
bytes to display
16
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
•
Displays the last 10 lines of a file by default
•
Use the
tail
command w
ith the
-
n
option to specify the number of
lines to display.
tail
command
Usage:
tail [OPTIONS] filename(s)
•
Options:
o
-
n <number>
: Last
n
lines to display
o
-
c <number>
: Last
c
bytes to display
o
-
f
: Monitor for file changes
The
tail
-
f
command is useful for log files that are regularly updated and where
the most recent entries are at the bottom of the file.
17
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
•
The
cp
command copies files and
directories.
•
By default, the
cp
command overwrites
existing files that have the same name.
Example:
cp
<
file
-
name
>
<
destination
>
•
For more options, refer to the next slide.
cp
command
Usage:
cp
folderA
/
srcfile
folderB
/
destfile
•
Copies the
srcfile
that
is located in folderA to folderB and names
it
destfile
cp
folderA/srcfile
folderB
/
•
Copies the srcfile that is located in folderA to
folderB
(and
both
files have
the same
name
)
cp folderA/srcfile folderB/
folderC
/
destfile
•
C
opies the srcfile that is located in folderA to folderB and to folderC with
the
name
destfile
18
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Option
Description
cp
-
a
Archive files
cp
-
f
Force copy by overwriting the destination file if needed
cp
-
i
Interactive
–
Ask before overwrite
cp
-
l
Link files instead of copy
cp
-
L
Follow symbolic links
cp
-
n
No file overwrite
cp
-
R
Recursive copy (including hidden files)
cp
-
u
Update
–
Copy when source is newer than destination
cp
-
v
Verbose
–
Print informative messages
cp
command: Additional options
This slide shows additional options for the cp command that you can use.
19
An example
]$
rm [OPTIONS] filename(s)
Usage
•
If a file
is
write
protected
, a prompt
will
ask
the user for confirmation.
•
Several
files
can
be
removed
at once.
•
If you want to remove a complete
directory, use the
–
r and
–
f option:
rm
–
rf
dir
Key features
The
rm
command
deletes
files.
rm
command
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Usage:
rm [OPTIONS] filename(s)
•
Options:
o
-
d
: Removes a directory; the directory must be empty:
rm
–
d dir
o
-
r
:
Allows
you to remove a non
-
empty directory:
rm
–
r dir
o
-
f
: Never prompt user (useful when deleting a directory with many files)
o
-
i
: Prompts the user for confirmation for
each
file
o
-
v
: Display the names of deleted files
•
If a file is write protected, a prompt will ask the user for confirmation.
•
Several files can be removed at once.
•
If you want to remove a complete directory, use the
–
r and
–
f option:
rm
–
rf
dir
•
You
can use a regular expression:
rm *.png
removes all files that end with .png.
20
An example
]$
mkdir
[OPTIONS] filename(s)
Usage
•
-
m<
mask
>
: Sets a permission to the
directory
•
-
p
:
Creates
a parent directory
Options
The
mkdir
command creates new
directories.
mkdir
command
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Usage:
mkdir
[OPTIONS] filename(s)
Options:
•
-
m<
mask
>
: Sets a permission to the directory
•
-
p
:
Creates
a parent directory
You can
create
several
directories
with
one command:
mkdir
dir1
dir2
dir3
.
mkdir
–
m 700
dir1
creates
the
dir1
directory
with
the
mask
700
for
permissions.
mkdir
–
p /home/user/dir1/dir2
: If
dir1
does
not
exist
, the
creation
will
fail
without
the
–
p
option.
21
An example
]$
mv [OPTIONS] destination
Usage
By default, the
mv
command overwrites existing
files that have the same name.
Note:
The
mv
command moves a file from one
directory to another.
The
mv
command renames a file if the
source and destination are the same
mv
command
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Usage:
mv [OPTIONS] source destination
Options:
•
-
i
: Prompts
before
overwritting
a file
•
-
f
:
Avoids
being
prompted
•
-
n
:
Does
not
overwrite
existing
files
•
-
v
:
Verbose
option,
prints
the
name
of files
that
are
moved
or
renamed
•
m
v file1 dir1
:
Moves file1 to dir1
•
m
v dir1 dir2
:
Moves dir1 to dir2
•
m
v file1 file2 dir1 dir2
:
Moves file1, file2, and dir1 to dir2; there can
only be one target directory here, dir2
•
m
v file1 dir1/file2
:
Moves file1 to dir1 and renames it file2
•
m
v file1 file2
:
Renames file1 as file2
You
can use a regular expression to move files of the same type:
m
v *.
png
dir1
moves all
files with extension .
png
into
dir1
.
22
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
The
rmdir
command deletes existing empty directories:
rmdir
<DirectoryName>
If a directory isn’t empty, use
rm
-
r<
DirectoryName
>
.
This command removes a directory and all of its contents.
rmdir
command
rmdir
is equivalent to
rm
–
d
.
RSLX EN-US SG M02 WORKWITHFILESYSTEM
<> of 32+-<->Close
14
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
•
Displays file contents that
don't fit on one screen
•
Can scroll up and down
through content
•
Loads faster than
more
because
less
doesn’t
load every page before it
displays results
•
Used mostly for large files
less
command
Usage:
less [OPTIONS] filename
•
U
se
Q
to quit.
•
Options:
o
-
N
: Shows line numbers
o
-
X
: Displays the content after the last command and does not
clear
the
screen when exiting
o
+F
: Watches for file content changes
15
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Sudo
head
–
n5/
etc.passwd
When the
head
command is used in
conjunction with the
-
n
option, you can
specify the number of lines to display.
Head
myFile
my
File.txt
•
Displays the first 10 lines of a file by
default
•
C
an display multiple files
head
command
Usage:
head [OPTIONS] filename(s)
•
Options:
o
-
n <number>
: First
n
lines to display
o
-
c <number>
: First
c
bytes to display
16
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
•
Displays the last 10 lines of a file by default
•
Use the
tail
command w
ith the
-
n
option to specify the number of
lines to display.
tail
command
Usage:
tail [OPTIONS] filename(s)
•
Options:
o
-
n <number>
: Last
n
lines to display
o
-
c <number>
: Last
c
bytes to display
o
-
f
: Monitor for file changes
The
tail
-
f
command is useful for log files that are regularly updated and where
the most recent entries are at the bottom of the file.
17
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
•
The
cp
command copies files and
directories.
•
By default, the
cp
command overwrites
existing files that have the same name.
Example:
cp
<
file
-
name
>
<
destination
>
•
For more options, refer to the next slide.
cp
command
Usage:
cp
folderA
/
srcfile
folderB
/
destfile
•
Copies the
srcfile
that
is located in folderA to folderB and names
it
destfile
cp
folderA/srcfile
folderB
/
•
Copies the srcfile that is located in folderA to
folderB
(and
both
files have
the same
name
)
cp folderA/srcfile folderB/
folderC
/
destfile
•
C
opies the srcfile that is located in folderA to folderB and to folderC with
the
name
destfile
18
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Option
Description
cp
-
a
Archive files
cp
-
f
Force copy by overwriting the destination file if needed
cp
-
i
Interactive
–
Ask before overwrite
cp
-
l
Link files instead of copy
cp
-
L
Follow symbolic links
cp
-
n
No file overwrite
cp
-
R
Recursive copy (including hidden files)
cp
-
u
Update
–
Copy when source is newer than destination
cp
-
v
Verbose
–
Print informative messages
cp
command: Additional options
This slide shows additional options for the cp command that you can use.
19
An example
]$
rm [OPTIONS] filename(s)
Usage
•
If a file
is
write
protected
, a prompt
will
ask
the user for confirmation.
•
Several
files
can
be
removed
at once.
•
If you want to remove a complete
directory, use the
–
r and
–
f option:
rm
–
rf
dir
Key features
The
rm
command
deletes
files.
rm
command
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Usage:
rm [OPTIONS] filename(s)
•
Options:
o
-
d
: Removes a directory; the directory must be empty:
rm
–
d dir
o
-
r
:
Allows
you to remove a non
-
empty directory:
rm
–
r dir
o
-
f
: Never prompt user (useful when deleting a directory with many files)
o
-
i
: Prompts the user for confirmation for
each
file
o
-
v
: Display the names of deleted files
•
If a file is write protected, a prompt will ask the user for confirmation.
•
Several files can be removed at once.
•
If you want to remove a complete directory, use the
–
r and
–
f option:
rm
–
rf
dir
•
You
can use a regular expression:
rm *.png
removes all files that end with .png.
20
An example
]$
mkdir
[OPTIONS] filename(s)
Usage
•
-
m<
mask
>
: Sets a permission to the
directory
•
-
p
:
Creates
a parent directory
Options
The
mkdir
command creates new
directories.
mkdir
command
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Usage:
mkdir
[OPTIONS] filename(s)
Options:
•
-
m<
mask
>
: Sets a permission to the directory
•
-
p
:
Creates
a parent directory
You can
create
several
directories
with
one command:
mkdir
dir1
dir2
dir3
.
mkdir
–
m 700
dir1
creates
the
dir1
directory
with
the
mask
700
for
permissions.
mkdir
–
p /home/user/dir1/dir2
: If
dir1
does
not
exist
, the
creation
will
fail
without
the
–
p
option.
21
An example
]$
mv [OPTIONS] destination
Usage
By default, the
mv
command overwrites existing
files that have the same name.
Note:
The
mv
command moves a file from one
directory to another.
The
mv
command renames a file if the
source and destination are the same
mv
command
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Usage:
mv [OPTIONS] source destination
Options:
•
-
i
: Prompts
before
overwritting
a file
•
-
f
:
Avoids
being
prompted
•
-
n
:
Does
not
overwrite
existing
files
•
-
v
:
Verbose
option,
prints
the
name
of files
that
are
moved
or
renamed
•
m
v file1 dir1
:
Moves file1 to dir1
•
m
v dir1 dir2
:
Moves dir1 to dir2
•
m
v file1 file2 dir1 dir2
:
Moves file1, file2, and dir1 to dir2; there can
only be one target directory here, dir2
•
m
v file1 dir1/file2
:
Moves file1 to dir1 and renames it file2
•
m
v file1 file2
:
Renames file1 as file2
You
can use a regular expression to move files of the same type:
m
v *.
png
dir1
moves all
files with extension .
png
into
dir1
.
22
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
The
rmdir
command deletes existing empty directories:
rmdir
<DirectoryName>
If a directory isn’t empty, use
rm
-
r<
DirectoryName
>
.
This command removes a directory and all of its contents.
rmdir
command
rmdir
is equivalent to
rm
–
d
.
23
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
•
Output of the
pwd
command: Absolute path to your current location in the file system
•
Essential for navigation: You must know where you are in the file system to move to
other
directories.
pwd
command
Use the
pwd
command to know where you are in the file directory structure.
RSLX EN-US SG M02 WORKWITHFILESYSTEM
<> of 32+-<->Close
15
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Sudo
head
–
n5/
etc.passwd
When the
head
command is used in
conjunction with the
-
n
option, you can
specify the number of lines to display.
Head
myFile
my
File.txt
•
Displays the first 10 lines of a file by
default
•
C
an display multiple files
head
command
Usage:
head [OPTIONS] filename(s)
•
Options:
o
-
n <number>
: First
n
lines to display
o
-
c <number>
: First
c
bytes to display
16
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
•
Displays the last 10 lines of a file by default
•
Use the
tail
command w
ith the
-
n
option to specify the number of
lines to display.
tail
command
Usage:
tail [OPTIONS] filename(s)
•
Options:
o
-
n <number>
: Last
n
lines to display
o
-
c <number>
: Last
c
bytes to display
o
-
f
: Monitor for file changes
The
tail
-
f
command is useful for log files that are regularly updated and where
the most recent entries are at the bottom of the file.
17
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
•
The
cp
command copies files and
directories.
•
By default, the
cp
command overwrites
existing files that have the same name.
Example:
cp
<
file
-
name
>
<
destination
>
•
For more options, refer to the next slide.
cp
command
Usage:
cp
folderA
/
srcfile
folderB
/
destfile
•
Copies the
srcfile
that
is located in folderA to folderB and names
it
destfile
cp
folderA/srcfile
folderB
/
•
Copies the srcfile that is located in folderA to
folderB
(and
both
files have
the same
name
)
cp folderA/srcfile folderB/
folderC
/
destfile
•
C
opies the srcfile that is located in folderA to folderB and to folderC with
the
name
destfile
18
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Option
Description
cp
-
a
Archive files
cp
-
f
Force copy by overwriting the destination file if needed
cp
-
i
Interactive
–
Ask before overwrite
cp
-
l
Link files instead of copy
cp
-
L
Follow symbolic links
cp
-
n
No file overwrite
cp
-
R
Recursive copy (including hidden files)
cp
-
u
Update
–
Copy when source is newer than destination
cp
-
v
Verbose
–
Print informative messages
cp
command: Additional options
This slide shows additional options for the cp command that you can use.
19
An example
]$
rm [OPTIONS] filename(s)
Usage
•
If a file
is
write
protected
, a prompt
will
ask
the user for confirmation.
•
Several
files
can
be
removed
at once.
•
If you want to remove a complete
directory, use the
–
r and
–
f option:
rm
–
rf
dir
Key features
The
rm
command
deletes
files.
rm
command
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Usage:
rm [OPTIONS] filename(s)
•
Options:
o
-
d
: Removes a directory; the directory must be empty:
rm
–
d dir
o
-
r
:
Allows
you to remove a non
-
empty directory:
rm
–
r dir
o
-
f
: Never prompt user (useful when deleting a directory with many files)
o
-
i
: Prompts the user for confirmation for
each
file
o
-
v
: Display the names of deleted files
•
If a file is write protected, a prompt will ask the user for confirmation.
•
Several files can be removed at once.
•
If you want to remove a complete directory, use the
–
r and
–
f option:
rm
–
rf
dir
•
You
can use a regular expression:
rm *.png
removes all files that end with .png.
20
An example
]$
mkdir
[OPTIONS] filename(s)
Usage
•
-
m<
mask
>
: Sets a permission to the
directory
•
-
p
:
Creates
a parent directory
Options
The
mkdir
command creates new
directories.
mkdir
command
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Usage:
mkdir
[OPTIONS] filename(s)
Options:
•
-
m<
mask
>
: Sets a permission to the directory
•
-
p
:
Creates
a parent directory
You can
create
several
directories
with
one command:
mkdir
dir1
dir2
dir3
.
mkdir
–
m 700
dir1
creates
the
dir1
directory
with
the
mask
700
for
permissions.
mkdir
–
p /home/user/dir1/dir2
: If
dir1
does
not
exist
, the
creation
will
fail
without
the
–
p
option.
21
An example
]$
mv [OPTIONS] destination
Usage
By default, the
mv
command overwrites existing
files that have the same name.
Note:
The
mv
command moves a file from one
directory to another.
The
mv
command renames a file if the
source and destination are the same
mv
command
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Usage:
mv [OPTIONS] source destination
Options:
•
-
i
: Prompts
before
overwritting
a file
•
-
f
:
Avoids
being
prompted
•
-
n
:
Does
not
overwrite
existing
files
•
-
v
:
Verbose
option,
prints
the
name
of files
that
are
moved
or
renamed
•
m
v file1 dir1
:
Moves file1 to dir1
•
m
v dir1 dir2
:
Moves dir1 to dir2
•
m
v file1 file2 dir1 dir2
:
Moves file1, file2, and dir1 to dir2; there can
only be one target directory here, dir2
•
m
v file1 dir1/file2
:
Moves file1 to dir1 and renames it file2
•
m
v file1 file2
:
Renames file1 as file2
You
can use a regular expression to move files of the same type:
m
v *.
png
dir1
moves all
files with extension .
png
into
dir1
.
22
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
The
rmdir
command deletes existing empty directories:
rmdir
<DirectoryName>
If a directory isn’t empty, use
rm
-
r<
DirectoryName
>
.
This command removes a directory and all of its contents.
rmdir
command
rmdir
is equivalent to
rm
–
d
.
23
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
•
Output of the
pwd
command: Absolute path to your current location in the file system
•
Essential for navigation: You must know where you are in the file system to move to
other
directories.
pwd
command
Use the
pwd
command to know where you are in the file directory structure.
24
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
In this demonstration, the instructor will show you how
to:
•
Create, move, copy, and delete files
•
Create and delete directories
Demonstration:
Managing files and
directories
Follow along as the instructor creates, moves, copies, and deletes files and creates
and deletes directories.
RSLX EN-US SG M02 WORKWITHFILESYSTEM
<> of 32+-<->Close
16
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
•
Displays the last 10 lines of a file by default
•
Use the
tail
command w
ith the
-
n
option to specify the number of
lines to display.
tail
command
Usage:
tail [OPTIONS] filename(s)
•
Options:
o
-
n <number>
: Last
n
lines to display
o
-
c <number>
: Last
c
bytes to display
o
-
f
: Monitor for file changes
The
tail
-
f
command is useful for log files that are regularly updated and where
the most recent entries are at the bottom of the file.
17
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
•
The
cp
command copies files and
directories.
•
By default, the
cp
command overwrites
existing files that have the same name.
Example:
cp
<
file
-
name
>
<
destination
>
•
For more options, refer to the next slide.
cp
command
Usage:
cp
folderA
/
srcfile
folderB
/
destfile
•
Copies the
srcfile
that
is located in folderA to folderB and names
it
destfile
cp
folderA/srcfile
folderB
/
•
Copies the srcfile that is located in folderA to
folderB
(and
both
files have
the same
name
)
cp folderA/srcfile folderB/
folderC
/
destfile
•
C
opies the srcfile that is located in folderA to folderB and to folderC with
the
name
destfile
18
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Option
Description
cp
-
a
Archive files
cp
-
f
Force copy by overwriting the destination file if needed
cp
-
i
Interactive
–
Ask before overwrite
cp
-
l
Link files instead of copy
cp
-
L
Follow symbolic links
cp
-
n
No file overwrite
cp
-
R
Recursive copy (including hidden files)
cp
-
u
Update
–
Copy when source is newer than destination
cp
-
v
Verbose
–
Print informative messages
cp
command: Additional options
This slide shows additional options for the cp command that you can use.
19
An example
]$
rm [OPTIONS] filename(s)
Usage
•
If a file
is
write
protected
, a prompt
will
ask
the user for confirmation.
•
Several
files
can
be
removed
at once.
•
If you want to remove a complete
directory, use the
–
r and
–
f option:
rm
–
rf
dir
Key features
The
rm
command
deletes
files.
rm
command
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Usage:
rm [OPTIONS] filename(s)
•
Options:
o
-
d
: Removes a directory; the directory must be empty:
rm
–
d dir
o
-
r
:
Allows
you to remove a non
-
empty directory:
rm
–
r dir
o
-
f
: Never prompt user (useful when deleting a directory with many files)
o
-
i
: Prompts the user for confirmation for
each
file
o
-
v
: Display the names of deleted files
•
If a file is write protected, a prompt will ask the user for confirmation.
•
Several files can be removed at once.
•
If you want to remove a complete directory, use the
–
r and
–
f option:
rm
–
rf
dir
•
You
can use a regular expression:
rm *.png
removes all files that end with .png.
20
An example
]$
mkdir
[OPTIONS] filename(s)
Usage
•
-
m<
mask
>
: Sets a permission to the
directory
•
-
p
:
Creates
a parent directory
Options
The
mkdir
command creates new
directories.
mkdir
command
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Usage:
mkdir
[OPTIONS] filename(s)
Options:
•
-
m<
mask
>
: Sets a permission to the directory
•
-
p
:
Creates
a parent directory
You can
create
several
directories
with
one command:
mkdir
dir1
dir2
dir3
.
mkdir
–
m 700
dir1
creates
the
dir1
directory
with
the
mask
700
for
permissions.
mkdir
–
p /home/user/dir1/dir2
: If
dir1
does
not
exist
, the
creation
will
fail
without
the
–
p
option.
21
An example
]$
mv [OPTIONS] destination
Usage
By default, the
mv
command overwrites existing
files that have the same name.
Note:
The
mv
command moves a file from one
directory to another.
The
mv
command renames a file if the
source and destination are the same
mv
command
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Usage:
mv [OPTIONS] source destination
Options:
•
-
i
: Prompts
before
overwritting
a file
•
-
f
:
Avoids
being
prompted
•
-
n
:
Does
not
overwrite
existing
files
•
-
v
:
Verbose
option,
prints
the
name
of files
that
are
moved
or
renamed
•
m
v file1 dir1
:
Moves file1 to dir1
•
m
v dir1 dir2
:
Moves dir1 to dir2
•
m
v file1 file2 dir1 dir2
:
Moves file1, file2, and dir1 to dir2; there can
only be one target directory here, dir2
•
m
v file1 dir1/file2
:
Moves file1 to dir1 and renames it file2
•
m
v file1 file2
:
Renames file1 as file2
You
can use a regular expression to move files of the same type:
m
v *.
png
dir1
moves all
files with extension .
png
into
dir1
.
22
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
The
rmdir
command deletes existing empty directories:
rmdir
<DirectoryName>
If a directory isn’t empty, use
rm
-
r<
DirectoryName
>
.
This command removes a directory and all of its contents.
rmdir
command
rmdir
is equivalent to
rm
–
d
.
23
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
•
Output of the
pwd
command: Absolute path to your current location in the file system
•
Essential for navigation: You must know where you are in the file system to move to
other
directories.
pwd
command
Use the
pwd
command to know where you are in the file directory structure.
24
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
In this demonstration, the instructor will show you how
to:
•
Create, move, copy, and delete files
•
Create and delete directories
Demonstration:
Managing files and
directories
Follow along as the instructor creates, moves, copies, and deletes files and creates
and deletes directories.
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Absolute versus relative paths
You must know the difference between absolute and relative paths.
RSLX EN-US SG M02 WORKWITHFILESYSTEM
<> of 32+-<->Close
17
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
•
The
cp
command copies files and
directories.
•
By default, the
cp
command overwrites
existing files that have the same name.
Example:
cp
<
file
-
name
>
<
destination
>
•
For more options, refer to the next slide.
cp
command
Usage:
cp
folderA
/
srcfile
folderB
/
destfile
•
Copies the
srcfile
that
is located in folderA to folderB and names
it
destfile
cp
folderA/srcfile
folderB
/
•
Copies the srcfile that is located in folderA to
folderB
(and
both
files have
the same
name
)
cp folderA/srcfile folderB/
folderC
/
destfile
•
C
opies the srcfile that is located in folderA to folderB and to folderC with
the
name
destfile
18
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Option
Description
cp
-
a
Archive files
cp
-
f
Force copy by overwriting the destination file if needed
cp
-
i
Interactive
–
Ask before overwrite
cp
-
l
Link files instead of copy
cp
-
L
Follow symbolic links
cp
-
n
No file overwrite
cp
-
R
Recursive copy (including hidden files)
cp
-
u
Update
–
Copy when source is newer than destination
cp
-
v
Verbose
–
Print informative messages
cp
command: Additional options
This slide shows additional options for the cp command that you can use.
19
An example
]$
rm [OPTIONS] filename(s)
Usage
•
If a file
is
write
protected
, a prompt
will
ask
the user for confirmation.
•
Several
files
can
be
removed
at once.
•
If you want to remove a complete
directory, use the
–
r and
–
f option:
rm
–
rf
dir
Key features
The
rm
command
deletes
files.
rm
command
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Usage:
rm [OPTIONS] filename(s)
•
Options:
o
-
d
: Removes a directory; the directory must be empty:
rm
–
d dir
o
-
r
:
Allows
you to remove a non
-
empty directory:
rm
–
r dir
o
-
f
: Never prompt user (useful when deleting a directory with many files)
o
-
i
: Prompts the user for confirmation for
each
file
o
-
v
: Display the names of deleted files
•
If a file is write protected, a prompt will ask the user for confirmation.
•
Several files can be removed at once.
•
If you want to remove a complete directory, use the
–
r and
–
f option:
rm
–
rf
dir
•
You
can use a regular expression:
rm *.png
removes all files that end with .png.
20
An example
]$
mkdir
[OPTIONS] filename(s)
Usage
•
-
m<
mask
>
: Sets a permission to the
directory
•
-
p
:
Creates
a parent directory
Options
The
mkdir
command creates new
directories.
mkdir
command
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Usage:
mkdir
[OPTIONS] filename(s)
Options:
•
-
m<
mask
>
: Sets a permission to the directory
•
-
p
:
Creates
a parent directory
You can
create
several
directories
with
one command:
mkdir
dir1
dir2
dir3
.
mkdir
–
m 700
dir1
creates
the
dir1
directory
with
the
mask
700
for
permissions.
mkdir
–
p /home/user/dir1/dir2
: If
dir1
does
not
exist
, the
creation
will
fail
without
the
–
p
option.
21
An example
]$
mv [OPTIONS] destination
Usage
By default, the
mv
command overwrites existing
files that have the same name.
Note:
The
mv
command moves a file from one
directory to another.
The
mv
command renames a file if the
source and destination are the same
mv
command
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Usage:
mv [OPTIONS] source destination
Options:
•
-
i
: Prompts
before
overwritting
a file
•
-
f
:
Avoids
being
prompted
•
-
n
:
Does
not
overwrite
existing
files
•
-
v
:
Verbose
option,
prints
the
name
of files
that
are
moved
or
renamed
•
m
v file1 dir1
:
Moves file1 to dir1
•
m
v dir1 dir2
:
Moves dir1 to dir2
•
m
v file1 file2 dir1 dir2
:
Moves file1, file2, and dir1 to dir2; there can
only be one target directory here, dir2
•
m
v file1 dir1/file2
:
Moves file1 to dir1 and renames it file2
•
m
v file1 file2
:
Renames file1 as file2
You
can use a regular expression to move files of the same type:
m
v *.
png
dir1
moves all
files with extension .
png
into
dir1
.
22
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
The
rmdir
command deletes existing empty directories:
rmdir
<DirectoryName>
If a directory isn’t empty, use
rm
-
r<
DirectoryName
>
.
This command removes a directory and all of its contents.
rmdir
command
rmdir
is equivalent to
rm
–
d
.
23
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
•
Output of the
pwd
command: Absolute path to your current location in the file system
•
Essential for navigation: You must know where you are in the file system to move to
other
directories.
pwd
command
Use the
pwd
command to know where you are in the file directory structure.
24
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
In this demonstration, the instructor will show you how
to:
•
Create, move, copy, and delete files
•
Create and delete directories
Demonstration:
Managing files and
directories
Follow along as the instructor creates, moves, copies, and deletes files and creates
and deletes directories.
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Absolute versus relative paths
You must know the difference between absolute and relative paths.
26
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
•
Paths define directories to be traversed to get to a particular resource.
•
In a graphical user interface (GUI), you navigate by opening directories.
•
In a command line interface (CLI), you also navigate through directories, but you specify
them by
name.
Paths
You must know how to navigate directories by both a GUI and a CLI.
RSLX EN-US SG M02 WORKWITHFILESYSTEM
<> of 32+-<->Close
18
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Option
Description
cp
-
a
Archive files
cp
-
f
Force copy by overwriting the destination file if needed
cp
-
i
Interactive
–
Ask before overwrite
cp
-
l
Link files instead of copy
cp
-
L
Follow symbolic links
cp
-
n
No file overwrite
cp
-
R
Recursive copy (including hidden files)
cp
-
u
Update
–
Copy when source is newer than destination
cp
-
v
Verbose
–
Print informative messages
cp
command: Additional options
This slide shows additional options for the cp command that you can use.
19
An example
]$
rm [OPTIONS] filename(s)
Usage
•
If a file
is
write
protected
, a prompt
will
ask
the user for confirmation.
•
Several
files
can
be
removed
at once.
•
If you want to remove a complete
directory, use the
–
r and
–
f option:
rm
–
rf
dir
Key features
The
rm
command
deletes
files.
rm
command
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Usage:
rm [OPTIONS] filename(s)
•
Options:
o
-
d
: Removes a directory; the directory must be empty:
rm
–
d dir
o
-
r
:
Allows
you to remove a non
-
empty directory:
rm
–
r dir
o
-
f
: Never prompt user (useful when deleting a directory with many files)
o
-
i
: Prompts the user for confirmation for
each
file
o
-
v
: Display the names of deleted files
•
If a file is write protected, a prompt will ask the user for confirmation.
•
Several files can be removed at once.
•
If you want to remove a complete directory, use the
–
r and
–
f option:
rm
–
rf
dir
•
You
can use a regular expression:
rm *.png
removes all files that end with .png.
20
An example
]$
mkdir
[OPTIONS] filename(s)
Usage
•
-
m<
mask
>
: Sets a permission to the
directory
•
-
p
:
Creates
a parent directory
Options
The
mkdir
command creates new
directories.
mkdir
command
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Usage:
mkdir
[OPTIONS] filename(s)
Options:
•
-
m<
mask
>
: Sets a permission to the directory
•
-
p
:
Creates
a parent directory
You can
create
several
directories
with
one command:
mkdir
dir1
dir2
dir3
.
mkdir
–
m 700
dir1
creates
the
dir1
directory
with
the
mask
700
for
permissions.
mkdir
–
p /home/user/dir1/dir2
: If
dir1
does
not
exist
, the
creation
will
fail
without
the
–
p
option.
21
An example
]$
mv [OPTIONS] destination
Usage
By default, the
mv
command overwrites existing
files that have the same name.
Note:
The
mv
command moves a file from one
directory to another.
The
mv
command renames a file if the
source and destination are the same
mv
command
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Usage:
mv [OPTIONS] source destination
Options:
•
-
i
: Prompts
before
overwritting
a file
•
-
f
:
Avoids
being
prompted
•
-
n
:
Does
not
overwrite
existing
files
•
-
v
:
Verbose
option,
prints
the
name
of files
that
are
moved
or
renamed
•
m
v file1 dir1
:
Moves file1 to dir1
•
m
v dir1 dir2
:
Moves dir1 to dir2
•
m
v file1 file2 dir1 dir2
:
Moves file1, file2, and dir1 to dir2; there can
only be one target directory here, dir2
•
m
v file1 dir1/file2
:
Moves file1 to dir1 and renames it file2
•
m
v file1 file2
:
Renames file1 as file2
You
can use a regular expression to move files of the same type:
m
v *.
png
dir1
moves all
files with extension .
png
into
dir1
.
22
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
The
rmdir
command deletes existing empty directories:
rmdir
<DirectoryName>
If a directory isn’t empty, use
rm
-
r<
DirectoryName
>
.
This command removes a directory and all of its contents.
rmdir
command
rmdir
is equivalent to
rm
–
d
.
23
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
•
Output of the
pwd
command: Absolute path to your current location in the file system
•
Essential for navigation: You must know where you are in the file system to move to
other
directories.
pwd
command
Use the
pwd
command to know where you are in the file directory structure.
24
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
In this demonstration, the instructor will show you how
to:
•
Create, move, copy, and delete files
•
Create and delete directories
Demonstration:
Managing files and
directories
Follow along as the instructor creates, moves, copies, and deletes files and creates
and deletes directories.
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Absolute versus relative paths
You must know the difference between absolute and relative paths.
26
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
•
Paths define directories to be traversed to get to a particular resource.
•
In a graphical user interface (GUI), you navigate by opening directories.
•
In a command line interface (CLI), you also navigate through directories, but you specify
them by
name.
Paths
You must know how to navigate directories by both a GUI and a CLI.
27
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
•
An absolute path is the complete path to the resource from the root of the file system:
–
The absolute path to access the
projects
directory from the root of the file system
–
Example:
/home/userA/Documents/projects
•
A relative path is the path to the resource from the current directory:
–
The relative path to access the
projects
directory from the
Documents
directory
–
Example:
Documents/projects
Types of paths
Suppose the command
pwd
tells you that you are in the
folder
/home/ec2
-
user
.
cd /home/userA/Documents/projects
will navigate to the
/home/userA/Documents/projects
folder.
cd Documents/projects
will navigate to the
/home/ec2
-
user/Documents/projects
folder
(currentfolder/Document/projects, where
current folder is /home/ec2
-
user).
RSLX EN-US SG M02 WORKWITHFILESYSTEM
<> of 32+-<->Close
19
An example
]$
rm [OPTIONS] filename(s)
Usage
•
If a file
is
write
protected
, a prompt
will
ask
the user for confirmation.
•
Several
files
can
be
removed
at once.
•
If you want to remove a complete
directory, use the
–
r and
–
f option:
rm
–
rf
dir
Key features
The
rm
command
deletes
files.
rm
command
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Usage:
rm [OPTIONS] filename(s)
•
Options:
o
-
d
: Removes a directory; the directory must be empty:
rm
–
d dir
o
-
r
:
Allows
you to remove a non
-
empty directory:
rm
–
r dir
o
-
f
: Never prompt user (useful when deleting a directory with many files)
o
-
i
: Prompts the user for confirmation for
each
file
o
-
v
: Display the names of deleted files
•
If a file is write protected, a prompt will ask the user for confirmation.
•
Several files can be removed at once.
•
If you want to remove a complete directory, use the
–
r and
–
f option:
rm
–
rf
dir
•
You
can use a regular expression:
rm *.png
removes all files that end with .png.
20
An example
]$
mkdir
[OPTIONS] filename(s)
Usage
•
-
m<
mask
>
: Sets a permission to the
directory
•
-
p
:
Creates
a parent directory
Options
The
mkdir
command creates new
directories.
mkdir
command
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Usage:
mkdir
[OPTIONS] filename(s)
Options:
•
-
m<
mask
>
: Sets a permission to the directory
•
-
p
:
Creates
a parent directory
You can
create
several
directories
with
one command:
mkdir
dir1
dir2
dir3
.
mkdir
–
m 700
dir1
creates
the
dir1
directory
with
the
mask
700
for
permissions.
mkdir
–
p /home/user/dir1/dir2
: If
dir1
does
not
exist
, the
creation
will
fail
without
the
–
p
option.
21
An example
]$
mv [OPTIONS] destination
Usage
By default, the
mv
command overwrites existing
files that have the same name.
Note:
The
mv
command moves a file from one
directory to another.
The
mv
command renames a file if the
source and destination are the same
mv
command
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Usage:
mv [OPTIONS] source destination
Options:
•
-
i
: Prompts
before
overwritting
a file
•
-
f
:
Avoids
being
prompted
•
-
n
:
Does
not
overwrite
existing
files
•
-
v
:
Verbose
option,
prints
the
name
of files
that
are
moved
or
renamed
•
m
v file1 dir1
:
Moves file1 to dir1
•
m
v dir1 dir2
:
Moves dir1 to dir2
•
m
v file1 file2 dir1 dir2
:
Moves file1, file2, and dir1 to dir2; there can
only be one target directory here, dir2
•
m
v file1 dir1/file2
:
Moves file1 to dir1 and renames it file2
•
m
v file1 file2
:
Renames file1 as file2
You
can use a regular expression to move files of the same type:
m
v *.
png
dir1
moves all
files with extension .
png
into
dir1
.
22
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
The
rmdir
command deletes existing empty directories:
rmdir
<DirectoryName>
If a directory isn’t empty, use
rm
-
r<
DirectoryName
>
.
This command removes a directory and all of its contents.
rmdir
command
rmdir
is equivalent to
rm
–
d
.
23
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
•
Output of the
pwd
command: Absolute path to your current location in the file system
•
Essential for navigation: You must know where you are in the file system to move to
other
directories.
pwd
command
Use the
pwd
command to know where you are in the file directory structure.
24
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
In this demonstration, the instructor will show you how
to:
•
Create, move, copy, and delete files
•
Create and delete directories
Demonstration:
Managing files and
directories
Follow along as the instructor creates, moves, copies, and deletes files and creates
and deletes directories.
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Absolute versus relative paths
You must know the difference between absolute and relative paths.
26
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
•
Paths define directories to be traversed to get to a particular resource.
•
In a graphical user interface (GUI), you navigate by opening directories.
•
In a command line interface (CLI), you also navigate through directories, but you specify
them by
name.
Paths
You must know how to navigate directories by both a GUI and a CLI.
27
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
•
An absolute path is the complete path to the resource from the root of the file system:
–
The absolute path to access the
projects
directory from the root of the file system
–
Example:
/home/userA/Documents/projects
•
A relative path is the path to the resource from the current directory:
–
The relative path to access the
projects
directory from the
Documents
directory
–
Example:
Documents/projects
Types of paths
Suppose the command
pwd
tells you that you are in the
folder
/home/ec2
-
user
.
cd /home/userA/Documents/projects
will navigate to the
/home/userA/Documents/projects
folder.
cd Documents/projects
will navigate to the
/home/ec2
-
user/Documents/projects
folder
(currentfolder/Document/projects, where
current folder is /home/ec2
-
user).
28
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
The change directory or
cd
command is used to move from one directory
to another.
•
Using the
cd
command with the absolute path:
•
Using the
cd
command with the relative path:
cd
command
Tip: Use
../
to go up a single directory at a time.
For example,
if
you
are in the /home/
userA
folder,
cd ../
will
navigate to /home.
RSLX EN-US SG M02 WORKWITHFILESYSTEM
<> of 32+-<->Close
20
An example
]$
mkdir
[OPTIONS] filename(s)
Usage
•
-
m<
mask
>
: Sets a permission to the
directory
•
-
p
:
Creates
a parent directory
Options
The
mkdir
command creates new
directories.
mkdir
command
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Usage:
mkdir
[OPTIONS] filename(s)
Options:
•
-
m<
mask
>
: Sets a permission to the directory
•
-
p
:
Creates
a parent directory
You can
create
several
directories
with
one command:
mkdir
dir1
dir2
dir3
.
mkdir
–
m 700
dir1
creates
the
dir1
directory
with
the
mask
700
for
permissions.
mkdir
–
p /home/user/dir1/dir2
: If
dir1
does
not
exist
, the
creation
will
fail
without
the
–
p
option.
21
An example
]$
mv [OPTIONS] destination
Usage
By default, the
mv
command overwrites existing
files that have the same name.
Note:
The
mv
command moves a file from one
directory to another.
The
mv
command renames a file if the
source and destination are the same
mv
command
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Usage:
mv [OPTIONS] source destination
Options:
•
-
i
: Prompts
before
overwritting
a file
•
-
f
:
Avoids
being
prompted
•
-
n
:
Does
not
overwrite
existing
files
•
-
v
:
Verbose
option,
prints
the
name
of files
that
are
moved
or
renamed
•
m
v file1 dir1
:
Moves file1 to dir1
•
m
v dir1 dir2
:
Moves dir1 to dir2
•
m
v file1 file2 dir1 dir2
:
Moves file1, file2, and dir1 to dir2; there can
only be one target directory here, dir2
•
m
v file1 dir1/file2
:
Moves file1 to dir1 and renames it file2
•
m
v file1 file2
:
Renames file1 as file2
You
can use a regular expression to move files of the same type:
m
v *.
png
dir1
moves all
files with extension .
png
into
dir1
.
22
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
The
rmdir
command deletes existing empty directories:
rmdir
<DirectoryName>
If a directory isn’t empty, use
rm
-
r<
DirectoryName
>
.
This command removes a directory and all of its contents.
rmdir
command
rmdir
is equivalent to
rm
–
d
.
23
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
•
Output of the
pwd
command: Absolute path to your current location in the file system
•
Essential for navigation: You must know where you are in the file system to move to
other
directories.
pwd
command
Use the
pwd
command to know where you are in the file directory structure.
24
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
In this demonstration, the instructor will show you how
to:
•
Create, move, copy, and delete files
•
Create and delete directories
Demonstration:
Managing files and
directories
Follow along as the instructor creates, moves, copies, and deletes files and creates
and deletes directories.
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Absolute versus relative paths
You must know the difference between absolute and relative paths.
26
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
•
Paths define directories to be traversed to get to a particular resource.
•
In a graphical user interface (GUI), you navigate by opening directories.
•
In a command line interface (CLI), you also navigate through directories, but you specify
them by
name.
Paths
You must know how to navigate directories by both a GUI and a CLI.
27
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
•
An absolute path is the complete path to the resource from the root of the file system:
–
The absolute path to access the
projects
directory from the root of the file system
–
Example:
/home/userA/Documents/projects
•
A relative path is the path to the resource from the current directory:
–
The relative path to access the
projects
directory from the
Documents
directory
–
Example:
Documents/projects
Types of paths
Suppose the command
pwd
tells you that you are in the
folder
/home/ec2
-
user
.
cd /home/userA/Documents/projects
will navigate to the
/home/userA/Documents/projects
folder.
cd Documents/projects
will navigate to the
/home/ec2
-
user/Documents/projects
folder
(currentfolder/Document/projects, where
current folder is /home/ec2
-
user).
28
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
The change directory or
cd
command is used to move from one directory
to another.
•
Using the
cd
command with the absolute path:
•
Using the
cd
command with the relative path:
cd
command
Tip: Use
../
to go up a single directory at a time.
For example,
if
you
are in the /home/
userA
folder,
cd ../
will
navigate to /home.
29
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
In this demonstration, the instructor will show you the
difference between absolute and relative paths.
Demonstration:
Absolute and relative
paths
Follow along as the instructor demonstrates the difference between absolute and
relative paths.
RSLX EN-US SG M02 WORKWITHFILESYSTEM
<> of 32+-<->Close
21
An example
]$
mv [OPTIONS] destination
Usage
By default, the
mv
command overwrites existing
files that have the same name.
Note:
The
mv
command moves a file from one
directory to another.
The
mv
command renames a file if the
source and destination are the same
mv
command
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Usage:
mv [OPTIONS] source destination
Options:
•
-
i
: Prompts
before
overwritting
a file
•
-
f
:
Avoids
being
prompted
•
-
n
:
Does
not
overwrite
existing
files
•
-
v
:
Verbose
option,
prints
the
name
of files
that
are
moved
or
renamed
•
m
v file1 dir1
:
Moves file1 to dir1
•
m
v dir1 dir2
:
Moves dir1 to dir2
•
m
v file1 file2 dir1 dir2
:
Moves file1, file2, and dir1 to dir2; there can
only be one target directory here, dir2
•
m
v file1 dir1/file2
:
Moves file1 to dir1 and renames it file2
•
m
v file1 file2
:
Renames file1 as file2
You
can use a regular expression to move files of the same type:
m
v *.
png
dir1
moves all
files with extension .
png
into
dir1
.
22
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
The
rmdir
command deletes existing empty directories:
rmdir
<DirectoryName>
If a directory isn’t empty, use
rm
-
r<
DirectoryName
>
.
This command removes a directory and all of its contents.
rmdir
command
rmdir
is equivalent to
rm
–
d
.
23
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
•
Output of the
pwd
command: Absolute path to your current location in the file system
•
Essential for navigation: You must know where you are in the file system to move to
other
directories.
pwd
command
Use the
pwd
command to know where you are in the file directory structure.
24
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
In this demonstration, the instructor will show you how
to:
•
Create, move, copy, and delete files
•
Create and delete directories
Demonstration:
Managing files and
directories
Follow along as the instructor creates, moves, copies, and deletes files and creates
and deletes directories.
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Absolute versus relative paths
You must know the difference between absolute and relative paths.
26
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
•
Paths define directories to be traversed to get to a particular resource.
•
In a graphical user interface (GUI), you navigate by opening directories.
•
In a command line interface (CLI), you also navigate through directories, but you specify
them by
name.
Paths
You must know how to navigate directories by both a GUI and a CLI.
27
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
•
An absolute path is the complete path to the resource from the root of the file system:
–
The absolute path to access the
projects
directory from the root of the file system
–
Example:
/home/userA/Documents/projects
•
A relative path is the path to the resource from the current directory:
–
The relative path to access the
projects
directory from the
Documents
directory
–
Example:
Documents/projects
Types of paths
Suppose the command
pwd
tells you that you are in the
folder
/home/ec2
-
user
.
cd /home/userA/Documents/projects
will navigate to the
/home/userA/Documents/projects
folder.
cd Documents/projects
will navigate to the
/home/ec2
-
user/Documents/projects
folder
(currentfolder/Document/projects, where
current folder is /home/ec2
-
user).
28
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
The change directory or
cd
command is used to move from one directory
to another.
•
Using the
cd
command with the absolute path:
•
Using the
cd
command with the relative path:
cd
command
Tip: Use
../
to go up a single directory at a time.
For example,
if
you
are in the /home/
userA
folder,
cd ../
will
navigate to /home.
29
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
In this demonstration, the instructor will show you the
difference between absolute and relative paths.
Demonstration:
Absolute and relative
paths
Follow along as the instructor demonstrates the difference between absolute and
relative paths.
30
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
What is the difference between an absolute path and a relative path?
When would you use the
less
command instead of the
more
command? Why?
Checkpoint questions
Answers:
1.
The absolute path shows the entire folder structure to the resource that is being
used. The absolute path to
my_file.txt
in the
Documents
directory
would be something like
/Users/user_name/Documents/LabWork/my_file.txt
.
The relative path shows only from the current directory to the file that is being
used. From the previous example, within the
user_name
directory, the
relative path to the file is
/Documents/LabWork/my_file.txt
.
2.
You use
the
less
command if you want to scroll backward
through a file. With
the
more
command,
you can only scroll forward through a file.
RSLX EN-US SG M02 WORKWITHFILESYSTEM
<> of 32+-<->Close
22
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
The
rmdir
command deletes existing empty directories:
rmdir
<DirectoryName>
If a directory isn’t empty, use
rm
-
r<
DirectoryName
>
.
This command removes a directory and all of its contents.
rmdir
command
rmdir
is equivalent to
rm
–
d
.
23
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
•
Output of the
pwd
command: Absolute path to your current location in the file system
•
Essential for navigation: You must know where you are in the file system to move to
other
directories.
pwd
command
Use the
pwd
command to know where you are in the file directory structure.
24
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
In this demonstration, the instructor will show you how
to:
•
Create, move, copy, and delete files
•
Create and delete directories
Demonstration:
Managing files and
directories
Follow along as the instructor creates, moves, copies, and deletes files and creates
and deletes directories.
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Absolute versus relative paths
You must know the difference between absolute and relative paths.
26
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
•
Paths define directories to be traversed to get to a particular resource.
•
In a graphical user interface (GUI), you navigate by opening directories.
•
In a command line interface (CLI), you also navigate through directories, but you specify
them by
name.
Paths
You must know how to navigate directories by both a GUI and a CLI.
27
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
•
An absolute path is the complete path to the resource from the root of the file system:
–
The absolute path to access the
projects
directory from the root of the file system
–
Example:
/home/userA/Documents/projects
•
A relative path is the path to the resource from the current directory:
–
The relative path to access the
projects
directory from the
Documents
directory
–
Example:
Documents/projects
Types of paths
Suppose the command
pwd
tells you that you are in the
folder
/home/ec2
-
user
.
cd /home/userA/Documents/projects
will navigate to the
/home/userA/Documents/projects
folder.
cd Documents/projects
will navigate to the
/home/ec2
-
user/Documents/projects
folder
(currentfolder/Document/projects, where
current folder is /home/ec2
-
user).
28
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
The change directory or
cd
command is used to move from one directory
to another.
•
Using the
cd
command with the absolute path:
•
Using the
cd
command with the relative path:
cd
command
Tip: Use
../
to go up a single directory at a time.
For example,
if
you
are in the /home/
userA
folder,
cd ../
will
navigate to /home.
29
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
In this demonstration, the instructor will show you the
difference between absolute and relative paths.
Demonstration:
Absolute and relative
paths
Follow along as the instructor demonstrates the difference between absolute and
relative paths.
30
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
What is the difference between an absolute path and a relative path?
When would you use the
less
command instead of the
more
command? Why?
Checkpoint questions
Answers:
1.
The absolute path shows the entire folder structure to the resource that is being
used. The absolute path to
my_file.txt
in the
Documents
directory
would be something like
/Users/user_name/Documents/LabWork/my_file.txt
.
The relative path shows only from the current directory to the file that is being
used. From the previous example, within the
user_name
directory, the
relative path to the file is
/Documents/LabWork/my_file.txt
.
2.
You use
the
less
command if you want to scroll backward
through a file. With
the
more
command,
you can only scroll forward through a file.
31
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
•
Everything in Linux is a file.
•
The Linux file system:
–
Is case sensitive
–
Has the key
-
like directories:
o
/
o
/home
o
/mnt
•
Linux contains many commands to help work with files.
Some are:
–
ls
–
Lists the contents of a directory
–
cat
–
Shows the contents of a file
–
cp
–
Copies a file
–
rm
–
Removes a file
–
mkdir
–
Creates a directory
•
Linux has both absolute and relative directory paths.
Key takeaways
Some key
takeaways from this lesson include the following:
•
Everything in Linux is a file.
•
The Linux file system is case sensitive and has key
-
like directories.
•
Linux contains many commands to help work with files.
•
Linux has both absolute and relative directory paths.
RSLX EN-US SG M02 WORKWITHFILESYSTEM
<> of 32+-<->Close
23
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
•
Output of the
pwd
command: Absolute path to your current location in the file system
•
Essential for navigation: You must know where you are in the file system to move to
other
directories.
pwd
command
Use the
pwd
command to know where you are in the file directory structure.
24
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
In this demonstration, the instructor will show you how
to:
•
Create, move, copy, and delete files
•
Create and delete directories
Demonstration:
Managing files and
directories
Follow along as the instructor creates, moves, copies, and deletes files and creates
and deletes directories.
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Absolute versus relative paths
You must know the difference between absolute and relative paths.
26
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
•
Paths define directories to be traversed to get to a particular resource.
•
In a graphical user interface (GUI), you navigate by opening directories.
•
In a command line interface (CLI), you also navigate through directories, but you specify
them by
name.
Paths
You must know how to navigate directories by both a GUI and a CLI.
27
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
•
An absolute path is the complete path to the resource from the root of the file system:
–
The absolute path to access the
projects
directory from the root of the file system
–
Example:
/home/userA/Documents/projects
•
A relative path is the path to the resource from the current directory:
–
The relative path to access the
projects
directory from the
Documents
directory
–
Example:
Documents/projects
Types of paths
Suppose the command
pwd
tells you that you are in the
folder
/home/ec2
-
user
.
cd /home/userA/Documents/projects
will navigate to the
/home/userA/Documents/projects
folder.
cd Documents/projects
will navigate to the
/home/ec2
-
user/Documents/projects
folder
(currentfolder/Document/projects, where
current folder is /home/ec2
-
user).
28
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
The change directory or
cd
command is used to move from one directory
to another.
•
Using the
cd
command with the absolute path:
•
Using the
cd
command with the relative path:
cd
command
Tip: Use
../
to go up a single directory at a time.
For example,
if
you
are in the /home/
userA
folder,
cd ../
will
navigate to /home.
29
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
In this demonstration, the instructor will show you the
difference between absolute and relative paths.
Demonstration:
Absolute and relative
paths
Follow along as the instructor demonstrates the difference between absolute and
relative paths.
30
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
What is the difference between an absolute path and a relative path?
When would you use the
less
command instead of the
more
command? Why?
Checkpoint questions
Answers:
1.
The absolute path shows the entire folder structure to the resource that is being
used. The absolute path to
my_file.txt
in the
Documents
directory
would be something like
/Users/user_name/Documents/LabWork/my_file.txt
.
The relative path shows only from the current directory to the file that is being
used. From the previous example, within the
user_name
directory, the
relative path to the file is
/Documents/LabWork/my_file.txt
.
2.
You use
the
less
command if you want to scroll backward
through a file. With
the
more
command,
you can only scroll forward through a file.
31
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
•
Everything in Linux is a file.
•
The Linux file system:
–
Is case sensitive
–
Has the key
-
like directories:
o
/
o
/home
o
/mnt
•
Linux contains many commands to help work with files.
Some are:
–
ls
–
Lists the contents of a directory
–
cat
–
Shows the contents of a file
–
cp
–
Copies a file
–
rm
–
Removes a file
–
mkdir
–
Creates a directory
•
Linux has both absolute and relative directory paths.
Key takeaways
Some key
takeaways from this lesson include the following:
•
Everything in Linux is a file.
•
The Linux file system is case sensitive and has key
-
like directories.
•
Linux contains many commands to help work with files.
•
Linux has both absolute and relative directory paths.
©
2021
Amazon
Web
Services,
Inc
.
or
its
affiliates
.
All
rights
reserved
.
This
work
may
not
be
reproduced
or
redistributed,
in
whole
or
in
part,
without
prior
written
permission
from
Amazon
Web
Services,
Inc
.
Commercial
copying,
lending,
or
selling
is
prohibited
.
Corrections,
feedback,
or
other
questions?
Contact
us
at
https
:
//support
.
aws
.
amazon
.
com/#/contacts/aws
-
training
.
All
trademarks
are
the
property
of
their
owners
.
Thank you
Thank you.
RSLX EN-US SG M02 WORKWITHFILESYSTEM
<> of 32+-<->Close
23
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
•
Output of the
pwd
command: Absolute path to your current location in the file system
•
Essential for navigation: You must know where you are in the file system to move to
other
directories.
pwd
command
Use the
pwd
command to know where you are in the file directory structure.
24
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
In this demonstration, the instructor will show you how
to:
•
Create, move, copy, and delete files
•
Create and delete directories
Demonstration:
Managing files and
directories
Follow along as the instructor creates, moves, copies, and deletes files and creates
and deletes directories.
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Absolute versus relative paths
You must know the difference between absolute and relative paths.
26
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
•
Paths define directories to be traversed to get to a particular resource.
•
In a graphical user interface (GUI), you navigate by opening directories.
•
In a command line interface (CLI), you also navigate through directories, but you specify
them by
name.
Paths
You must know how to navigate directories by both a GUI and a CLI.
27
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
•
An absolute path is the complete path to the resource from the root of the file system:
–
The absolute path to access the
projects
directory from the root of the file system
–
Example:
/home/userA/Documents/projects
•
A relative path is the path to the resource from the current directory:
–
The relative path to access the
projects
directory from the
Documents
directory
–
Example:
Documents/projects
Types of paths
Suppose the command
pwd
tells you that you are in the
folder
/home/ec2
-
user
.
cd /home/userA/Documents/projects
will navigate to the
/home/userA/Documents/projects
folder.
cd Documents/projects
will navigate to the
/home/ec2
-
user/Documents/projects
folder
(currentfolder/Document/projects, where
current folder is /home/ec2
-
user).
28
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
The change directory or
cd
command is used to move from one directory
to another.
•
Using the
cd
command with the absolute path:
•
Using the
cd
command with the relative path:
cd
command
Tip: Use
../
to go up a single directory at a time.
For example,
if
you
are in the /home/
userA
folder,
cd ../
will
navigate to /home.
29
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
In this demonstration, the instructor will show you the
difference between absolute and relative paths.
Demonstration:
Absolute and relative
paths
Follow along as the instructor demonstrates the difference between absolute and
relative paths.
30
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
What is the difference between an absolute path and a relative path?
When would you use the
less
command instead of the
more
command? Why?
Checkpoint questions
Answers:
1.
The absolute path shows the entire folder structure to the resource that is being
used. The absolute path to
my_file.txt
in the
Documents
directory
would be something like
/Users/user_name/Documents/LabWork/my_file.txt
.
The relative path shows only from the current directory to the file that is being
used. From the previous example, within the
user_name
directory, the
relative path to the file is
/Documents/LabWork/my_file.txt
.
2.
You use
the
less
command if you want to scroll backward
through a file. With
the
more
command,
you can only scroll forward through a file.
31
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
•
Everything in Linux is a file.
•
The Linux file system:
–
Is case sensitive
–
Has the key
-
like directories:
o
/
o
/home
o
/mnt
•
Linux contains many commands to help work with files.
Some are:
–
ls
–
Lists the contents of a directory
–
cat
–
Shows the contents of a file
–
cp
–
Copies a file
–
rm
–
Removes a file
–
mkdir
–
Creates a directory
•
Linux has both absolute and relative directory paths.
Key takeaways
Some key
takeaways from this lesson include the following:
•
Everything in Linux is a file.
•
The Linux file system is case sensitive and has key
-
like directories.
•
Linux contains many commands to help work with files.
•
Linux has both absolute and relative directory paths.
©
2021
Amazon
Web
Services,
Inc
.
or
its
affiliates
.
All
rights
reserved
.
This
work
may
not
be
reproduced
or
redistributed,
in
whole
or
in
part,
without
prior
written
permission
from
Amazon
Web
Services,
Inc
.
Commercial
copying,
lending,
or
selling
is
prohibited
.
Corrections,
feedback,
or
other
questions?
Contact
us
at
https
:
//support
.
aws
.
amazon
.
com/#/contacts/aws
-
training
.
All
trademarks
are
the
property
of
their
owners
.
Submit
Details
AWS
Start Lab
End Lab
--:--
Grades
AR-SA
DE-DE EN-US
ES-ES ES-LA
FR-FR ID-ID
IT-IT KO-KR
PL-PL PT-BR
TH-TH UK-UA
VI-VN ZH-TW
Managing Processes
Note
All labs rely on previous courseware and lab information.
Duration
This lab will require approximately 45 minutes to complete.
Objectives
In this lab, you will:
Create a new log file for process listings
Use the top command
Establish a repetitive task that runs your previous auditing commands once a day
AWS service restrictions
In this lab environment, access to AWS services and service actions might be restricted
to the ones that are needed to complete the lab instructions. You might encounter errors
if you attempt to access other services or perform actions beyond the ones that are
described in this lab.
Accessing the AWS Management Console
1. At the top of these instructions, choose Start Lab to launch your lab. A Start Lab
panel opens, and it displays the lab status.
Tip: If you need more time to complete the lab, choose the Start Lab button again to
restart the timer for the environment.
2. Wait until you see the message Lab status: ready, then close the Start Lab panel
by choosing the X.
3. At the top of these instructions, choose AWS. This opens the AWS Management
Console in a new browser tab. The system will automatically log you in.
Tip: If a new browser tab does not open, a banner or icon is usually at the top of your
browser with a message that your browser is preventing the site from opening pop-up
windows. Choose the banner or icon and then choose Allow pop ups.
4. Arrange the AWS Management Console tab so that it displays along side these
instructions. Ideally, you will be able to see both browser tabs at the same time
so that you can follow the lab steps more easily.
Task 1: Use SSH to connect to an Amazon Linux EC2 instance
In this task, you will connect to a Amazon Linux EC2 instance. You will use an SSH
utility to perform all of these operations. The following instructions vary slightly
depending on whether you are using Windows or Mac/Linux.
Windows Users: Using SSH to Connect
These instructions are specifically for Windows users. If you are using macOS or Linux,
skip to the next section.
5. Select the Details drop-down menu above these instructions you are currently
reading, and then select Show. A Credentials window will be presented.
6. Select the Download PPK button and save the labsuser.ppk file. Typically your
browser will save it to the Downloads directory.
7. Make a note of the PublicIP address.
8. Then exit the Details panel by selecting the X.
9. Download PuTTY to SSH into the Amazon EC2 instance. If you do not have
PuTTY installed on your computer, download it here.
10. Open putty.exe
11. Configure your PuTTY session by following the directions in the following link:
Connect to your Linux instance using PuTTY
12. Windows Users: Select here to skip ahead to the next task.
macOS and Linux Users
These instructions are specifically for Mac/Linux users. If you are a Windows user, skip
ahead to the next task.
13. Select the Details drop-down menu above these instructions you are currently
reading, and then select Show. A Credentials window will be presented.
14. Select the Download PEM button and save the labsuser.pem file.
15. Make a note of the PublicIP address.
16. Then exit the Details panel by selecting the X.
17. Open a terminal window, and change directory cd to the directory where the
labsuser.pem file was downloaded. For example, if the labuser.pem file was
saved to your Downloads directory, run this command:
cd ~/Downloads
18. Change the permissions on the key to be read-only, by running this command:
chmod 400 labsuser.pem
19. Run the below command (replace <public-ip> with the PublicIP address you
copied earlier). Alternatively, return to the EC2 Console and select Instances.
Check the box next to the instance you want to connect to and in the Description
tab copy the IPv4 Public IP value.:
ssh -i labsuser.pem ec2-user@<public-ip>
20. Type yes when prompted to allow the first connection to this remote SSH server.
Because you are using a key pair for authentication, you will not be prompted for
a password.
Task 2: Exercise - Create List of Processes
In this exercise, you will create a log file from the ps command. This log file should be
added to the SharedFolders section:
Create a log file named processes.csv from ps -aux and omit any processes that
contain root user or contain "["or"]" in the COMMAND section.
Note: There is a space following the command followed by a period to represent the
current location.
21. To validate that you are in the /home/ec2-user/companyA folder, enter pwd and
press Enter.
If you are not in this folder, enter cd companyA and press Enter.
22. View all processes running on the machine and filter out the word root by typing
sudo ps -aux | grep -v root | sudo tee SharedFolders/processes.csv and pressing
ENTER.
23. Validate your work by typing cat SharedFolders/processes.csv and pressing
ENTER.
Figure: The command sudo ps -aux | grep -v root | sudo tee
SharedFolders/processes.csv shows all the current proccesses running on your
machine. This is also validated by using the command cat
SharedFolders/processes.csv.
Task 3: Exercise - List the processes using the top command
In this exercise, you will use the top command:
Run the top command to display processes and threads that are active in the
system.
Observe the outputs of the top command.
24. In the main terminal run the command top and press ENTER:
top
The top command is used to display the system performance and lists the processes
and threads active in the system. The output of the top command should look similar to
the picture below:
Figure: The output of the top command gives the system performance and gives you
the following information: Total number of tasks, how many are running, how many are
sleeping, how many are stopped, zombie state. It gives the percentage of CPU used,
the KiB memory used, and KiB swap.
25. While observing the output of top, the second line below the command top, we
can see the Tasks (outlined in red). Tasks in top either have a running, sleep,
stopped or zombie state. How many running tasks do you see?
Figure: The outline in red is the Tasks output from the top command. The command
prompt shows 93 total tasks, 1 running, 48 sleeping, 0 stopped, and 0 zombie tasks.
26. To quit top, hit q and press ENTER.
27. You can also run top with the following options to find the usage and version
information:
top -hv
Task 4: Exercise - Create a Cron Job
In this exercise, you will create a cron job that will create an audit file with ##### to
cover all csv files:
Note: You may have to use sudo to complete this exercise if you are not root.
Remember that cron is a command that runs a task on a regular basis at a specified
time. This command maintains the list of tasks to run in a crontab file, which you create
in this task. You create a job that creates the audit file with ##### in order to cover
all .csv files. When you enter the crontab -e command, you are taken to an editor
where you then enter a list of steps of what the cron daemon will run. The crontab file
includes six fields: minutes, hour, day of month (DOM), month (MON), day of Week
(DOW), and command (CMD). These fields can also be denoted with asterisks. Once
this command runs, you can verify your work.
28. To validate that you are in the /home/ec2-user/companyA folder, enter pwd and
press Enter.
29. To create a cron job that creates the audit file with ##### to cover all .csv files,
enter sudo crontab -e and press Enter to enter the default text editor.
30. Press i to enter insert mode, and press Enter.
31. For the first line, enter SHELL=/bin/bash and press the Space bar.
32. For the second line, enter PATH=/usr/bin:/bin:/usr/local/bin and press Enter.
33. For the third line, enter MAILTO=root and press Enter.
34. For the last line, enter 0 * * * * ls -la $(find .) | sed -e 's/..csv/#####.csv/g' >
/home/ec2-user/companyA/SharedFolders/filteredAudit.csv
Your terminal should look like the following image:

*Figure: In the terminal, it shows how the cron job with the SHELL, PATH, MAILTO, and
a script that was referenced earlier in the lab.*
35. To save and close the file, press ESC. Then enter :wq and press Enter.
36. To validate your work, enter sudo crontab -l and press Enter. Inspect the crontab
file to ensure that it matches the text exactly, as the following output shows:

*Figure: A validated cron job is shown by entering the command sudo crontab -l. The
output of the command will be from the file that was entered from earlier in the lab.*
Lab Complete
Congratulations! You have completed the lab.
37. Select End Lab at the top of this page and then select Yes to confirm that you
want to end the lab. A panel will appear, indicating that "DELETE has been
initiated... You may close this message box now."
38. Select the X in the top right corner to close the panel.
About the AWS component:
Amazon EC2 provides a wide selection of instance types optimized to fit different use
cases. Instance types comprise varying combinations of CPU, memory, storage, and
networking capacity and give you the flexibility to choose the appropriate mix of
resources for your applications. Each instance type includes one or more instance
sizes, allowing you to scale your resources to the requirements of your target workload.
You will use a t3.micro instance which should be selected by default. This instance type
has 1 virtual CPU and 1 GiB of memory.
Additional Resources
Amazon EC2 Instance Types Amazon Machine Images (AMI) Status Checks for Your
Instances Amazon EC2 Service Limits Terminate Your Instance
For more information about AWS Training and Certification, see
https://aws.amazon.com/training/.
Your feedback is welcome and appreciated. If you would like to share any suggestions
or corrections, please provide the details in our AWS Training and Certification Contact
Form.
© 2022 Amazon Web Services, Inc. and its affiliates. All rights reserved. This work may
not be reproduced or redistributed, in whole or in part, without prior written permission
from Amazon Web Services, Inc. Commercial copying, lending, or selling is prohibited.
Managing Services - Monitoring
Note
All labs rely on previous courseware and lab information.
Objectives
In this lab, you will:
Check the status of the service httpd to ensure that it is running, and that you
can make an http connection to the local host IP address
You will also learn how to monitor your Amazon Linux 2 EC2 instance
o Using the Linux top command
o Using AWS CloudWatch
Duration
30 minutes
AWS service restrictions
In this lab environment, access to AWS services and service actions might be restricted
to the ones that are needed to complete the lab instructions. You might encounter errors
if you attempt to access other services or perform actions beyond the ones that are
described in this lab.
Accessing the AWS Management Console
1. At the top of these instructions, choose Start Lab to launch your lab. A Start Lab
panel opens, and it displays the lab status.
Tip: If you need more time to complete the lab, choose the Start Lab button again to
restart the timer for the environment.
2. Wait until you see the message Lab status: ready, then close the Start Lab panel
by choosing the X.
3. At the top of these instructions, choose AWS. This opens the AWS Management
Console in a new browser tab. The system will automatically log you in.
Tip: If a new browser tab does not open, a banner or icon is usually at the top of your
browser with a message that your browser is preventing the site from opening pop-up
windows. Choose the banner or icon and then choose Allow pop ups.
4. Arrange the AWS Management Console tab so that it displays along side these
instructions. Ideally, you will be able to see both browser tabs at the same time
so that you can follow the lab steps more easily.
Task 1: Use SSH to connect to an Amazon Linux EC2 instance
In this task, you will connect to a Amazon Linux EC2 instance. You will use an SSH
utility to perform all of these operations. The following instructions vary slightly
depending on whether you are using Windows or Mac/Linux.
Windows Users: Using SSH to Connect
These instructions are specifically for Windows users. If you are using macOS or Linux,
skip to the next section.
5. Select the Details drop-down menu above these instructions you are currently
reading, and then select Show. A Credentials window will be presented.
6. Select the Download PPK button and save the labsuser.ppk file. Typically your
browser will save it to the Downloads directory.
7. Make a note of the PublicIP address.
8. Then exit the Details panel by selecting the X.
9. Download PuTTY to SSH into the Amazon EC2 instance. If you do not have
PuTTY installed on your computer, download it here.
10. Open putty.exe
11. Configure your PuTTY session by following the directions in the following link:
Connect to your Linux instance using PuTTY
12. Windows Users: Select here to skip ahead to the next task.
macOS and Linux Users
These instructions are specifically for Mac/Linux users. If you are a Windows user, skip
ahead to the next task.
13. Select the Details drop-down menu above these instructions you are currently
reading, and then select Show. A Credentials window will be presented.
14. Select the Download PEM button and save the labsuser.pem file.
15. Make a note of the PublicIP address.
16. Then exit the Details panel by selecting the X.
17. Open a terminal window, and change directory cd to the directory where the
labsuser.pem file was downloaded. For example, if the labuser.pem file was
saved to your Downloads directory, run this command:
cd ~/Downloads
18. Change the permissions on the key to be read-only, by running this command:
chmod 400 labsuser.pem
19. Run the below command (replace <public-ip> with the PublicIP address you
copied earlier). Alternatively, return to the EC2 Console and select Instances.
Check the box next to the instance you want to connect to and in the Description
tab copy the IPv4 Public IP value.:
ssh -i labsuser.pem ec2-user@<public-ip>
20. Type yes when prompted to allow the first connection to this remote SSH server.
Because you are using a key pair for authentication, you will not be prompted for
a password.
Task 2: Check the Status of the httpd Service
Httpd is the service for the Apache http server that is installed on your host. This is a
lightweight web server like the ones that run your favorite websites ( think let's .... say
amazon.com ) . In this exercise you check the status of the httpd service, and start it
using the systemctl command and verify the service is working.
Helpful Hint
You may have to use sudo to complete this exercise if you are not root.
21. Check the status of the httpd service by using the systemctl commands as
shown below and pressing ENTER
sudo systemctl status httpd.service
Expected Output:

*Figure: The command sudo systemctl status httpd.service and the output says that the
httpd service section is inactive (dead).*
This indicates that the **httpd** service is **loaded**, which means it is installed and
ready to work but is **inactive**.
So the next step is to start it
22. Check the status of the httpd service by using the systemctl commands as
shown below and pressing ENTER
sudo systemctl start httpd.service
23. Check again the status of the httpd service by using the systemctl commands as
shown below and pressing ENTER
sudo systemctl status httpd.service
Expected Output

*Figure: The command sudo systemctl status httpd.service and the output says that the
httpd service section is active (running).*
24. Now that the httpd is running, let's check it works correctly. Open a new tab on
your browser and enter : http://<publicip> . Replace <publicip> with the public ip
that you retrieved at the beginning of the course.
Expected Output

*Figure: When httpd is successfully running, an Apache Test page will apear with
general information about the proper operation of the Apache HTTP server.*
25. You can now stop the service by entering the command below and pressing
ENTER
sudo systemctl stop httpd.service
Task 3: Monitoring a Linux EC2 instance
In this exercise you will use Linux commands to monitor the Amazon Linux2 EC2
instance. You will also open the AWS Console and log into CloudWatch to see how this
service can provide you with data to monitor your instance.
Helpful Hint
You may have to use sudo to complete this exercise if you are not root.
26. Display the list of running processes by entering the command below and
pressing ENTER
top
Expected Output

*Figure: When running the command top, the output will show the current running
processes and resource usages.*
Top displays the processes currently running as well as the resource usage like CPU
usage and memory usage. Hit **Q** to exit and return to the shell.
In the next step you are going to run a script that simulates a workload on the CPU.
27. Run the stress.sh script that simulates a heavy workload on the EC2 instance by
entering the following command and pressing ENTER
./stress.sh & top
28. As in step 1, display the list of running processes by entering the top command
and pressing ENTER
Expected Output
Figure: The command prompt shows a high CPU usage after running a script. It shows
the user as ec2-user the percentage of CPU at 14-14.3 and the command used was
stress.
You can see that the process you just ran has a high CPU usage. The script is designed
to run for 6 minutes, before stopping.
In the next steps you open the **AWS Management Console** and start the **AWS
CloudWatch** application that will give you better insight into you EC2 instance.
29. On the top right of you screen select theAWS button. This displays the AWS
Management Console in a new tab.
30. In the Search bar on the top of the screen, enter CloudWatch and press ENTER.
Expected Output
The AWS console includes a search bar that you can use to search for services.
31. On the left section of the navigation pane, select Dashboard, then select
Automatic dashboards. In the Automatic dashboards list, select EC2
Expected Output
Figure: The CloudWatch dashboards shows CloudWatch Events, CloudWatch Logs,
and EC2 as the top three dashboards.
This opens up the EC2 dashboard created for you by AWS.
Expected Output
Figure: The graphs shown are CPU Utilization, DiskReadBytes, DiskReadOps,
DiskWriteBytes, DiskWriteOps, and NetworkIn for the account's EC2 instances.
You can see that by default the **EC2 CloudWatch dashboard** displays several
metrics such as the CPU utilization, Disk reads and writes....
You can see a spike in the CPU utilization that matches the time when you started the
stress script earlier.
> **Note**
>
> Dashboards are customizable so you can add or remove widgets,
> reorganize them, customize colors... **AWS CloudWatch** offers many
> more features such as alarms or events triggers that you will discover
> later that makes it a key **AWS Service** to monitor your applications
> in real time. Update the 5 minutes average to 1 second to second review
> updates more quickly.
32. Wait 5 minutes and go back to the AWS CloudWatch dashboard. You see that the
CPU utilization dropped
Expected Output
Figure: The graph shown is the CPU Utilization Average. In this average, the highest
percent it reaches is 62.6 percent at around 8 minutes and hovers around 33 percent
then drops back down right aftger the 9 minute mark.
> **Note**
>
> By default AWS CloudWatch aggregates data for 5 minutes before processing them.
This is setup that can be changed
Lab Complete
Congratulations! You have completed the lab.
33. Select End Lab at the top of this page and then select Yes to confirm that you
want to end the lab. A panel will appear, indicating that "DELETE has been
initiated... You may close this message box now."
34. Select the X in the top right corner to close the panel.
About the AWS component:
Amazon EC2 provides a wide selection of instance types optimized to fit different use
cases. Instance types comprise varying combinations of CPU, memory, storage, and
networking capacity and give you the flexibility to choose the appropriate mix of
resources for your applications. Each instance type includes one or more instance
sizes, allowing you to scale your resources to the requirements of your target workload.
This lab uses a t3.micro instance which should be selected by default. This instance
type has 1 virtual CPU and 1 GiB of memory.
Additional Resources
Amazon EC2 Instance Types Amazon Machine Images (AMI) Status Checks for Your
Instances Amazon EC2 Service Limits Terminate Your Instance
For more information about AWS Training and Certification, see
https://aws.amazon.com/training/.
Your feedback is welcome and appreciated. If you would like to share any suggestions
or corrections, please provide the details in our
© 2022 Amazon Web Services, Inc. and its affiliates. All rights reserved. This work may
not be reproduced or redistributed, in whole or in part, without prior written permission
from Amazon Web Services, Inc. Commercial copying, lending, or selling is prohibited.
The Bash Shell
Note
All labs rely on previous courseware and lab information.
Objectives
In this lab, you will:
Create and work with an alias to backup a complete folder
Work the PATH variable and add a new folder to it
Duration
This lab requires approximately 30 minutes to complete.
AWS service restrictions
In this lab environment, access to AWS services and service actions might be restricted
to the ones that are needed to complete the lab instructions. You might encounter errors
if you attempt to access other services or perform actions beyond the ones that are
described in this lab.
Accessing the AWS Management Console
1. At the top of these instructions, choose Start Lab to launch your lab. A Start Lab
panel opens, and it displays the lab status.
Tip: If you need more time to complete the lab, choose the Start Lab button again to
restart the timer for the environment.
2. Wait until you see the message Lab status: ready, then close the Start Lab panel
by choosing the X.
3. At the top of these instructions, choose AWS. This opens the AWS Management
Console in a new browser tab. The system will automatically log you in.
Tip: If a new browser tab does not open, a banner or icon is usually at the top of your
browser with a message that your browser is preventing the site from opening pop-up
windows. Choose the banner or icon and then choose Allow pop ups.
4. Arrange the AWS Management Console tab so that it displays along side these
instructions. Ideally, you will be able to see both browser tabs at the same time
so that you can follow the lab steps more easily.
Task 1: Use SSH to connect to an Amazon Linux EC2 instance
In this task, you will connect to a Amazon Linux EC2 instance. You will use an SSH
utility to perform all of these operations. The following instructions vary slightly
depending on whether you are using Windows or Mac/Linux.
Windows Users: Using SSH to Connect
These instructions are specifically for Windows users. If you are using macOS or Linux,
skip to the next section.
5. Select the Details drop-down menu above these instructions you are currently
reading, and then select Show. A Credentials window will be presented.
6. Select the Download PPK button and save the labsuser.ppk file. Typically your
browser will save it to the Downloads directory.
7. Make a note of the PublicIP address.
8. Then exit the Details panel by selecting the X.
9. Download PuTTY to SSH into the Amazon EC2 instance. If you do not have
PuTTY installed on your computer, download it here.
10. Open putty.exe
11. Configure your PuTTY session by following the directions in the following link:
Connect to your Linux instance using PuTTY
12. Windows Users: Select here to skip ahead to the next task.
macOS and Linux Users
These instructions are specifically for Mac/Linux users. If you are a Windows user, skip
ahead to the next task.
13. Select the Details drop-down menu above these instructions you are currently
reading, and then select Show. A Credentials window will be presented.
14. Select the Download PEM button and save the labsuser.pem file.
15. Make a note of the PublicIP address.
16. Then exit the Details panel by selecting the X.
17. Open a terminal window, and change directory cd to the directory where the
labsuser.pem file was downloaded. For example, if the labuser.pem file was
saved to your Downloads directory, run this command:
cd ~/Downloads
18. Change the permissions on the key to be read-only, by running this command:
chmod 400 labsuser.pem
19. Run the below command (replace <public-ip> with the PublicIP address you
copied earlier). Alternatively, return to the EC2 Console and select Instances.
Check the box next to the instance you want to connect to and in the Description
tab copy the IPv4 Public IP value.:
ssh -i labsuser.pem ec2-user@<public-ip>
20. Type yes when prompted to allow the first connection to this remote SSH server.
Because you are using a key pair for authentication, you will not be prompted for
a password.
Task 2: Create an alias for a backup operation
Specifically, you need to create an alias that gives you the ability to back up whatever
path you provide it.
Helpful Hint
You may have to use sudo to complete this task if you are not root.
Create an alias that uses the tar to back up the second parameter provided into the first
parameter. The following is a command line example:
Usage example: backup “fileToSaveTo.tar.gz” “pathToBackUp”
21. To validate that you are in the home folder in the terminal, enter the following
command, and press Enter.
pwd
Expected output:
[ec2-user@ ~]$ pwd
/home/ec2-user/
22. To create an alias called backup, enter the following command, and press Enter.
alias backup='tar -cvzf '
Remember that tar is a command that you use to create or extract an archive that
contains files and folders.
o -f archives the files (tar can also archive devices).
o -v is the everbose option to display what is put into the archive.
o -z compresses the archive into the .gzip format.
o tar -cf would work perfectly but would not display what is inside the
archive and would not compress it.
23. To use the backup alias to back up the CompanyA folder, enter the following
command, and press Enter.
backup backup_companyA.tar.gz CompanyA
Expected output:

*Figure: The command backup backup_companyA.targz CompanyA shows the entire
directory of Company A. The contents include folders such as Management,
Employees, Finance, HR, IA, SharedFolders, and bin. Files include the following:
Sections.csv, Promotions.csv, Schdules.csv, Salary.csv, Managers.csv,
Assessments.csv, and hello.sh.*
```
[ec2-user@ ~]$backup backup_companyA.tar.gz CompanyA
CompanyA/
CompanyA/Management/
CompanyA/Management/Sections.csv
CompanyA/Management/Promotions.csv
CompanyA/Employees/
CompanyA/Employees/Schedules.csv
CompanyA/Finance/
CompanyA/Finance/Salary.csv
CompanyA/HR/
CompanyA/HR/Managers.csv
CompanyA/HR/Assessments.csv
CompanyA/IA/
CompanyA/SharedFolders/
CompanyA/bin/hello.sh
```
24. To verify that the archive is created, enter the ls command, and press Enter.
Expected output:
[ec2-user@ ~]$ ls
backup_companyA.tar.gz CompanyA
Task 3: Explore and update the PATH environment variable
In this task, you display the PATH environment variable. You then update the variable
and add a new directory, in which you can place executables.
25. To navigate to the bin folder in the home CompanyA directory, enter the
following command, and press Enter.
cd /home/ec2-user/CompanyA/bin
Note:
You can also use the pwd command to verify that you are in the home folder,
/home/ec2-user, and use cd CompanyA/bin to enter the /home/ec2-user/bin folder.
26. To run the hello.sh script, enter the following command, and press Enter.
./hello.sh
Expected Output:
[ec2-user@ bin]$ hello.sh
hello ec2-user
27. To navigate to the parent folder, enter the following command, and press Enter.
cd ..
Expected Output:
[ec2-user@ bin]$ cd ..
[ec2-user@ CompanyA]$
28. To run the hello.sh script again, enter the following command, and press Enter.
./bin/hello.sh
Expected Output:
[ec2-user@ CompanyA]$ ./bin/hello.sh
hello ec2-user
29. To run the hello.sh script, enter the following command, and press Enter.
hello.sh
Expected Output:
[ec2-user@ CompanyA]$ hello.sh
bash: hello.sh: command not found
Note:
Analyze the three different ways you tried to run the hello.sh script. In the next step, you
are going to figure out why the third run failed and how to solve this issue.
30. To display the value of the PATH variable, enter the following command, and
press Enter.
echo $PATH
Expected Output:
[ec2-user@ CompanyA]$ echo $PATH
/usr/local/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/home/ec2-user/.local/bin:/home/ec2-
user/bin
Note:
Remember that the PATH variable is a list of folders where the system looks for
executables and libraries. If you enter a command such as hello.sh, Linux will look for
the script in the current folder and then in all the folders contained in the PATH variable.
You can see that /home/ec2-user/bin is not listed. There are currently only two ways to
run the script:
o Navigate to the /home/ec2-user/CompanyA/bin folder, and enter hello.sh
to run the script.
o Enter /home/ec2-user/CompanyA/bin/hello.sh from any folder.
31. To add the /home/ec2-user/CompanyA/bin folder to the PATH variable, enter
the following command, and press Enter.
PATH=$PATH:/home/ec2-user/CompanyA/bin
Expected Output:
[ec2-user@ CompanyA]$ PATH=$PATH:/home/ec2-user/CompanyA/bin
32. To try to run the hello.sh script again, enter hello.sh and press Enter.
Expected Output:
[ec2-user@ CompanyA]$ hello.sh
hello ec2-user
Lab Complete
Congratulations! You have completed the lab.
33. Select End Lab at the top of this page and then select Yes to confirm that you
want to end the lab. A panel will appear, indicating that "DELETE has been
initiated... You may close this message box now."
34. Select the X in the top right corner to close the panel.
About the AWS component
Amazon EC2 provides a wide selection of instance types optimized to fit different use
cases. Instance types comprise varying combinations of CPU, memory, storage, and
networking capacity and give you the flexibility to choose the appropriate mix of
resources for your applications. Each instance type includes one or more instance sizes
so that you can scale your resources to the requirements of your target workload.
This lab uses a t3.micro instance, which should be selected by default. This instance
type has 1 virtual CPU and 1 GiB of memory.
Additional resources
Amazon EC2 Instance Types
Amazon Machine Images (AMI)
Status Checks for Your Instances
Amazon EC2 Service Quotas
Terminate Your Instance
For more information about AWS Training and Certification, see
https://aws.amazon.com/training/.
Your feedback is welcome and appreciated. If you would like to share any suggestions
or corrections, please provide the details in our AWS Training and Certification Contact
Form.
© 2022 Amazon Web Services, Inc. and its affiliates. All rights reserved. This work may
not be reproduced or redistributed, in whole or in part, without prior written permission
from Amazon Web Services, Inc. Commercial copying, lending, or selling is prohibited.
Software Management
Note
All labs rely on previous courseware and lab information.
Objectives
In this lab, you will:
Update the Linux machine using the package manager
Roll back or downgrade a previously updated package through the package
manager
Install the AWS Command Line Interface (AWS CLI)
Duration
This lab requires approximately 35 minutes to complete.
AWS service restrictions
In this lab environment, access to AWS services and service actions might be restricted
to the ones that you need to complete the lab instructions. You might encounter errors if
you attempt to access other services or perform actions beyond the ones that this lab
describes.
Accessing the AWS Management Console
1. At the top of these instructions, choose Start Lab to launch your lab. A Start Lab
panel opens, and it displays the lab status.
Tip: If you need more time to complete the lab, choose the Start Lab button again to
restart the timer for the environment.
2. Wait until you see the message Lab status: ready, then close the Start Lab panel
by choosing the X.
3. At the top of these instructions, choose AWS. This opens the AWS Management
Console in a new browser tab. The system will automatically log you in.
Tip: If a new browser tab does not open, a banner or icon is usually at the top of your
browser with a message that your browser is preventing the site from opening pop-up
windows. Choose the banner or icon and then choose Allow pop ups.
4. Arrange the AWS Management Console tab so that it displays along side these
instructions. Ideally, you will be able to see both browser tabs at the same time
so that you can follow the lab steps more easily.
Task 1: Use SSH to connect to an Amazon Linux EC2 instance
In this task, you will connect to a Amazon Linux EC2 instance. You will use an SSH
utility to perform all of these operations. The following instructions vary slightly
depending on whether you are using Windows or Mac/Linux.
Windows Users: Using SSH to Connect
These instructions are specifically for Windows users. If you are using macOS or Linux,
skip to the next section.
5. Select the Details drop-down menu above these instructions you are currently
reading, and then select Show. A Credentials window will be presented.
6. Select the Download PPK button and save the labsuser.ppk file. Typically your
browser will save it to the Downloads directory.
7. Make a note of the PublicIP address.
8. Then exit the Details panel by selecting the X.
9. Download PuTTY to SSH into the Amazon EC2 instance. If you do not have
PuTTY installed on your computer, download it here.
10. Open putty.exe
11. Configure your PuTTY session by following the directions in the following link:
Connect to your Linux instance using PuTTY
12. Windows Users: Select here to skip ahead to the next task.
macOS and Linux Users
These instructions are specifically for Mac/Linux users. If you are a Windows user, skip
ahead to the next task.
13. Select the Details drop-down menu above these instructions you are currently
reading, and then select Show. A Credentials window will be presented.
14. Select the Download PEM button and save the labsuser.pem file.
15. Make a note of the PublicIP address.
16. Then exit the Details panel by selecting the X.
17. Open a terminal window, and change directory cd to the directory where the
labsuser.pem file was downloaded. For example, if the labuser.pem file was
saved to your Downloads directory, run this command:
cd ~/Downloads
18. Change the permissions on the key to be read-only, by running this command:
chmod 400 labsuser.pem
19. Run the below command (replace <public-ip> with the PublicIP address you
copied earlier). Alternatively, return to the EC2 Console and select Instances.
Check the box next to the instance you want to connect to and in the Description
tab copy the IPv4 Public IP value.:
ssh -i labsuser.pem ec2-user@<public-ip>
20. Type yes when prompted to allow the first connection to this remote SSH server.
Because you are using a key pair for authentication, you will not be prompted for
a password.
Task 2: Update your Linux machine
In this task, you use the yum package manager to update and upgrade the machine,
including relevant security packages.
Note You may have to use sudo to complete this task if you are not root.
21. To validate that you are in the companyA home folder, enter pwd and press
Enter.
If you are not in this folder, enter cd companyA and press Enter.
22. To query repositories for available updates, enter sudo yum -y check-update and
press Enter.
23. To apply security-related updates, enter sudo yum update --security and press
Enter.
24. To update packages, enter sudo yum -y upgrade and press Enter.

*Figure: Once the sudo yum -y upgrade command is ran, the packages are updated and
the system will let you know that you are running the current updated version.*
>**Note**
>
>Your instance may already be up to date. If this is the case, you can still run through
the commands for practice.
25. To view the install of httpd and view the history of updates, enter sudo yum install
httpd -y and press Enter.
Figure: This command installs httpd and will also show a list of all previous updates and
current packages on the instance.
Task 3: Roll back a package
In this task, you downgrade a package that has been updated through the yum package
manager by doing the following:
Using the yum history to list what has been installed and updated
Rolling back to the most recent updates in the history list
Note
You may have to use sudo to complete this task if you are not root.
26. To validate that you are in the companyA home folder, enter pwd and press
Enter.
27. To view the history of updates, enter sudo yum history list and press Enter. In the
output, under the ID column, make a note of the number for EC2 ... to use in the
following steps in this task.

*Figure: Once the sudo yum history-list command is finished running, two users will
appear (ec2-user and System) with the date, time, and actions that they did. It also
shows how many files that were altered.*
```bash
[ec2-user@ companyA]$ sudo yum history list
Loaded plugins: extras_suggestions, langpacks, priorities, update-motd
ID | Login user | Date and time | Action(s) | Altered
------------------------------------------------------------
2 | EC2 ... <ec2-user> | <date and time> | Install | 9
1 | System <unset> | <date and time> | I, O, U | 18
history list
```
28. To view the most recent set of updates, enter sudo yum history info <#> and
replace <#> with the history list number from the previous step. Once you have
adjusted this command with this number, press Enter.
Note: The number is found at the top of the history list from step 2.

*Figure: Information from the sudo yum history info <#> command shows the following
information: begin time, begin rpmdb, end time, end rpmdb, user, return-code, and
command line.*
```bash
[ec2-user@ companyA]$ sudo yum history info <#>
Loaded plugins: extras_suggestions, langpacks, priorities, update-motd
Transaction ID : <#>
Begin time : <date and time>
Begin rpmdb :
End time : <time>
End rpmdb :
User : EC2 Default User <ec2-user>
Return-Code : Success
Command Line : install httpd -y
```
29. Enter sudo yum -y history undo <#> and replace <#> with the history list number
from the previous steps. Once you have adjusted this command with this
number, press Enter.
Figure: Once the sudo yum -y history undo 2 command is ran, it now shows many
packages as dep-install.
```bash
[ec2-user@ companyA]$ sudo yum -y history undo <#>
Loaded plugins: extras_suggestions, langpacks, priorities, update-motd
Undoing transaction <#>, from <date>
<list of actions now shown as Dep-Install>
```
Task 4: Install the AWS CLI on Red Hat Linux
In this task, you install the AWS CLI on Amazon Elastic Compute Cloud (Amazon EC2)
Linux:
Ensure that packages are installed and updated
Install the AWS CLI
Note
You may have to use sudo to complete this task if you are not root.
30. To verify that Python is installed, enter the following command and press Enter:
python3 --version
The output indicates the version of Python that is installed.
Note
To install the AWS CLI, you must have Python 2 version 2.6.5 or later, or Python 3
version 3.3. If one of these versions is not already installed, you must follow the link
steps to install Python.
31. To see if the pip package manager is already installed, enter the following
command and press Enter.
pip3 --version
"bash: pip: command not found" indicate this Red Hat instance does not have pip
installed.
Note
The primary distribution method for the AWS CLI on Linux, Windows, and macOS is pip.
pip is a package manager for Python that provides you with an easy way to install,
upgrade, and remove Python packages and their dependencies.
32. In order to install the AWS CLI, download the installation file using the curl
command.
The -o option specifies the file name that the downloaded package is written to. The
options on the following example command write the downloaded file to the current
directory with the local name awscliv2.zip.
curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip"
33. Unzip the installer.
The following example command unzips the package and creates a directory named
aws under the current directory.
unzip awscliv2.zip
34. Run the install program.
The installation command uses a file named install in the newly unzipped aws directory.
By default, the files are all installed to /usr/local/aws-cli, and a symbolic link is created in
/usr/local/bin. The command includes sudo to grant write permissions to those
directories.
sudo ./aws/install
35. To verify that the AWS CLI is now working, enter the following command and
press Enter.
aws help
The help command should display the help information for the AWS CLI.
36. At the : prompt, enter q to exit.
37. At the top of the page above these instructions, choose the Details dropdown
menu, and then chose Show. A Credentials window opens.
38. In the Credentials window next to AWS CLI, choose Show. This option displays
AWS CLI credentials, including the aws_access_key_id and
aws_secret_access_key. Copy and paste these two keys into a text editor to
use in the next task of this lab.
Note
There is no way for you to retrieve the secret access key that must be used when
configuring the AWS CLI unless it was captured at the time that the keys were created.
Fortunately, the secret access key was captured when it was created for this lab.
Task 5: Configure the AWS CLI to connect to your AWS account
39. Return to your terminal window. Enter the following configuration command for
the AWS CLI and press Enter:
aws configure
40. At the prompts, enter the following information:
o For the AWS Access Key ID, leave blank and press Enter.
o For the AWS Secret Access Key, leave blank and press Enter.
o For the Default region name, enter us-west-2 and press Enter.
o For the Default output format, enter json and press Enter.
After the information is entered, the appropriate credential files are created
automatically.
41. To open the credential file, enter the command sudo nano ~/.aws/credentials
42. Now paste the entire section copied from the Details window from task 4 into the
file.
For example:
[default]
aws_access_key_id=<your access key ID>
aws_secret_access_key=<your access key>
aws_session_token=<your session token>
43. Press ctrl + O to save and press enter to save the file as the original file name.
44. Press ctrl + X to exit the file.
45. Next, you need to find your instance ID. At the top of your screen above these
instructions, choose AWS to open the AWS Management Console in a new tab.
46. At the top of the console page in the Search for service search box, enter EC2
and choose EC2.
47. In the Resources section, choose Instances (running).
48. There is one instance called Command Host. Copy and paste the Instance ID
for the Command Host into a text editor to use in the following step.
49. Return to your terminal, and enter the following command. Before you press
Enter, replace <i-1234567890abcdefg> with the instance ID that you copied from
the previous step. After you have adjusted the following command with your
instance ID, press Enter. This command describes the instance attributes.
aws ec2 describe-instance-attribute --instance-id i-1234567890abcdefg --attribute
instanceType
The output should look like the following. (The output should include your instance ID
instead of <i-1234567890abcdefg>.)
Output:
{
"InstanceId": "i-1234567890abcdefg"
"InstanceType": {
"Value": "t3.micro"
}
}
Lab Complete
Congratulations! You have completed the lab.
50. Select End Lab at the top of this page and then select Yes to confirm that you
want to end the lab. A panel will appear, indicating that "DELETE has been
initiated... You may close this message box now."
51. Select the X in the top right corner to close the panel.
About the AWS component
Amazon EC2 provides a wide selection of instance types optimized to fit different use
cases. Instance types comprise varying combinations of CPU, memory, storage, and
networking capacity and give you the flexibility to choose the appropriate mix of
resources for your applications. Each instance type includes one or more instance sizes
so that you can scale your resources to the requirements of your target workload.
This lab uses a t3.micro instance, which should be selected by default. This instance
type has 1 virtual CPU and 1 GiB of memory.
Additional resources
Amazon EC2 Instance Types
Amazon Machine Images (AMI)
Status Checks for Your Instances
Amazon EC2 Service Quotas
Terminate Your Instance
For more information about AWS Training and Certification, see
https://aws.amazon.com/training/.
Your feedback is welcome and appreciated. If you would like to share any suggestions
or corrections, please provide the details in our AWS Training and Certification Contact
Form.
© 2022 Amazon Web Services, Inc. and its affiliates. All rights reserved. This work may
not be reproduced or redistributed, in whole or in part, without prior written permission
from Amazon Web Services, Inc. Commercial copying, lending, or selling is prohibited.
RSNF EN-US SG M03 INTRONETWORKING
<> of 27+-<->Close
Introduction to networking
Networking Fundamentals
Welcome to Introduction to networking!
2
© 2022, Amazon Web Services, Inc. or its affiliates. All rights reserved.
What you will learn
At the core of the lesson
You will learn how to:
•
Define basic networking terms
•
Explain what the Internet is, its purpose, and its function for users.
•
Identify the main components of a computer network
You will learn how to:
•
View and change file permissions
•
Understand what the Internet is
, its purpose and function for users. You will
examine the history of networking the through the lens of the components
which make up a network.
•
Compare symbolic and absolute representations of file permissions
© 2022, Amazon Web Services, Inc. or its affiliates. All rights reserved.
What is the Internet?
In this section, you will understand how the internet was born.
4
© 2022, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Basic history of how the internet was born
Packet
-
switching
theory was tested.
Transmission Control
Protocol
(TCP)/Internet
Protocol (IP) was
developed.
Dial
-
up was
introduced and
allowed email
communication.
World Wide Web,
Windows 95, and
the uniform
resource locator
(URL) are used.
Networking, the
internet, and devices
evolved from LAN
devices to wireless
devices.
A brief history of how the internet was born:
•
It all started in the 1960s. The US department of Defense Advanced Research
Projects Agency (DARPA) worked on a packet
-
switching theory to send a message
between themselves and a partner university.
•
In the 1970s, Transmission Control Protocol and Internet Protocol (IP) was
developed in order to link multiple networks together.
•
In the 1980s, dial
-
up was introduced as a way to access the internet and allowed
the revolutionary way to communicated across the world using email. This was
possible through a local area network (LAN).
•
In the 1990s, hypertext markup language (HTML) and uniform resource locator
(URL) were created to visualize what is called the World Wide Web (www). In 1995
big things were happening, such as Windows 95, and large company launches that
you most likely still shop on today.
•
In the 2000s, the dotcom bubble had reached its end; however, this created a new
wave of opportunity for technology. Networking, the internet, and the devices you
use today have evolved rapidly since the start of the early 2000s. From desktops,
to laptops, to tablets, technology is constantly evolving, and so is the complexity of
networking to it.
4
© 2022, Amazon Web Services, Inc. or its affiliates. All rights reserved.
What is computer networking?
In this section, you will review what a computer network is.
6
© 2022, Amazon Web Services, Inc. or its affiliates. All rights reserved.
A network is like a highway
Networking is like a highway system that
connects cities and states together, from
one point to another.
A network is like a highway system, where a car
travels (like a message) from point A to point B.
In this example, point A is your house (the client), and point B is the grocery store
(website). In this example, in order to get to point A to point B, you would get in
some type of transportation (send a request) to go the store to buy what you need.
To get there, transportation takes a series of roads (networks) to get to point B.
7
© 2022, Amazon Web Services, Inc. or its affiliates. All rights reserved.
What is computer networking?
What is computer networking?
•
A
computer network
is a collection of computing devices that are logically connected together to
communicate and share resources.
Node
Hos
t
•
A
node
refers to any device on the
network. (Examples: computer,
routers, printers)
•
A
host
is a node that has a unique
function. Other devices connect to
nodes so they can access data or other
services. (Example: server)
What is computer networking?
•
It’s a collection of computing devices that are logically connected together to
communicate and share resources.
•
An example is like an interstate highway system that connects cities and states
together from one point to another. Like networking, it made it possible to be
connected in a faster and easier way.
How does it work at a basic level?
•
It has a node. A node is like a computer, router, switches, modems, and printers,
which are connected through links (a way for data to transmit, such as cables), that
follow rules to send and receive data.
•
It has a host. A host is a node that has a unique function. Other devices connect to
nodes so they can access data or other services. An example of a host is a server,
because a server can provide access to data, run an application, or provide a
service.
8
© 2022, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Basic a computer network
Above is an example of a basic computer network where a computer is connected
through a network interface card (NIC) and traffic is routed/switched through a switch
to its intended destination. When there are more computers within buildings,
computers are grouped together to a switch that is then connected to a router as
seen on the next slide.
9
© 2022, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Elements of a computer network
As noted in the previous slide, in a bigger network, the computers are grouped to a
switch, in this example, switch A and B, also known as subnets. These switches send
traffic to a router, which is ultimately a bigger switch with more intelligent functions.
•
Computer A
is a typical
node
on a network. On the network, it can be either a
client
or a
server
. Clients and servers will be discussed shortly.
•
Network interface card (NIC)
connects a computer to a network cable.
•
Network cables
connect the nodes on a network.
•
Switch A
and
B
connect
multiple devices
on a network.
•
Router
connects
multiple switches
on a network.
RSNF EN-US SG M03 NETCONCEPTS
<> of 32+-<->Close
Networking concepts
Networking Fundamentals
Welcome to networking concepts!
2
© 2022, Amazon Web Services, Inc. or its affiliates. All rights reserved.
What you will learn
At the core of the lesson
You will learn how to:
•
Distinguish between different types of networks
•
Describe common network topologies and network management models
•
List different types of network protocols
You will learn how to:
•
Distinguish between different types of networks
•
Describe common network management models and network topologies
•
List different types of network protocols
5
© 2022, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Wide
-
area network (WAN)
•
A WAN connects devices in a
large geographical area
, such as multiple cities or countries.
•
WANs are
used to connect LANs.
WAN:
•
In the example above, a WAN with three routers, two switches and three nodes
under each switch. Examples of WANs are two corporate offices located across the
United States connected by a WAN (the internet).
•
WANs use technologies such as fiber
-
optic cables and satellites to transmit data
which are used to connect
LANs
.
•
The
internet
is considered to be the largest WAN.
6
© 2022, Amazon Web Services, Inc. or its affiliates. All rights reserved.
LAN versus WAN
LAN
WAN
LAN:
Within the same building or floor.
WAN:
Can be geographically different locations; however, they are connected by a
corporate WAN.
© 2022, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Network topologies
In this section, you will understand basic network topologies (physical and logical).
RSNF EN-US SG M03 INTERNETPROTOCOL
<> of 24+-<->Close
Internet Protocols (IP)
Networking Fundamentals
Welcome to Internet Protocols (IP)!
2
© 2022, Amazon Web Services, Inc. or its affiliates. All rights reserved.
What you will learn
At the core of the lesson
You will learn how to:
•
Describe the Internet Protocol (IP) and its features
•
Explain the purpose of an IP address and its notation
•
Distinguish between different classes of IP addresses
•
Convert an IP address to binary
•
Describe port numbering and its use
You will learn how to:
•
Describe the Internet Protocol (IP) and its features
•
Explain the purpose of an IP address and its notation
•
Distinguish between different classes of IP addresses
•
Convert an IP address to binary
•
Describe port numbering and its use
Internet Protocols - Public and Private IP addresses
Objectives
In this lab, you will:
Summarize and investigate the customer scenario
Analyze the difference between a private and public IP address
Develop a solution to the customer's issue in this lab
Summarize and describe your findings (group activity)
Duration
This lab requires approximately 1 hour to complete.
Scenario
Your role is a cloud support engineer at Amazon Web Services (AWS). During your shift,
a customer from a Fortune 500 company requests assistance regarding a networking
issue within their AWS infrastructure. The following is the email and an attachment
regarding their architecture:
Ticket from your customer
Hello, Cloud Support!
We currently have one virtual private cloud (VPC) with a CIDR range of 10.0.0.0/16. In
this VPC, we have two Amazon Elastic Compute Cloud (Amazon EC2) instances:
instance A and instance B. Even though both are in the same subnet and have the
same configurations with AWS resources, instance A cannot reach the internet, and
instance B can reach the internet. I think it has something to do with the EC2 instances,
but I'm not sure. I also had a question about using a public range of IP address such as
12.0.0.0/16 for a VPC that I would like to launch. Would that cause any issues?
Attached is our architecture for reference.
Thanks! Jess Cloud Admin
Figure: The customer's architecture, which consists of a VPC, internet gateway, public
subnet with instance A, and a public subnet with instance B.
AWS service restrictions
In this lab environment, access to AWS services and service actions might be restricted
to the ones that you need to complete the lab instructions. You might encounter errors if
you attempt to access other services or perform actions beyond the ones that this lab
describes.
Accessing the AWS Management Console
1. At the top of these instructions, choose Start Lab to launch your lab. A Start Lab
panel opens, and it displays the lab status.
Tip: If you need more time to complete the lab, choose the Start Lab button again to
restart the timer for the environment.
2. Wait until you see the message Lab status: ready, then close the Start Lab panel
by choosing the X.
3. At the top of these instructions, choose AWS. This opens the AWS Management
Console in a new browser tab. The system will automatically log you in.
Tip: If a new browser tab does not open, a banner or icon is usually at the top of your
browser with a message that your browser is preventing the site from opening pop-up
windows. Choose the banner or icon and then choose Allow pop ups.
4. Arrange the AWS Management Console tab so that it displays along side these
instructions. Ideally, you will be able to see both browser tabs at the same time
so that you can follow the lab steps more easily.
Task 1: Investigate the customer's environment
Recall that you previously covered public and private IP addresses and CIDRs. As you
go through this lab, think about the differences between public and private IP addresses
for task 1. For task 2, think about the importance of using private IP ranges rather than
public IP ranges.
Note
For this lab, you have already checked the AWS architecture, and everything is routed
and attached correctly. This lab does not cover any AWS architecture.
In the scenario, Jess, who is the customer requesting assistance, has two EC2
instances in one VPC. Instance A cannot reach the internet, and instance B can even
though they are configured the same within the VPC. Currently, the customer's AWS
architecture seems sound because one of their instances works. Jess suspects that the
instance configuration may be the issue.
She also has a question about using a public range of IP addresses for the new VPC
and has asked if you could provide further insight on her question.
You currently have one VPC with the same CIDR of 10.0.0.0/16 with two instances —
instance A and instance B — with the same configurations as the customer. When
troubleshooting networking and AWS, you can apply a troubleshooting method where
you start from the top and work your way down or start from the bottom and work your
way up. You start troubleshooting from the bottom and work your way to the top in
layers using an example such as the OSI model. At the very bottom of this architecture
is the EC2 instance. Although the cloud architecture does not directly translate to the
OSI model, the following is an example of how the OSI and cloud relate.
OSI Model AWS infr
Layer 7 Application (how the end user sees it) Applicatio
Layer 6 Presentation (translator between layers) Web Ser
Layer 5 Session (session establishment, security) EC2 insta
OSI Model AWS infr
Layer 4 Transport (TCP, flow control) Security
Layer 3 Network (Packets which contain IP addresses) Route Ta
Layer 2 Data Link (Frames which contain physical MAC addresses) Route Ta
Layer 1 Physical (cables, physical transmission bits and volts) Regions,
Table: This is an example of how the AWS infrastructure and its resources have
similarities to the OSI model. This information can be beneficial when troubleshooting.
For task 1, you gain an understanding of the customer's environment and replicate their
issue.
5. At the upper-right of these instructions, choose AWS. The AWS Management
Console opens in a new tab.
6. Once you are in the AWS console, type and search for EC2 in the search bar on
the top-left corner. Select EC2 from the list.
Tip: Alternatively, You can also find EC2 under Services - Compute in the top left
corner
Figure: The search bar can be used to find the Amazon EC2 service. Once you find the
service, select it.
7. You are now in the Amazon EC2 dashboard. In the left navigation menu, choose
Instances. This option takes you to your current EC2 instances. You should
currently see two EC2 instances.
Figure: Amazon EC2 dashboard
8. Please copy and paste the names and IP addresses of both instances for future
reference in a text editor. Select the check box next to instance A. At the bottom
of the page, choose the Networking tab, and note the Public and Private IPv4
addresses. Once you copy and paste the name and IP addresses, deselect the
instance, and then select instance B and do the same. Did you notice any
differences? Note them if you did.
Figure: Amazon EC2 instance A networking information. The IP address values may
vary.
Figure: Amazon EC2 instance B networking information. The IP address values may
vary.
Task 2: Use SSH to connect to an Amazon Linux EC2 instance
n this task, you will connect to a Amazon Linux EC2 instance. You will use an SSH utility
to perform all of these operations. The following instructions vary slightly depending on
whether you are using Windows or Mac/Linux.
Windows Users: Using SSH to Connect
These instructions are specifically for Windows users. If you are using macOS or Linux,
skip to the next section.
9. Select the Details drop-down menu above these instructions you are currently
reading, and then select Show. A Credentials window will be presented.
10. Select the Download PPK button and save the labsuser.ppk file. Typically your
browser will save it to the Downloads directory.
11. Make a note of the PublicIP address.
12. Then exit the Details panel by selecting the X.
13. Download PuTTY to SSH into the Amazon EC2 instance. If you do not have
PuTTY installed on your computer, download it here.
14. Open putty.exe
15. Configure your PuTTY session by following the directions in the following link:
Connect to your Linux instance using PuTTY
16. Windows Users: Select here to skip ahead to the next task.
macOS and Linux Users
These instructions are specifically for Mac/Linux users. If you are a Windows user, skip
ahead to the next task.
17. Select the Details drop-down menu above these instructions you are currently
reading, and then select Show. A Credentials window will be presented.
18. Select the Download PEM button and save the labsuser.pem file.
19. Then exit the Details panel by selecting the X.
20. Open a terminal window, and change directory cd to the directory where the
labsuser.pem file was downloaded. For example, if the labuser.pem file was
saved to your Downloads directory, run this command:
cd ~/Downloads
21. Change the permissions on the key to be read-only, by running this command:
chmod 400 labsuser.pem
22. Run the below command *(replace <ip-address> with the IPv4 address of
instance A you made a note of earlier. Note: Should you use a Public or Private
IP address to connect?
ssh -i labsuser.pem ec2-user@<ip-address>
23. Type yes when prompted to allow the first connection to this remote SSH server.
Because you are using a key pair for authentication, you will not be prompted for
a password.
Question - Were you able to use the SSH to connect to both instances? Why or why
not?
Answer: If you were not able to connect to instance A, it was due to this instance being
assigned only a private IP address. Private IP addresses cannot be accessed from
outside the VPC. This is why you are only able to connect to instance B. Instance B has
a public IP address assigned to it allowing access from outside the VPC, which allows
you to use the SSH utility to connect to the instance.
The customer asked for your insight regarding using a public CIDR for a new VPC that
she would like to launch. Refer to module 4 and gather some evidence and summarize
a short explanation of your findings to explain to the customer why or why not you
recommend this approach.
Task 3: Send the Response to the customer (group activity)
In groups of two, submit your findings.
Person 2 will act as Jess the customer, and Person 1 will act as the cloud support
engineer. Person 1 will talk over their findings with person 2.
Note
This task should take only 5-10 minutes. If a group activity is not possible due to
COVID, please have one student walk through their findings to the class.
Lab Complete
Congratulations! You have completed the lab.
24. Select End Lab at the top of this page and then select Yes to confirm that you
want to end the lab. A panel will appear, indicating that "DELETE has been
initiated... You may close this message box now."
25. Select the X in the top right corner to close the panel.
Recap
In this lab you have investigated the customer's environment and applied
troubleshooting techniques that allowed you to resolve the customers’ issue. Within the
scenario, you discovered that the customer's EC2 instance (instance A) needed a public
IP address to connect to the internet. This was tested by using an SSH utility to connect
to the instance. Private IP addresses are used within the VPC and cannot establish a
connection to the internet. As module 4 noted, you discovered that using a public range
of IP addresses for a VPC can result in complications from having replies back from
other unrelated resources.
Additional Resources
Amazon EC2 Instance IP addressing
VPC CIDR
RFC1918
For more information about AWS Training and Certification, see
https://aws.amazon.com/training/.
Your feedback is welcome and appreciated. If you would like to share any suggestions
or corrections, please provide the details in our AWS Training and Certification Contact
Form.
© 2022 Amazon Web Services, Inc. and its affiliates. All rights reserved. This work may
not be reproduced or redistributed, in whole or in part, without prior written permission
from Amazon Web Services, Inc. Commercial copying, lending, or selling is prohibited.
RSNF EN-US SG M03 AWSCLOUD
<> of 35+-<->Close
Networking in the AWS Cloud
Networking Fundamentals
Welcome to Networking in the AWS Cloud.
2
© 2022, Amazon Web Services, Inc. or its affiliates. All rights reserved.
What you will learn
At the core of the lesson
You will learn how to:
•
Explain networking in the cloud
•
Explain virtual networking in the cloud with Amazon Virtual Private Cloud (Amazon
VPC)
•
Describe the key components of a virtual private cloud (VPC)
•
Relate subnetting and
Classless Inter
-
Domain Routing (
CIDR) block addressing to Amazon VPC features
You will learn how to:
•
Explain networking in the cloud
•
Explain virtual networking in the cloud with Amazon Virtual Private Cloud (Amazon
VPC)
•
Describe the key components of a virtual private cloud (VPC)
•
Relate subnetting and
Classless Inter
-
Domain Routing (
CIDR)
block addressing to
Amazon VPC features
3
© 2022, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Networking in the cloud
Recall virtual networking
Earlier, you compared the similarities between Amazon Web Services (AWS) services
and traditional network
topologies:
Traditional topology
AWS service
Data center
Amazon VPC
Router
Route tables
Switches (subnets)
Subnets
Firewall
Security groups and network access
control lists (network ACLs)
Servers and operating systems
Amazon Elastic Compute Cloud (Amazon
EC2) instances
Modem
Internet gateway
As described earlier, networking in the cloud is similar to regular networking in a data
center:
•
A data center as a whole most closely resembles the function of a VPC. In a VPC,
you can launch multiple AWS services that are needed to create a working,
scalable network. However, within a VPC, no maintenance is required, and you can
create an isolated architecture within minutes.
•
A data center involves multiple components: internet, servers, firewalls, switches,
and more. Like a data center, a VPC requires the same services to operate.
•
A router in a traditional environment has multiple functions, such as filtering
packets, routing traffic, and storing them in a route table. In AWS, the service that
most closely resembles a router is a route table, where the owner inputs routes
within the VPC.
•
A switch acts as a subnet and switches data as it comes in. AWS uses subnets in
every architecture. Every node (EC2 instance) belongs in a subnet. Although the
functions of a switch and an AWS subnet do not match, the functions of a subnet
from both work the same architecturally. Subnets are used to logically isolate
groups of internet protocols together.
•
Firewalls block traffic based on a set of rules. AWS has security groups that block
traffic at the node (Amazon EC2 level) and network ACLs that block traffic at the
subnet level. These security groups also block traffic based on a set of rules.
•
A data center has servers and operating systems. In AWS, you can use an EC2
instance to launch an array of servers or operating systems.
•
Everything must be connected to the internet through an internet service provider
(ISP). One that you might be familiar with is called a modem, where an ISP
provides internet to your home. Like a modem, a VPC on AWS and its services
receive internet only through an internet gateway.
RSSECY EN-US SG M04 SECURITYINTRO
<> of 24+-<->Close
Introduction to Security
Welcome to Introduction to Security.
Third
-
party links are for educational purposes only. AWS takes no responsibility and
assumes no liability for the accuracy or accessibility of the linked content.
2
© 2022, Amazon Web Services, Inc. or its affiliates. All rights reserved.
What you will learn
At the core of the lesson
You will learn how to:
•
Define key security terms
•
Identify different types of security threats
•
Identify the components that comprise a security strategy
•
List the types of security controls
•
Name the stages of the security lifecycle
In this lesson, you will learn how to:
•
Define key security terms
•
Identify different types of security threats
•
Identify the components that comprise a security strategy
•
List the types of security controls
•
Name the stages of the security lifecycle
© 2022, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Security basics
Let’s begin with some security basics.
4
© 2022, Amazon Web Services, Inc. or its affiliates. All rights reserved.
4
Discussion:
Security introduction
1)
What would be the impact on your life if you could not
access the internet for a few days?
2)
What would be the impact if your personal information
were stolen?
3)
What are some ways that you can think of to prevent any
of this from happening?
To get you started thinking about the topic of security, answer the following
questions:
1)
What would be the impact on your life if you could not access the internet for a
few days?
2)
What would be the impact if your personal information were stolen?
3)
What are some ways that you can think of to prevent any of this from happening?
5
© 2022, Amazon Web Services, Inc. or its affiliates. All rights reserved.
What is security?
Security is the practice of protecting valuable assets.
•
Assets can be physical or digital and include
people, buildings, computers, software
applications, and data.
•
Cybersecurity
is concerned with protecting
networks, devices, systems, and digital
information from the following:
–
Unauthorized access
–
Malicious modification, theft, or
destruction
–
Disruption of intended use
•
The primary goal of cybersecurity is to ensure
the confidentiality, integrity, and availability of
digital information.
Security can be generally defined as the practice of protecting valuable assets. These
assets can be physical, such as people, computers, and buildings, or digital, such as
software applications and user data. Security attempts to ensure that only authorized
personnel are allowed access to these assets and protects these assets from
malicious modification, theft, or destruction so that they can be used according to
their intended purpose.
Cybersecurity is particularly concerned with the protection of networks, computers,
and systems to ensure the confidentiality, integrity, and availability (CIA) of the digital
information that they contain.
5
6
© 2022, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Confidentiality, integrity, and availability (CIA)
Information needs to be protected to ensure its confidentiality, integrity, and availability.
•
Confidentiality
: Is private data protected to prevent
unauthorized access?
•
Integrity
: Are measures in place to ensure that data has
not been tampered with and is correct and authentic?
•
Availability
: Are authorized users able to access the data
when they need it?
Availability
Information
security
The confidentiality,
integrity, and availability (CIA) triad represents three important
security aspects that must be considered when protecting information. They are
defined as follows:
•
Confidentiality
protects the privacy of the information by preventing unauthorized
access to it. A common method to ensure confidentiality, for example, is to first
asks users to identify themselves before they are allowed to use a system. This
process is known as authentication.
•
Integrity ensures that the information is always accurate and correct where it is
stored and whenever it is moved. The data cannot be altered by unauthorized
users as it moves inside and outside its containing system or when it reaches its
final storage location. Hashing is an example of a technique that can be used to
ensure that data has not been tampered with during transit.
•
Availability ensures that the information is accessible to users when they need it.
Businesses typically address availability requirements by creating plans such as a
business continuity plan (BCP) and a d
isaster recovery plan (DRP). These plans
define processes and procedures to maintain or quickly restore
the availability of
the systems containing the information in the event of failure or disruption.
You will learn more about the methods for ensuring the confidentiality, integrity, and
availability of information in the upcoming modules.
7
© 2022, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Basic security terms
A person or entity with malicious intent to compromise a system
Attacker
A weakness in a system that an attacker can exploit
Vulnerability
An event that has the potential to negatively impact a system
Threat
An attack that compromises a system
Breach
A mechanism to reduce or eliminate a vulnerability
Control
The following scenario explains the basic security terms that this slide lists:
1)
An attacker is an entity that wants to maliciously affect a system.
2)
The attacker searches for a vulnerability in the system that they can exploit. A
vulnerability is a weakness that exists usually due to an oversight, flaw, or error in
the system.
3)
When the attacker finds a vulnerability, they create an event that is capable of
causing a negative impact on the system through the vulnerability. This is called a
threat.
4)
If the threat is successful and the system is compromised, a breach or incident has
occurred.
5)
When the breach is detected, the owner of the system implements a control to
eliminate the vulnerability that attackers used to carry out the breach.
RSSECY EN-US SG M04 SECURITYINTRO
<> of 24+-<->Close
Introduction to Security
Welcome to Introduction to Security.
Third
-
party links are for educational purposes only. AWS takes no responsibility and
assumes no liability for the accuracy or accessibility of the linked content.
2
© 2022, Amazon Web Services, Inc. or its affiliates. All rights reserved.
What you will learn
At the core of the lesson
You will learn how to:
•
Define key security terms
•
Identify different types of security threats
•
Identify the components that comprise a security strategy
•
List the types of security controls
•
Name the stages of the security lifecycle
In this lesson, you will learn how to:
•
Define key security terms
•
Identify different types of security threats
•
Identify the components that comprise a security strategy
•
List the types of security controls
•
Name the stages of the security lifecycle
7
© 2022, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Basic security terms
A person or entity with malicious intent to compromise a system
Attacker
A weakness in a system that an attacker can exploit
Vulnerability
An event that has the potential to negatively impact a system
Threat
An attack that compromises a system
Breach
A mechanism to reduce or eliminate a vulnerability
Control
The following scenario explains the basic security terms that this slide lists:
1)
An attacker is an entity that wants to maliciously affect a system.
2)
The attacker searches for a vulnerability in the system that they can exploit. A
vulnerability is a weakness that exists usually due to an oversight, flaw, or error in
the system.
3)
When the attacker finds a vulnerability, they create an event that is capable of
causing a negative impact on the system through the vulnerability. This is called a
threat.
4)
If the threat is successful and the system is compromised, a breach or incident has
occurred.
5)
When the breach is detected, the owner of the system implements a control to
eliminate the vulnerability that attackers used to carry out the breach.
7
8
© 2022, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Why is security important? (1 of 2)
Security threats are real.
•
Reports of breaches in the government, financial, healthcare, and internet commerce
areas are commonplace
in the news.
•
The types and number of threats continue to rise.
13,256
data breach incidents recorded in North America (in
2020)*
Security has become crucial for everyone because computers and related
technologies are integrated into our work environments and personal lives more each
day. As more valued information is put on systems, the types and number of threats
continue to increase. It is commonplace today to hear reports in the news of
government agencies, financial companies, and other businesses with an internet
presence being hacked (that is, breached). To quantify the magnitude of the problem,
a study conducted by Verizon estimates that 13,256 data breach incidents were
recorded in North America alone in 2020.*
Source: *Verizon. 2021. 2021 Data Breach Investigations Report (DBIR). Accessed
November 23, 2021.
https://enterprise.verizon.com/business/resources/reports/2021
-
data
-
breach
-
investigations
-
report.pdfx
.
RSSECY EN-US SG M04 LIFECYCLEPREVENTION
<> of 25+-<->Close
Security Lifecycle: Prevention
Security Fundamentals
Welcome to Security Lifecycle: Prevention.
Third
-
party links are for educational purposes only. Amazon Web Services (AWS)
takes no responsibility and assumes no liability for the accuracy or accessibility of the
linked content.
1
2
© 2022, Amazon Web Services, Inc. or its affiliates. All rights reserved.
What you will learn
At the core of the lesson
You will learn how to:
•
Describe the importance of prevention in the security lifecycle
•
Describe security prevention tasks
•
Use a layered model to build a security prevention strategy
•
List different types of prevention measures
In this lesson, you will learn how to:
•
Describe the importance of prevention in the security lifecycle
•
Describe security prevention tasks
•
Use a layered model to build a security prevention strategy
•
List different types of prevention measures
2
RSSECY EN-US SG M04 PREVENTIONNETHARD
<> of 34+-<->Close
Prevention: Network Hardening
Security Fundamentals
Welcome to Security Lifecycle
–
Prevention: Network Hardening.
Third
-
party links are for educational purposes only. Amazon Web Services (AWS)
takes no responsibility and assumes no liability for the accuracy or accessibility of the
linked content.
2
© 2022, Amazon Web Services, Inc. or its affiliates. All rights reserved.
What you will learn
At the core of the lesson
You will learn how to:
•
Identify network security vulnerabilities
•
List network discovery protection mechanisms
•
Describe network architecture hardening practices
In this lesson, you will learn how to:
•
Identify network security vulnerabilities
•
List network discovery protection mechanisms
•
Describe network architecture hardening practices
2
3
© 2022, Amazon Web Services, Inc. or its affiliates. All rights reserved.
What is network hardening?
•
Network hardening is the activity in the
layered security prevention strategy that
focuses on protecting the network.
•
The goal is to stop the unauthorized
access, misuse, modification, or
destruction of a computer network and
its resources.
•
Network hardening is achieved through
the following:
–
Network discovery hardening
–
Network architecture security
hardening
Security
lifecycle
Prevention
Detection
Response
Analysis
Network hardening
Systems hardening
Data security
Public key infrastructure (PKI)
Identity management
The prevention phase of the security lifecycle provides the opportunity to implement
a layered security prevention strategy.
The first layer of that strategy, network hardening, concerns the protection of a
computer network and its resources from unauthorized access, misuse, modification,
or destruction. It is designed to preserve the usability and integrity of a network and
the data that flows through the network. Network hardening combines
policies
and
procedures
with
hardware
and
software solutions
to achieve this goal.
Network hardening is typically achieved through two primary preventive actions:
network discovery hardening
and
network architecture security
hardening
. You will learn more about these actions in the subsequent sections.
© 2022, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Network security vulnerabilities
Before exploring the different network hardening techniques, it is important to first
understand the types of vulnerabilities that can compromise the security of a
network. This section identifies the main types of threats that a network can be
exposed to.
4
https://docs.aws.amazon.com/inspector/v1/userguide/inspector_network
-
reachability.html
.
14