SlideShare a Scribd company logo
LINUX COURSE DOCUMENT- BUI QUANG LAM - TRAINING 1
Training Course
Linux Fundamentals
Author: Bui Quang Lam
Phone/Zalo: +84.0365.635.598
Mail: buiquanglam185@gmail.com
Day Presentations Lab
Day 1 Introduction
Files and Directories
X
Day 2 Management (User, System, Software)
Networking and Services, Process management & other
X
Day 3,4,5 Assignment activities, divide into group to discuss and Test X
 This course helps you to understand how Linux works from
basics. Once you learn complete this course you can able
to
 Fulfill your regular tasks on the Linux server
 Easily start learning most of the trending technologies like AWS, Azure, GCP, DevOps, Python,
BigData, DataScience, etc...
 Who this course is for
 Any IT professional who wants to learn Linux basics quickly
 People who don't know why to start their DevOps journey.
LINUX COURSE DOCUMENT- BUI QUANG LAM - TRAINING 2
Course Overview
Linux Fundamentals
DAY 2
LINUX COURSE DOCUMENT- BUI QUANG LAM - TRAINING 3
Linux Fundamentals
LINUX COURSE DOCUMENT- BUI QUANG LAM - TRAINING
4
Software Management
• Linux uses software called a package manager to manage the
software installed on the Linux system.
• The package manager will be responsible for installing,
upgrading, configuring and removing previously installed
software on the Linux system.
Linux Fundamentals
LINUX COURSE DOCUMENT- BUI QUANG LAM - TRAINING
5
Software Management
• Software for Linux operating systems will now be packaged into
packages for the purpose of easy distribution and storage. Each
package will include:
 Executable file (binary)
 Software-related information (metadata). For example: software name,
software description, version.
 List of software or support libraries necessary for the operation of the
software (dependencies)
Linux Fundamentals
LINUX COURSE DOCUMENT- BUI QUANG LAM - TRAINING
6
Software Management
• Different Linux operating systems have created different package
formats. Eg:
 .deb: For Linux Debian operating systems such as: Kali Linux, Ubuntu,
Parrot OS, Mint, etc.
 .rpm: For Red Hat Linux operating systems such as: Red Hat, CentOS,
Fedora, etc.
Linux Fundamentals
LINUX COURSE DOCUMENT- BUI QUANG LAM - TRAINING
7
Software Management
• Every Linux operating system will have a list of software
repositories.
• Software repositories are places where you can download
software online to your computer.
• On Kali Linux and Ubuntu, the list of software repositories has
the path /etc/apt/sources.list.
Linux Fundamentals
LINUX COURSE DOCUMENT- BUI QUANG LAM - TRAINING
8
Software Management
• On Debian Linux operating systems, users are provided with
many options for managing packages. For example we have:
 dpkg: manage, install, and remove software from Linux systems. The
drawback of dpkg is that it does not install the dependencies that come
with the software, resulting in faulty and inoperable software.
 To install the software, use the command: dpkg -i <software-name>
 To remove software, use the command: dpkg –remove <software-name>
 To list installed software, use the command: dpkg -l
Linux Fundamentals
LINUX COURSE DOCUMENT- BUI QUANG LAM - TRAINING
9
Software Management
• On Debian Linux operating systems, users are provided with
many options for managing packages. For example we have:
 apt or apt-get: install not only the package, but also the dependencies
that the software needs to run properly.
 In fact, when user uses apt or apt-get to install a package, it will use dpkg
to install the software and apt or apt-get will take care of the
dependencies.
 This is also the most commonly used command to manage packages on
Linux Debian operating systems.
Linux Fundamentals
LINUX COURSE DOCUMENT- BUI QUANG LAM - TRAINING
10
Software Management
 apt or apt-get
 To install the software, use the command: apt install <software-name>
 To remove software, use the command: apt remove <software-name>
 To delete all packages used as dependencies of the software to be deleted, use
the command: apt autoremove <software-name>
 To delete everything related to the software to be deleted, use the command: apt
purge <software-name>
 To list the installed packages we use the command we use the command: apt list
Linux Fundamentals
LINUX COURSE DOCUMENT- BUI QUANG LAM - TRAINING
11
Software Management
Question?
Difference between apt and apt-get?
?
Linux Fundamentals
LINUX COURSE DOCUMENT- BUI QUANG LAM - TRAINING
12
Software Management
• Use the following 3 commands to update and upgrade the software installed
in the Linux system:
• sudo apt update
The apt update command will find and update the latest versions of the
packages in the /etc/apt/sources.list list.
• sudo apt upgrade
The apt upgrade command will rely on the updated /etc/apt/sources.list
list to install the latest versions of the software inside the Linux system.
Linux Fundamentals
LINUX COURSE DOCUMENT- BUI QUANG LAM - TRAINING
13
Software Management
• sudo apt dist-upgrade
• The dist-upgrade command, besides performing the function of the
upgrade command, also updates the latest version for the dependencies
of the updated software.
• Or if there are dependencies that conflict with each other, the dist-
upgrade command will remove these conflicting dependencies.
Linux Fundamentals
LINUX COURSE DOCUMENT- BUI QUANG LAM - TRAINING
14
Task Management
Linux provides us with several tools to manage the tasks running on the system
similar to the Task Manager
ps <options-flag>
• PID (Process ID): The identifier of the process in the system. Each process will carry a
PID and this number is unique. That is, there will never be 2 processes with the same
process at the same time
• TTY (TeleTYpewriter): The name of the terminal that executes the command
• TIME: CPU time needed to process the above process in minutes and seconds
• CMD: Name of the command that started the processs operating system
Linux Fundamentals
LINUX COURSE DOCUMENT- BUI QUANG LAM - TRAINING
15
Task Management
Linux provides us with several tools to manage the tasks running on the system
similar to the Task Manager
• To print out all processes running in the system: ps -e
• To print the task with the PID of the task parent and the UID running the task: ps –ef
 UID: Username running the task
 PPID (Parent PID): ID of the task's parent
 C: Number of CPU cycles used by each task
 STIME: The time the process starts
Linux Fundamentals
LINUX COURSE DOCUMENT- BUI QUANG LAM - TRAINING
16
Task Management
Linux provides us with several tools to manage the tasks running on the system
similar to the Task Manager
• To print all processes running in the system will be displayed as follows: top
• To print all information of all columns: press “f”
• Tick or untick: press “space”
• Quit: press “q” or “ECS”
Linux Fundamentals
LINUX COURSE DOCUMENT- BUI QUANG LAM - TRAINING
17
Editor: Nano & Vim
Editor basic command: echo “Hello World” > Hello.txt
Very difficult to:
• Edit a long text
• Change
• Storage
• Work with other
• Take time
Linux Fundamentals
LINUX COURSE DOCUMENT- BUI QUANG LAM - TRAINING
18
Editor: Nano & Vim
Nano
• Nano is a command-line text editor that comes pre-installed on many Linux
distri.
• Nano is very suitable for those who are just getting started with the command
line interface on Linux.
• Create a file: nano “filename”
• Save and exit: Ctrl + x > Y
• Practice with create a file personal and introduce
yourself!!!
Linux Fundamentals
LINUX COURSE DOCUMENT- BUI QUANG LAM - TRAINING
19
Editor: Nano & Vim
Vim
• Like Nano, Vim is also a pre-installed text editor on many Linux distri
• Vim is somewhat more difficult to use than Nano because you will have to
learn a lot of keyboard shortcuts to be able to manipulate easily on vim.
• Vim is somewhat more popular than Nano
• Create a file: vi “filename” + insert
• Save and exit: esc + wq!
 w: Short for write – Writes content to memory
 q: Short for quit – Quit the Vim program
 ! : Used to force Vim to perform w and q
Linux Fundamentals
LINUX COURSE DOCUMENT- BUI QUANG LAM - TRAINING
20
Editor: Nano & Vim
Bash Scripting
• A Bash scripting is a program written in Bash that is used to perform a certain
task on a Linux system.
• In other words, when you write Bash scripting, you are creating new software
for the Linux system.
• Sometime support Crontab
Linux Fundamentals
LINUX COURSE DOCUMENT- BUI QUANG LAM - TRAINING
21
Editor: Nano & Vim
Bash Scripting
• Simple bash scripting
• Start with #!/bin/bash
• The ending is .sh
• Remember chmod for scripting
• Let’s Practice!!!
#!/bin/bash
name=“Micheal”
echo “My name is $name"
Linux Fundamentals
LINUX COURSE DOCUMENT- BUI QUANG LAM - TRAINING
22
find command in Linux with examples
• The find command in UNIX is a command line utility for walking a file hierarchy.
• It can be used to find files and directories and perform subsequent operations on
them.
• It supports searching by file, folder, name, creation date, modification date, owner
and permissions.
• By using the ‘-exec’ other UNIX commands can be executed on files or folders
found.
Linux Fundamentals
LINUX COURSE DOCUMENT- BUI QUANG LAM - TRAINING
23
find command in Linux with examples
• View folder by: tree
• Find a file or folder: find + “foldername/filename”
Linux Fundamentals
LINUX COURSE DOCUMENT- BUI QUANG LAM - TRAINING
24
SSH
• The SSH protocal (also referred to as Secure Shell) is a method for secure remote login
from one computer to another.
• It provides serveral alternative options for strong authentication and it protect the
communications security and integrity with strong encryption.
Port Number : 22
Daemon : sshd
Conf file : /etc/ssh/ssh_config
Linux Fundamentals
LINUX COURSE DOCUMENT- BUI QUANG LAM - TRAINING
25
SSH
• SSH command: ssh user@destination-ipaddress
• Practice ssh to the ec2-instance (linux server) using Putty or Superputty
Linux Fundamentals
LINUX COURSE DOCUMENT- BUI QUANG LAM - TRAINING
26
Copy file between servers
Windows to Linux
Mobaxterm or winscp
Linux to linux
SCP (secure copy) is a command –line utility that allows you to securely copy files and
directories between two systems.
scp source_file_name username@destination_host:destination_folder
Example: scp file1 root@10.20.30.40:/tmp
scp root@10.20.30.40:/tmp /home/ec2-user/
Linux Fundamentals
LINUX COURSE DOCUMENT- BUI QUANG LAM - TRAINING
27
Copy file between servers
Practice with WinSCP to transfer file between Window and Linux ec2-Instance (AWS)
Requirement
1. ec2-instance
2. Key pair to access ec2-instance
3. Winscp
4. Temporary-file
Now, Let’s practice!!!
Linux Fundamentals
LINUX COURSE DOCUMENT- BUI QUANG LAM - TRAINING
28
File Permissions
Permissions are applied at 3 level
• Owner or User level
• Group level
• Othes level
Permissions are applied in 3 days
• r – Read only
• w – Write/Edit/Append/Delete
• x - Execute/Run
Linux Fundamentals
LINUX COURSE DOCUMENT- BUI QUANG LAM - TRAINING
29
File Permissions
Access modes are different on file and directory
Permissions File Directory
R Open the file ‘ls’ the contents of dir
W Write, edit, append, delete file Add/Del/Rename contents of dir
X To run a command/shell script To enter into dir using ‘cd’
Linux Fundamentals
LINUX COURSE DOCUMENT- BUI QUANG LAM - TRAINING
30
File types
Symbol Type of file
- Normal file
b Block file (Harddisk, Floppy disk)
c Character file (Keyboard, Mouse)
d Directory
| Link files (short cut)
Linux Fundamentals
LINUX COURSE DOCUMENT- BUI QUANG LAM - TRAINING
31
File Permissions
Unix/Linux files have 8 attributes that can be seen with ls –l command
Linux Fundamentals
LINUX COURSE DOCUMENT- BUI QUANG LAM - TRAINING
32
File Permissions
Unix/Linux files have 8 attributes that can be seen with ls –l command
Linux Fundamentals
LINUX COURSE DOCUMENT- BUI QUANG LAM - TRAINING
33
File Permissions
Permission can be set on any file/dir by using two methods:
• Symbolic method (ugo)
• Absolute method (number)
Symbolic method Absolute method
# chmod [who][+/-/=][permissions] file
Who: To whom the permissions to be assigned
Permissions: User/owner (u); group (g); others (o)
Example:
#chmod u=rwx,g=rw,o=r <file_name>
#chmod ugo=rwx <file_name>
We use numbers instead of using symbols
Read – 4
Write – 2
Execute – 1
#chmod 764 <file_name>
#chmod 777 <file_name>
Linux Fundamentals
LINUX COURSE DOCUMENT- BUI QUANG LAM - TRAINING
34
File Permissions
Permission can be set on any file/dir by using two methods:
• Absolute method (number)
Linux Fundamentals
LINUX COURSE DOCUMENT- BUI QUANG LAM - TRAINING
35
User Management
In Linux there are three types of users.
1. Super or root user: User is the most powerful user. He is the administrator user.
2. Sytem user: User created by the softwares or applications.
3. Normal user: Normal users are the users created by root user.
Type Example Home Directory Shell
Super User Root /root /bin/bash
System User ftp, ssh, apache /var/ftp, etc /sbin/nologin
Normal User Visitor, ec2-user /home/username /bin/bash
Linux Fundamentals
LINUX COURSE DOCUMENT- BUI QUANG LAM - TRAINING
36
SELF-STUDY!!!
Linux Fundamentals
LINUX COURSE DOCUMENT- BUI QUANG LAM - TRAINING
37
Link Files
There are 2 types of link files
Soft link and Hard link
Soft link Hard link
SHORTCUT FILE BACKUP FILE
Size of link file is equal to no. of characters in the
name of original file
Size of both file is same
If original file is deleted, link is broken and data is
lost
If orginal file is deleted then also link will
contain data
Command: ln –s <src_file> <dest_file> Command: ln <src_file> <dest_file>
Linux Fundamentals
LINUX COURSE DOCUMENT- BUI QUANG LAM - TRAINING
38
Sed command (Extend)
Stand for stream editor, which is used to search a word in the file and replace it with the word
required to be in the output.
Note: it will only modify the output, but there will be no change in the origin file.
Example:
sed ‘s/old_text/new_text/’ file_name
sed ‘s/old_text/new_text/g’ file_name
sed –I ‘s/old_text/new_text/’ file_name
sed –n ‘5,10p’ file_name
sed ‘10,20d’ file_name
Linux Fundamentals
LINUX COURSE DOCUMENT- BUI QUANG LAM - TRAINING
39
Wget in Linux
• Wget developed by GNU helps you to download the content of a web page or
download files.
• It can be downloaded via FTP, SFTP, HTTP, and HTTPS, it can be used on any
platform like Linux, Windows, MacOS.
Linux Fundamentals
LINUX COURSE DOCUMENT- BUI QUANG LAM - TRAINING
40
DAY 2
SUMMARY

More Related Content

PDF
Linux Training For Beginners | Linux Administration Tutorial | Introduction T...
KEY
Linux beginner's Workshop
PDF
Linux Tutorial For Beginners | Linux Administration Tutorial | Linux Commands...
PDF
PPTX
Samba
PPT
Samba server configuration
ODP
Using samba
PPT
Presentation on samba server & apache server
Linux Training For Beginners | Linux Administration Tutorial | Introduction T...
Linux beginner's Workshop
Linux Tutorial For Beginners | Linux Administration Tutorial | Linux Commands...
Samba
Samba server configuration
Using samba
Presentation on samba server & apache server

What's hot (20)

PPT
Samba
PDF
Linux Interview Questions And Answers | Linux Administration Tutorial | Linux...
PPTX
Presentation on samba server
PPT
Samba server
DOCX
Samba server installation and File sharing
PPTX
Inithub.org presentation
PDF
Linux System Administration Crash Course
PPTX
Samba server configuration
PPTX
Getting Started With CFEngine - Updated Version
PDF
Fosscon2013
PDF
Nelf2012
PPTX
Drupal in Libraries
PDF
Scale13
PDF
Nycbsdcon14
PDF
Vcenter Server Appliance - Testing
PDF
Containerization is more than the new Virtualization: enabling separation of ...
PDF
Samba tutorial
PPTX
linux interview questions and answers
PDF
Docker Security Paradigm
PDF
dotCloud (now Docker) Paas under the_hood
Samba
Linux Interview Questions And Answers | Linux Administration Tutorial | Linux...
Presentation on samba server
Samba server
Samba server installation and File sharing
Inithub.org presentation
Linux System Administration Crash Course
Samba server configuration
Getting Started With CFEngine - Updated Version
Fosscon2013
Nelf2012
Drupal in Libraries
Scale13
Nycbsdcon14
Vcenter Server Appliance - Testing
Containerization is more than the new Virtualization: enabling separation of ...
Samba tutorial
linux interview questions and answers
Docker Security Paradigm
dotCloud (now Docker) Paas under the_hood
Ad

Similar to Linux Day2 (20)

PDF
Linux Day1
PPTX
UNIX/Linux training
PDF
QE-SSP - Lecture 2: Productivity tools: Linux & JupyterLab
PPTX
Linux week 2
PPTX
ITCP PRACTICAL-1.pptx
PPT
PDF
Linux: Everyting-as-a-service
PPTX
Linux Administrator - The Linux Course on Eduonix
PDF
Bn 1027 demo linux adminstration
PPTX
Linux for Beginners
PPTX
Linux.ppt
PPTX
Linux Systems Programming: Ubuntu Installation and Configuration
PPTX
Introduction, Features, Basic Commands and Distribution of LINUX
PPTX
Linuxtraining 130710022121-phpapp01
PPTX
Linux Presentation
PPTX
Network_lecture_for_students_whom_intersted.pptx
PPTX
Chapter 1: Introduction to Command Line
PPTX
Kali Linux-Operating System Presentation.pptx
PPTX
Linux Desktop Operation - Session 1
Linux Day1
UNIX/Linux training
QE-SSP - Lecture 2: Productivity tools: Linux & JupyterLab
Linux week 2
ITCP PRACTICAL-1.pptx
Linux: Everyting-as-a-service
Linux Administrator - The Linux Course on Eduonix
Bn 1027 demo linux adminstration
Linux for Beginners
Linux.ppt
Linux Systems Programming: Ubuntu Installation and Configuration
Introduction, Features, Basic Commands and Distribution of LINUX
Linuxtraining 130710022121-phpapp01
Linux Presentation
Network_lecture_for_students_whom_intersted.pptx
Chapter 1: Introduction to Command Line
Kali Linux-Operating System Presentation.pptx
Linux Desktop Operation - Session 1
Ad

More from Bùi Quang Lâm (9)

PDF
Training AWS: Module 9 - CloudWatch
PDF
Training AWS: Module 8 - RDS, Aurora, ElastiCache
PDF
Training AWS: Module 7 - Route53
PDF
Training AWS: Module 6 - Storage S3 in AWS
PDF
Training AWS: Module 5 - Elastic Load Balancing & ASG
PDF
Training AWS: Module 4 - Storage in AWS
PDF
Training AWS: Module 3 - Networking in AWS
PDF
Training AWS: Module 2 - Computing in AWS
PDF
Training AWS: Module 1 - System Operation in AWS
Training AWS: Module 9 - CloudWatch
Training AWS: Module 8 - RDS, Aurora, ElastiCache
Training AWS: Module 7 - Route53
Training AWS: Module 6 - Storage S3 in AWS
Training AWS: Module 5 - Elastic Load Balancing & ASG
Training AWS: Module 4 - Storage in AWS
Training AWS: Module 3 - Networking in AWS
Training AWS: Module 2 - Computing in AWS
Training AWS: Module 1 - System Operation in AWS

Recently uploaded (20)

PDF
The CXO Playbook 2025 – Future-Ready Strategies for C-Suite Leaders Cerebrai...
PDF
Well-logging-methods_new................
PPTX
additive manufacturing of ss316l using mig welding
PDF
Mitigating Risks through Effective Management for Enhancing Organizational Pe...
PDF
BMEC211 - INTRODUCTION TO MECHATRONICS-1.pdf
PPTX
CYBER-CRIMES AND SECURITY A guide to understanding
PDF
keyrequirementskkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
PDF
PPT on Performance Review to get promotions
PPTX
Artificial Intelligence
PDF
III.4.1.2_The_Space_Environment.p pdffdf
PDF
SM_6th-Sem__Cse_Internet-of-Things.pdf IOT
PPTX
web development for engineering and engineering
PPTX
M Tech Sem 1 Civil Engineering Environmental Sciences.pptx
PDF
PREDICTION OF DIABETES FROM ELECTRONIC HEALTH RECORDS
PPTX
Engineering Ethics, Safety and Environment [Autosaved] (1).pptx
PDF
composite construction of structures.pdf
PPTX
Current and future trends in Computer Vision.pptx
PDF
737-MAX_SRG.pdf student reference guides
PPTX
FINAL REVIEW FOR COPD DIANOSIS FOR PULMONARY DISEASE.pptx
PDF
Automation-in-Manufacturing-Chapter-Introduction.pdf
The CXO Playbook 2025 – Future-Ready Strategies for C-Suite Leaders Cerebrai...
Well-logging-methods_new................
additive manufacturing of ss316l using mig welding
Mitigating Risks through Effective Management for Enhancing Organizational Pe...
BMEC211 - INTRODUCTION TO MECHATRONICS-1.pdf
CYBER-CRIMES AND SECURITY A guide to understanding
keyrequirementskkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
PPT on Performance Review to get promotions
Artificial Intelligence
III.4.1.2_The_Space_Environment.p pdffdf
SM_6th-Sem__Cse_Internet-of-Things.pdf IOT
web development for engineering and engineering
M Tech Sem 1 Civil Engineering Environmental Sciences.pptx
PREDICTION OF DIABETES FROM ELECTRONIC HEALTH RECORDS
Engineering Ethics, Safety and Environment [Autosaved] (1).pptx
composite construction of structures.pdf
Current and future trends in Computer Vision.pptx
737-MAX_SRG.pdf student reference guides
FINAL REVIEW FOR COPD DIANOSIS FOR PULMONARY DISEASE.pptx
Automation-in-Manufacturing-Chapter-Introduction.pdf

Linux Day2

  • 1. LINUX COURSE DOCUMENT- BUI QUANG LAM - TRAINING 1 Training Course Linux Fundamentals Author: Bui Quang Lam Phone/Zalo: +84.0365.635.598 Mail: buiquanglam185@gmail.com Day Presentations Lab Day 1 Introduction Files and Directories X Day 2 Management (User, System, Software) Networking and Services, Process management & other X Day 3,4,5 Assignment activities, divide into group to discuss and Test X
  • 2.  This course helps you to understand how Linux works from basics. Once you learn complete this course you can able to  Fulfill your regular tasks on the Linux server  Easily start learning most of the trending technologies like AWS, Azure, GCP, DevOps, Python, BigData, DataScience, etc...  Who this course is for  Any IT professional who wants to learn Linux basics quickly  People who don't know why to start their DevOps journey. LINUX COURSE DOCUMENT- BUI QUANG LAM - TRAINING 2 Course Overview
  • 3. Linux Fundamentals DAY 2 LINUX COURSE DOCUMENT- BUI QUANG LAM - TRAINING 3
  • 4. Linux Fundamentals LINUX COURSE DOCUMENT- BUI QUANG LAM - TRAINING 4 Software Management • Linux uses software called a package manager to manage the software installed on the Linux system. • The package manager will be responsible for installing, upgrading, configuring and removing previously installed software on the Linux system.
  • 5. Linux Fundamentals LINUX COURSE DOCUMENT- BUI QUANG LAM - TRAINING 5 Software Management • Software for Linux operating systems will now be packaged into packages for the purpose of easy distribution and storage. Each package will include:  Executable file (binary)  Software-related information (metadata). For example: software name, software description, version.  List of software or support libraries necessary for the operation of the software (dependencies)
  • 6. Linux Fundamentals LINUX COURSE DOCUMENT- BUI QUANG LAM - TRAINING 6 Software Management • Different Linux operating systems have created different package formats. Eg:  .deb: For Linux Debian operating systems such as: Kali Linux, Ubuntu, Parrot OS, Mint, etc.  .rpm: For Red Hat Linux operating systems such as: Red Hat, CentOS, Fedora, etc.
  • 7. Linux Fundamentals LINUX COURSE DOCUMENT- BUI QUANG LAM - TRAINING 7 Software Management • Every Linux operating system will have a list of software repositories. • Software repositories are places where you can download software online to your computer. • On Kali Linux and Ubuntu, the list of software repositories has the path /etc/apt/sources.list.
  • 8. Linux Fundamentals LINUX COURSE DOCUMENT- BUI QUANG LAM - TRAINING 8 Software Management • On Debian Linux operating systems, users are provided with many options for managing packages. For example we have:  dpkg: manage, install, and remove software from Linux systems. The drawback of dpkg is that it does not install the dependencies that come with the software, resulting in faulty and inoperable software.  To install the software, use the command: dpkg -i <software-name>  To remove software, use the command: dpkg –remove <software-name>  To list installed software, use the command: dpkg -l
  • 9. Linux Fundamentals LINUX COURSE DOCUMENT- BUI QUANG LAM - TRAINING 9 Software Management • On Debian Linux operating systems, users are provided with many options for managing packages. For example we have:  apt or apt-get: install not only the package, but also the dependencies that the software needs to run properly.  In fact, when user uses apt or apt-get to install a package, it will use dpkg to install the software and apt or apt-get will take care of the dependencies.  This is also the most commonly used command to manage packages on Linux Debian operating systems.
  • 10. Linux Fundamentals LINUX COURSE DOCUMENT- BUI QUANG LAM - TRAINING 10 Software Management  apt or apt-get  To install the software, use the command: apt install <software-name>  To remove software, use the command: apt remove <software-name>  To delete all packages used as dependencies of the software to be deleted, use the command: apt autoremove <software-name>  To delete everything related to the software to be deleted, use the command: apt purge <software-name>  To list the installed packages we use the command we use the command: apt list
  • 11. Linux Fundamentals LINUX COURSE DOCUMENT- BUI QUANG LAM - TRAINING 11 Software Management Question? Difference between apt and apt-get? ?
  • 12. Linux Fundamentals LINUX COURSE DOCUMENT- BUI QUANG LAM - TRAINING 12 Software Management • Use the following 3 commands to update and upgrade the software installed in the Linux system: • sudo apt update The apt update command will find and update the latest versions of the packages in the /etc/apt/sources.list list. • sudo apt upgrade The apt upgrade command will rely on the updated /etc/apt/sources.list list to install the latest versions of the software inside the Linux system.
  • 13. Linux Fundamentals LINUX COURSE DOCUMENT- BUI QUANG LAM - TRAINING 13 Software Management • sudo apt dist-upgrade • The dist-upgrade command, besides performing the function of the upgrade command, also updates the latest version for the dependencies of the updated software. • Or if there are dependencies that conflict with each other, the dist- upgrade command will remove these conflicting dependencies.
  • 14. Linux Fundamentals LINUX COURSE DOCUMENT- BUI QUANG LAM - TRAINING 14 Task Management Linux provides us with several tools to manage the tasks running on the system similar to the Task Manager ps <options-flag> • PID (Process ID): The identifier of the process in the system. Each process will carry a PID and this number is unique. That is, there will never be 2 processes with the same process at the same time • TTY (TeleTYpewriter): The name of the terminal that executes the command • TIME: CPU time needed to process the above process in minutes and seconds • CMD: Name of the command that started the processs operating system
  • 15. Linux Fundamentals LINUX COURSE DOCUMENT- BUI QUANG LAM - TRAINING 15 Task Management Linux provides us with several tools to manage the tasks running on the system similar to the Task Manager • To print out all processes running in the system: ps -e • To print the task with the PID of the task parent and the UID running the task: ps –ef  UID: Username running the task  PPID (Parent PID): ID of the task's parent  C: Number of CPU cycles used by each task  STIME: The time the process starts
  • 16. Linux Fundamentals LINUX COURSE DOCUMENT- BUI QUANG LAM - TRAINING 16 Task Management Linux provides us with several tools to manage the tasks running on the system similar to the Task Manager • To print all processes running in the system will be displayed as follows: top • To print all information of all columns: press “f” • Tick or untick: press “space” • Quit: press “q” or “ECS”
  • 17. Linux Fundamentals LINUX COURSE DOCUMENT- BUI QUANG LAM - TRAINING 17 Editor: Nano & Vim Editor basic command: echo “Hello World” > Hello.txt Very difficult to: • Edit a long text • Change • Storage • Work with other • Take time
  • 18. Linux Fundamentals LINUX COURSE DOCUMENT- BUI QUANG LAM - TRAINING 18 Editor: Nano & Vim Nano • Nano is a command-line text editor that comes pre-installed on many Linux distri. • Nano is very suitable for those who are just getting started with the command line interface on Linux. • Create a file: nano “filename” • Save and exit: Ctrl + x > Y • Practice with create a file personal and introduce yourself!!!
  • 19. Linux Fundamentals LINUX COURSE DOCUMENT- BUI QUANG LAM - TRAINING 19 Editor: Nano & Vim Vim • Like Nano, Vim is also a pre-installed text editor on many Linux distri • Vim is somewhat more difficult to use than Nano because you will have to learn a lot of keyboard shortcuts to be able to manipulate easily on vim. • Vim is somewhat more popular than Nano • Create a file: vi “filename” + insert • Save and exit: esc + wq!  w: Short for write – Writes content to memory  q: Short for quit – Quit the Vim program  ! : Used to force Vim to perform w and q
  • 20. Linux Fundamentals LINUX COURSE DOCUMENT- BUI QUANG LAM - TRAINING 20 Editor: Nano & Vim Bash Scripting • A Bash scripting is a program written in Bash that is used to perform a certain task on a Linux system. • In other words, when you write Bash scripting, you are creating new software for the Linux system. • Sometime support Crontab
  • 21. Linux Fundamentals LINUX COURSE DOCUMENT- BUI QUANG LAM - TRAINING 21 Editor: Nano & Vim Bash Scripting • Simple bash scripting • Start with #!/bin/bash • The ending is .sh • Remember chmod for scripting • Let’s Practice!!! #!/bin/bash name=“Micheal” echo “My name is $name"
  • 22. Linux Fundamentals LINUX COURSE DOCUMENT- BUI QUANG LAM - TRAINING 22 find command in Linux with examples • The find command in UNIX is a command line utility for walking a file hierarchy. • It can be used to find files and directories and perform subsequent operations on them. • It supports searching by file, folder, name, creation date, modification date, owner and permissions. • By using the ‘-exec’ other UNIX commands can be executed on files or folders found.
  • 23. Linux Fundamentals LINUX COURSE DOCUMENT- BUI QUANG LAM - TRAINING 23 find command in Linux with examples • View folder by: tree • Find a file or folder: find + “foldername/filename”
  • 24. Linux Fundamentals LINUX COURSE DOCUMENT- BUI QUANG LAM - TRAINING 24 SSH • The SSH protocal (also referred to as Secure Shell) is a method for secure remote login from one computer to another. • It provides serveral alternative options for strong authentication and it protect the communications security and integrity with strong encryption. Port Number : 22 Daemon : sshd Conf file : /etc/ssh/ssh_config
  • 25. Linux Fundamentals LINUX COURSE DOCUMENT- BUI QUANG LAM - TRAINING 25 SSH • SSH command: ssh user@destination-ipaddress • Practice ssh to the ec2-instance (linux server) using Putty or Superputty
  • 26. Linux Fundamentals LINUX COURSE DOCUMENT- BUI QUANG LAM - TRAINING 26 Copy file between servers Windows to Linux Mobaxterm or winscp Linux to linux SCP (secure copy) is a command –line utility that allows you to securely copy files and directories between two systems. scp source_file_name username@destination_host:destination_folder Example: scp file1 root@10.20.30.40:/tmp scp root@10.20.30.40:/tmp /home/ec2-user/
  • 27. Linux Fundamentals LINUX COURSE DOCUMENT- BUI QUANG LAM - TRAINING 27 Copy file between servers Practice with WinSCP to transfer file between Window and Linux ec2-Instance (AWS) Requirement 1. ec2-instance 2. Key pair to access ec2-instance 3. Winscp 4. Temporary-file Now, Let’s practice!!!
  • 28. Linux Fundamentals LINUX COURSE DOCUMENT- BUI QUANG LAM - TRAINING 28 File Permissions Permissions are applied at 3 level • Owner or User level • Group level • Othes level Permissions are applied in 3 days • r – Read only • w – Write/Edit/Append/Delete • x - Execute/Run
  • 29. Linux Fundamentals LINUX COURSE DOCUMENT- BUI QUANG LAM - TRAINING 29 File Permissions Access modes are different on file and directory Permissions File Directory R Open the file ‘ls’ the contents of dir W Write, edit, append, delete file Add/Del/Rename contents of dir X To run a command/shell script To enter into dir using ‘cd’
  • 30. Linux Fundamentals LINUX COURSE DOCUMENT- BUI QUANG LAM - TRAINING 30 File types Symbol Type of file - Normal file b Block file (Harddisk, Floppy disk) c Character file (Keyboard, Mouse) d Directory | Link files (short cut)
  • 31. Linux Fundamentals LINUX COURSE DOCUMENT- BUI QUANG LAM - TRAINING 31 File Permissions Unix/Linux files have 8 attributes that can be seen with ls –l command
  • 32. Linux Fundamentals LINUX COURSE DOCUMENT- BUI QUANG LAM - TRAINING 32 File Permissions Unix/Linux files have 8 attributes that can be seen with ls –l command
  • 33. Linux Fundamentals LINUX COURSE DOCUMENT- BUI QUANG LAM - TRAINING 33 File Permissions Permission can be set on any file/dir by using two methods: • Symbolic method (ugo) • Absolute method (number) Symbolic method Absolute method # chmod [who][+/-/=][permissions] file Who: To whom the permissions to be assigned Permissions: User/owner (u); group (g); others (o) Example: #chmod u=rwx,g=rw,o=r <file_name> #chmod ugo=rwx <file_name> We use numbers instead of using symbols Read – 4 Write – 2 Execute – 1 #chmod 764 <file_name> #chmod 777 <file_name>
  • 34. Linux Fundamentals LINUX COURSE DOCUMENT- BUI QUANG LAM - TRAINING 34 File Permissions Permission can be set on any file/dir by using two methods: • Absolute method (number)
  • 35. Linux Fundamentals LINUX COURSE DOCUMENT- BUI QUANG LAM - TRAINING 35 User Management In Linux there are three types of users. 1. Super or root user: User is the most powerful user. He is the administrator user. 2. Sytem user: User created by the softwares or applications. 3. Normal user: Normal users are the users created by root user. Type Example Home Directory Shell Super User Root /root /bin/bash System User ftp, ssh, apache /var/ftp, etc /sbin/nologin Normal User Visitor, ec2-user /home/username /bin/bash
  • 36. Linux Fundamentals LINUX COURSE DOCUMENT- BUI QUANG LAM - TRAINING 36 SELF-STUDY!!!
  • 37. Linux Fundamentals LINUX COURSE DOCUMENT- BUI QUANG LAM - TRAINING 37 Link Files There are 2 types of link files Soft link and Hard link Soft link Hard link SHORTCUT FILE BACKUP FILE Size of link file is equal to no. of characters in the name of original file Size of both file is same If original file is deleted, link is broken and data is lost If orginal file is deleted then also link will contain data Command: ln –s <src_file> <dest_file> Command: ln <src_file> <dest_file>
  • 38. Linux Fundamentals LINUX COURSE DOCUMENT- BUI QUANG LAM - TRAINING 38 Sed command (Extend) Stand for stream editor, which is used to search a word in the file and replace it with the word required to be in the output. Note: it will only modify the output, but there will be no change in the origin file. Example: sed ‘s/old_text/new_text/’ file_name sed ‘s/old_text/new_text/g’ file_name sed –I ‘s/old_text/new_text/’ file_name sed –n ‘5,10p’ file_name sed ‘10,20d’ file_name
  • 39. Linux Fundamentals LINUX COURSE DOCUMENT- BUI QUANG LAM - TRAINING 39 Wget in Linux • Wget developed by GNU helps you to download the content of a web page or download files. • It can be downloaded via FTP, SFTP, HTTP, and HTTPS, it can be used on any platform like Linux, Windows, MacOS.
  • 40. Linux Fundamentals LINUX COURSE DOCUMENT- BUI QUANG LAM - TRAINING 40 DAY 2 SUMMARY