mirror of
https://github.com/linkedin/school-of-sre
synced 2026-01-03 07:08:02 +00:00
Merge pull request #29 from linkedin/spremraj/linux-review
Linux module review
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
# Conclusion
|
||||
|
||||
With this we have covered the basics of linux operating systems along with basic commands
|
||||
which are used in linux. We have also covered the linux server administration commands.
|
||||
We have covered the basics of Linux operating systems and basic commands used in linux.
|
||||
We have also covered the Linux server administration commands.
|
||||
|
||||
We hope that this course will make it easier for you to operate on the command line.
|
||||
|
||||
|
||||
@@ -2,30 +2,30 @@
|
||||
|
||||
## Prerequisites
|
||||
|
||||
- Experience of working on any operating systems like Windows, Linux or Mac
|
||||
- Basics of operating system
|
||||
- Comfortable using any operating systems like Windows, Linux or Mac
|
||||
- Fundamental knowledge of operating systems
|
||||
|
||||
## What to expect from this course
|
||||
|
||||
This course is divided into three parts. In the first part, we will cover the
|
||||
fundamentals of linux operating systems. We will talk about linux architecture,
|
||||
linux distributions and uses of linux operating systems. We will also talk about
|
||||
This course is divided into three parts. In the first part, we cover the
|
||||
fundamentals of Linux operating systems. We will talk about Linux architecture,
|
||||
Linux distributions and uses of Linux operating systems. We will also talk about the
|
||||
difference between GUI and CLI.
|
||||
|
||||
In the second part, we will study about some of the basic commands that are used
|
||||
in linux. We will focus on commands used for navigating file system, commands used
|
||||
for manipulating files, commands used for viewing files, I/O redirection etc.
|
||||
In the second part, we cover some basic commands used in Linux.
|
||||
We will focus on commands used for navigating the file system, viewing and manipulating files,
|
||||
I/O redirection etc.
|
||||
|
||||
In the third part, we will study about linux system administration. In this part, we
|
||||
will focus on day to day tasks performed by linux admins like managing users/groups,
|
||||
managing file permissions, monitoring system performance, log files etc.
|
||||
In the third part, we cover Linux system administration. This includes day to day tasks
|
||||
performed by Linux admins, like managing users/groups, managing file permissions,
|
||||
monitoring system performance, log files etc.
|
||||
|
||||
In the second and third part, we will be taking examples to understand the concepts.
|
||||
|
||||
## What is not covered under this course
|
||||
|
||||
We are not covering advanced linux commands and bash scripting in this
|
||||
course. We will also not be covering linux internals.
|
||||
We are not covering advanced Linux commands and bash scripting in this
|
||||
course. We will also not be covering Linux internals.
|
||||
|
||||
## Course Contents
|
||||
|
||||
@@ -64,16 +64,18 @@ The following topics has been covered in this course:
|
||||
|
||||
## What are Linux operating systems
|
||||
|
||||
Most of us will be familiar with the windows operating system which is
|
||||
used in more than 75% of the personal computers. The windows operating systems
|
||||
are based on windows NT kernel. A kernel is the most important part of
|
||||
an operating system which performs important functions like process
|
||||
Most of us are familiar with the Windows operating system used in more than
|
||||
75% of the personal computers. The Windows operating systems
|
||||
are based on Windows NT kernel.
|
||||
|
||||
A kernel is the most important part of
|
||||
an operating system - it performs important functions like process
|
||||
management, memory management, filesystem management etc.
|
||||
|
||||
Linux operating systems are based on the Linux kernel. A linux based
|
||||
operating system will consist of linux kernel, GUI/CLI, system libraries
|
||||
Linux operating systems are based on the Linux kernel. A Linux based
|
||||
operating system will consist of Linux kernel, GUI/CLI, system libraries
|
||||
and system utilities. The Linux kernel was independently developed and
|
||||
released by Linus Torvalds. The linux kernel is free and open-source -
|
||||
released by Linus Torvalds. The Linux kernel is free and open-source -
|
||||
[https://github.com/torvalds/linux](https://github.com/torvalds/linux)
|
||||
|
||||
History of Linux -
|
||||
@@ -81,12 +83,12 @@ History of Linux -
|
||||
|
||||
## What are popular Linux distributions
|
||||
|
||||
A linux distribution(distro) is an operating system that is based on
|
||||
the linux kernel and a package management system. A package management
|
||||
system consists of tools that helps in installing, upgrading,
|
||||
A Linux distribution(distro) is an operating system based on
|
||||
the Linux kernel and a package management system. A package management
|
||||
system consists of tools that help in installing, upgrading,
|
||||
configuring and removing softwares on the operating system.
|
||||
|
||||
Softwares are usually adopted to a distribution and are packaged in a
|
||||
Software are usually adopted to a distribution and are packaged in a
|
||||
distro specific format. These packages are available through a distro
|
||||
specific repository. Packages are installed and managed in the operating
|
||||
system by a package manager.
|
||||
@@ -119,7 +121,7 @@ system by a package manager.
|
||||
|
||||
- The Linux kernel is monolithic in nature.
|
||||
|
||||
- System calls are used to interact with the linux kernel space.
|
||||
- System calls are used to interact with the Linux kernel space.
|
||||
|
||||
- Kernel code can only be executed in the kernel mode. Non-kernel code is executed in the user mode.
|
||||
|
||||
@@ -127,13 +129,13 @@ system by a package manager.
|
||||
|
||||
## Uses of Linux Operating Systems
|
||||
|
||||
Operating system based on linux kernel are widely used in:
|
||||
Operating system based on Linux kernel are widely used in:
|
||||
|
||||
- Personal computers
|
||||
|
||||
- Servers
|
||||
|
||||
- Mobile phones - Android is based on linux operating system
|
||||
- Mobile phones - Android is based on Linux operating system
|
||||
|
||||
- Embedded devices - watches, televisions, traffic lights etc
|
||||
|
||||
@@ -159,10 +161,10 @@ to perform a particular operation.
|
||||
|
||||
## Shell vs Terminal
|
||||
|
||||
Shell is a program that takes command or a group of commands from the
|
||||
Shell is a program that takes commands from the
|
||||
users and gives them to the operating system for processing. Shell is an
|
||||
example of command line interface. Bash is one of the most popular shell
|
||||
programs available on linux servers. Other popular shell programs are
|
||||
example of a CLI(command line interface). Bash is one of the most popular shell
|
||||
programs available on Linux servers. Other popular shell programs are
|
||||
zsh, ksh and tcsh.
|
||||
|
||||
Terminal is a program that opens a window and lets you interact with the
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
In this course will try to cover some of the common tasks that a linux
|
||||
server administrator performs. We will first try to understand what a
|
||||
particular command does and then try to understand the commands using
|
||||
examples. Do keep in mind that it's very important to practice the linux
|
||||
examples. Do keep in mind that it's very important to practice the Linux
|
||||
commands on your own.
|
||||
|
||||
## Lab Environment Setup
|
||||
@@ -14,20 +14,20 @@ commands on your own.
|
||||
|
||||

|
||||
|
||||
- We will run most of the commands used in this module in the above docker container.
|
||||
- We will run most of the commands used in this module in the above Docker container.
|
||||
|
||||
## Multi-User Operating Systems
|
||||
|
||||
An operating system is considered as multi-user if it allows multiple people/users to use a computer and not affect each other files and preferences. Linux based operating systems are multi-user in nature as it allows multiple users to access the system at the same time. A typical computer will only have one keyboard and monitor but multiple users can log in via ssh if the computer is connected to the network. We will cover more about ssh later.
|
||||
An operating system is considered as multi-user if it allows multiple people/users to use a computer and not affect each other's files and preferences. Linux based operating systems are multi-user in nature as it allows multiple users to access the system at the same time. A typical computer will only have one keyboard and monitor but multiple users can log in via SSH if the computer is connected to the network. We will cover more about SSH later.
|
||||
|
||||
As a server administrator, we are mostly concerned with the linux servers which are physically present at a very large distance from us. We can connect to these servers with the help of remote login methods like ssh.
|
||||
As a server administrator, we are mostly concerned with the Linux servers which are physically present at a very large distance from us. We can connect to these servers with the help of remote login methods like SSH.
|
||||
|
||||
Since linux supports multiple users, we need to have a method which can protect the users from each other. One user should not be able to access and modify files of other users
|
||||
Since Linux supports multiple users, we need to have a method which can protect the users from each other. One user should not be able to access and modify files of other users
|
||||
|
||||
|
||||
## User/Group Management
|
||||
|
||||
- Each user in linux has an associated user ID called UID attached to him
|
||||
- Each user in Linux has an associated user ID called UID attached to him
|
||||
|
||||
- Each user also has a home directory and a login shell associated with him/her
|
||||
|
||||
@@ -37,13 +37,13 @@ Since linux supports multiple users, we need to have a method which can protect
|
||||
|
||||
### id command
|
||||
|
||||
id command can be used to find the uid and gid associated with an user.
|
||||
`id` command can be used to find the uid and gid associated with an user.
|
||||
It also lists down the groups to which the user belongs to.
|
||||
|
||||
The uid and gid associated with the root user is 0.
|
||||

|
||||
|
||||
A good way to find out the current user in linux is to use the whoami
|
||||
A good way to find out the current user in Linux is to use the whoami
|
||||
command.
|
||||
|
||||

|
||||
@@ -74,19 +74,19 @@ through below links:
|
||||
## Important commands for managing users
|
||||
|
||||
Some of the commands which are used frequently to manage users/groups
|
||||
on linux are following:
|
||||
on Linux are following:
|
||||
|
||||
- useradd - Creates a new user
|
||||
- `useradd` - Creates a new user
|
||||
|
||||
- passwd - Adds or modifies passwords for a user
|
||||
- `passwd` - Adds or modifies passwords for a user
|
||||
|
||||
- usermod - Modifies attributes of an user
|
||||
- `usermod` - Modifies attributes of an user
|
||||
|
||||
- userdel - Deletes an user
|
||||
- `userdel` - Deletes an user
|
||||
|
||||
### useradd
|
||||
|
||||
The useradd command adds a new user in linux.
|
||||
The useradd command adds a new user in Linux.
|
||||
|
||||
We will create a new user 'shivam'. We will also verify that the user
|
||||
has been created by tailing the /etc/passwd file. The uid and gid are
|
||||
@@ -141,7 +141,7 @@ Try 'usermod -h' for a list of attributes you can modify.
|
||||
|
||||
### userdel
|
||||
|
||||
The userdel command is used to remove a user on linux. Once we remove a
|
||||
The userdel command is used to remove a user on Linux. Once we remove a
|
||||
user, all the information related to that user will be removed.
|
||||
|
||||
Let's try to delete the user "amit". After deleting the user, you will
|
||||
@@ -172,7 +172,7 @@ We will now try to add user "shivam" to the group we have created above.
|
||||
password for user "shivam" and user "root" using the passwd command
|
||||
described in the above section.**
|
||||
|
||||
The su command can be used to switch users in linux. Let's now try to
|
||||
The su command can be used to switch users in Linux. Let's now try to
|
||||
switch to user "shivam".
|
||||
|
||||

|
||||
@@ -182,7 +182,7 @@ Let's now try to open the "/etc/shadow" file.
|
||||

|
||||
|
||||
The operating system didn't allow the user "shivam" to read the content
|
||||
of the "/etc/shadow" file. This is an important file in linux which
|
||||
of the "/etc/shadow" file. This is an important file in Linux which
|
||||
stores the passwords of users. This file can only be accessed by root or
|
||||
users who have the superuser privileges.
|
||||
|
||||
@@ -224,7 +224,7 @@ commands from anywhere.
|
||||
|
||||
One easy way of providing root access to users is to add them to a group
|
||||
which has permissions to run all the commands. "wheel" is a group in
|
||||
redhat linux with such privileges.
|
||||
redhat Linux with such privileges.
|
||||
|
||||

|
||||
|
||||
@@ -245,7 +245,7 @@ to user “shivam” by adding him to the group “wheel”.
|
||||
|
||||
## File Permissions
|
||||
|
||||
On a linux operating system, each file and directory is assigned access
|
||||
On a Linux operating system, each file and directory is assigned access
|
||||
permissions for the owner of the file, the members of a group of related
|
||||
users and everybody else. This is to make sure that one user is not
|
||||
allowed to access the files and resources of another user.
|
||||
@@ -266,7 +266,7 @@ related to file permissions.
|
||||
### Chmod command
|
||||
|
||||
The chmod command is used to modify files and directories permissions in
|
||||
linux.
|
||||
Linux.
|
||||
|
||||
The chmod command accepts permissions in as a numerical argument. We can
|
||||
think of permission as a series of bits with 1 representing True or
|
||||
@@ -299,7 +299,7 @@ in the similar way.
|
||||
### Chown command
|
||||
|
||||
The chown command is used to change the owner of files or
|
||||
directories in linux.
|
||||
directories in Linux.
|
||||
|
||||
Command syntax: chown \<new_owner\> \<file_name\>
|
||||
|
||||
@@ -318,7 +318,7 @@ similar way.
|
||||
### Chgrp command
|
||||
|
||||
The chgrp command can be used to change the group ownership of files or
|
||||
directories in linux. The syntax is very similar to that of chown
|
||||
directories in Linux. The syntax is very similar to that of chown
|
||||
command.
|
||||
|
||||

|
||||
@@ -412,7 +412,7 @@ General syntax: scp \<source\> \<destination\>
|
||||
## Package Management
|
||||
|
||||
Package management is the process of installing and managing software on
|
||||
the system. We can install the packages which we require from the linux
|
||||
the system. We can install the packages which we require from the Linux
|
||||
package distributor. Different distributors use different packaging
|
||||
systems.
|
||||
|
||||
@@ -433,7 +433,7 @@ systems.
|
||||
[DNF](https://docs.fedoraproject.org/en-US/quick-docs/dnf/) is
|
||||
the successor to YUM which is now used in Fedora for installing and
|
||||
managing packages. DNF may replace YUM in the future on all RPM based
|
||||
linux distributions.
|
||||
Linux distributions.
|
||||
|
||||

|
||||
|
||||
@@ -450,7 +450,7 @@ httpd package.
|
||||
## Process Management
|
||||
|
||||
In this section, we will study about some useful commands that can be
|
||||
used to monitor the processes on linux systems.
|
||||
used to monitor the processes on Linux systems.
|
||||
|
||||
### ps (process status)
|
||||
|
||||
@@ -482,7 +482,7 @@ processes.
|
||||
|
||||
### top
|
||||
|
||||
The top command is used to show information about linux processes
|
||||
The top command is used to show information about Linux processes
|
||||
running on the system in real time. It also shows a summary of the
|
||||
system information.
|
||||
|
||||
@@ -521,7 +521,7 @@ additional information about io and cpu usage.
|
||||
## Checking Disk Space
|
||||
|
||||
In this section, we will study about some useful commands that can be
|
||||
used to view disk space on linux.
|
||||
used to view disk space on Linux.
|
||||
|
||||
### df (disk free)
|
||||
|
||||
@@ -581,7 +581,7 @@ used to start/stop/restart the services managed by systemd.
|
||||
|
||||
In this section, we will talk about some important files and directories
|
||||
which can be very useful for viewing system logs and applications logs
|
||||
in linux. These logs can be very useful when you are troubleshooting on
|
||||
in Linux. These logs can be very useful when you are troubleshooting on
|
||||
the system.
|
||||
|
||||

|
||||
|
||||
Reference in New Issue
Block a user