0% found this document useful (0 votes)
11 views

Training Linux - 1

The document provides an overview of a Linux fundamentals training course. The course covers Linux basics like files, directories, users, and networking over multiple days. It also discusses key Linux concepts and commands.

Uploaded by

Nguyễn Tùng
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
11 views

Training Linux - 1

The document provides an overview of a Linux fundamentals training course. The course covers Linux basics like files, directories, users, and networking over multiple days. It also discusses key Linux concepts and commands.

Uploaded by

Nguyễn Tùng
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 41

Training Course

Linux Fundamentals

2/6/2023 09e-BM/DT/FSOFT - ©FPT SOFTWARE – Fresher Academy - Internal Use 1


Course Overview
▪ 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.

2/6/2023 09e-BM/DT/FSOFT - ©FPT SOFTWARE – Fresher Academy - Internal Use 2


Course Schedule

Day Presentations Lab


Day 1 Introduction X
Files and Directories
Day 2 Management (User, System, Software) X
Networking and Services, Process management & other
Day 3,4,5 Assignment activities, divide into group to discuss and Test X

2/6/2023 09e-BM/DT/FSOFT - ©FPT SOFTWARE – Fresher Academy - Internal Use 3


Linux Fundamentals

What is Operating System?

2/6/2023 09e-BM/DT/FSOFT - ©FPT SOFTWARE – Fresher Academy - Internal Use 4


Linux Fundamentals

OS is an interface between user and the


computer hardware

2/6/2023 09e-BM/DT/FSOFT - ©FPT SOFTWARE – Fresher Academy - Internal Use 5


Linux Fundamentals
How It Works
User

Don’t know what are Operating System


you talking

Hardware

2/6/2023 09e-BM/DT/FSOFT - ©FPT SOFTWARE – Fresher Academy - Internal Use 6


Linux Fundamentals

Operating Systems
• Window
• OS X (MAC OS)
• IBM-AIX
• HP-UX
• Solaris
• Linux
+ RedHat, Ubuntu, fedora, Suse,
Debian, cent, etc…

2/6/2023 09e-BM/DT/FSOFT - ©FPT SOFTWARE – Fresher Academy - Internal Use 7


Linux Fundamentals

Internet

Server

2/6/2023 09e-BM/DT/FSOFT - ©FPT SOFTWARE – Fresher Academy - Internal Use 8


Linux Fundamentals

How to get a Linux System

• Install Linux OS directly in Laptop or Desktop


• Install Vmware and create a VM
• Install Virtual Box and Create VM
• Provision a Linux VM on Cloud (AWS/Azure/GCP etc..)

2/6/2023 09e-BM/DT/FSOFT - ©FPT SOFTWARE – Fresher Academy - Internal Use 9


Linux Fundamentals

Why Linux

• Free
• Stability
• Secure
• Community Support

2/6/2023 09e-BM/DT/FSOFT - ©FPT SOFTWARE – Fresher Academy - Internal Use 10


Linux Fundamentals
Why Linux – Hardware requirements
Task Memory (MB) Hard Disk (MB)

Smallest task: text UI, shell 8 200


commad: vim, emacs, …
Graphic UI, small management : 32 400
icewm, fluxbox, windowmaker

KDE graphic enviroments 128 1000

Application use more memorry 256 1500

2/6/2023 09e-BM/DT/FSOFT - ©FPT SOFTWARE – Fresher Academy - Internal Use 11


Linux Fundamentals
How to get Linux?

✓ CD/DVD
✓ Community
✓ Internet: Linux.org (official)

2/6/2023 09e-BM/DT/FSOFT - ©FPT SOFTWARE – Fresher Academy - Internal Use 12


Linux Fundamentals

Linux Architecture

2/6/2023 09e-BM/DT/FSOFT - ©FPT SOFTWARE – Fresher Academy - Internal Use 13


Linux Fundamentals

Question
What is different between Linux and Ubuntu?

2/6/2023 09e-BM/DT/FSOFT - ©FPT SOFTWARE – Fresher Academy - Internal Use 14


Linux Fundamentals
Linux is kernel, core of OS
Ubuntu

Linux Mint
Linux OS
Linux kernel Fedora
• No terminal
• No GUI
• No app RedHat
• No driver
Linux Distribution
2/6/2023 09e-BM/DT/FSOFT - ©FPT SOFTWARE – Fresher Academy - Internal Use 15
Linux Fundamentals
Create Linux Environment (DEMO

• Install Virtualbox/Vmware
• Download Linux OS (.iso)
• Create Linux Machine

2/6/2023 09e-BM/DT/FSOFT - ©FPT SOFTWARE – Fresher Academy - Internal Use 16


Linux Fundamentals

Linux User

2/6/2023 09e-BM/DT/FSOFT - ©FPT SOFTWARE – Fresher Academy - Internal Use 17


Linux Fundamentals
Linux User Commands
Command Description
cat /etc/passwd List user
sudo Adduser “username” Create a user with name “username”
sudo passwd username Set password for user “username”
sudo userdel username Delete a user account
groups List all group
sugrodo addgroup “groupname” Add a group
sudo usermod –a –G “namegroup” “username” Add user to a group
sudo chage –E YYYY-MM-DD “username” Setting the expiry date of a Account

2/6/2023 09e-BM/DT/FSOFT - ©FPT SOFTWARE – Fresher Academy - Internal Use 18


Linux Fundamentals

Linux Filesystem Hierarchy

2/6/2023 09e-BM/DT/FSOFT - ©FPT SOFTWARE – Fresher Academy - Internal Use 19


Linux Fundamentals
Linux Filesystem Hierarchy

2/6/2023 09e-BM/DT/FSOFT - ©FPT SOFTWARE – Fresher Academy - Internal Use 20


Linux Fundamentals
Linux Filesystem Hierarchy
Directory Name Description
/ This is top level directory
It is parent directory for all other directories
It is called as ROOT directory
It is represented by forward slash (/)
C:\ of windows
/root It is home directory for root user (super user)
It is provides working environment for root user
C:\Documents and Settings\Administrator
/home It is home directory for other users
It provide working environment for other users (other than
root)
C:\Documents and Settings\username

2/6/2023 09e-BM/DT/FSOFT - ©FPT SOFTWARE – Fresher Academy - Internal Use 21


Linux Fundamentals
Linux Filesystem Hierarchy
Directory Name Description

/usr By default softwares are installed in /usr directory


(UNIX Sharable Resources) c:\program files
/bin It contains commands used by all users (Binary files)

/sbin It contains commands used by only Super User (root)


(Super user’s binary files)
/var It is containing variables data like mails, log file

2/6/2023 09e-BM/DT/FSOFT - ©FPT SOFTWARE – Fresher Academy - Internal Use 22


Linux Fundamentals
Linux Basic Commands
Command Description
date Show the current date and time
cal Show this month’s calendar
uptime Show the current uptime
whoami Who you are logged in as
finger Display information about user (Will not work)
users Shows user information
man “command” Show manual of command
username Shows your user name
Who / w Display who is online
2/6/2023 09e-BM/DT/FSOFT - ©FPT SOFTWARE – Fresher Academy - Internal Use 23
Linux Fundamentals
View files
Command Description
ls Directory listing
cat “filename” View file content
less View a file page by page
more Output the contents of file
head Output the first 10 lines of file
tail Output the last 10 lines of file
page Display file page by page

2/6/2023 09e-BM/DT/FSOFT - ©FPT SOFTWARE – Fresher Academy - Internal Use 24


Linux Fundamentals
Create & Delete file/directory
Command Description
touch Create a 0 bites file
cat > filename Create file and allow to write
nano Create a file if filename doesn’t exist
vi Create a file if filename doesn’t exist (wq! – save)
rm Remove a file
mkdir Create a directory
rmdir Remove a empty directory
rm –rf Remove a directory

2/6/2023 09e-BM/DT/FSOFT - ©FPT SOFTWARE – Fresher Academy - Internal Use 25


Linux Fundamentals
Managing files or directories
Command Description
cp Copy a file
mv Move a file
find Find a file
grep Search for a pattern in a file
Cdcd Switch between directories
diff Find content difference in 2 files
sed Search and replace particular pattern
chmod Change file permissions
chown Change Ownership of a file
file Show what kind of file it is
2/6/2023 26
09e-BM/DT/FSOFT - ©FPT SOFTWARE – Fresher Academy - Internal Use
Linux Fundamentals
System Management
Command Description
history List all commands executed by a user
free Free memory of a server
/proc/meminfo Displays memory information
/proc/cpuinfo Displays CPU information
uname –a Show kernel information
du Show directory space usage (log mangement)
whereis Show possible locations of app
which Show which app will be run by default

2/6/2023 27
09e-BM/DT/FSOFT - ©FPT SOFTWARE – Fresher Academy - Internal Use
Linux Fundamentals
Networking

Command Description
hostname List host name of the server
ping <ip> Availability of destination server over the network
wget Download packages/software into Linux system
ifconfig Lists IP address(es) of the server
telnet Connect to remote host/check port availability status
curl Access the application as from browser

2/6/2023 28
09e-BM/DT/FSOFT - ©FPT SOFTWARE – Fresher Academy - Internal Use
Linux Fundamentals
Port Numbers
Port Service
Number
21 FTP
22 SSH
23 TELNET
25 SMTP
53 DNS
80 HTTP
443 HTTPS

2/6/2023 29
09e-BM/DT/FSOFT - ©FPT SOFTWARE – Fresher Academy - Internal Use
Linux Fundamentals
Software Management
yum is the primary tool for getting, installing, deleting, querying and managing RetHat
Enterprise Linux RPM software packages from official RedHat software repositories, as well as
other third-party repositories

Commands:
▪ yum install <package name>
▪ yum remove <package name>
▪ yum update <package name>
▪ yum info <package name>
▪ yum list available
▪ yum list installed

EXTEND: apt
2/6/2023 09e-BM/DT/FSOFT - ©FPT SOFTWARE – Fresher Academy - Internal Use 30
Linux Fundamentals
Services
service – This controls the starting and stopping of services
chkconfig – This controls which services are set to start on boot

• apt list
• ps –ef / ps –ef | grep “servicename”

#service <name of the service> status --- To check the status of the service
#service <name of the service> start --- To start the service
#service <name of the service> stop --- To stop the service
#service <name of the service> reload --- To reload the service
#service <name of the service> restart --- To restart the service

2/6/2023 09e-BM/DT/FSOFT - ©FPT SOFTWARE – Fresher Academy - Internal Use 31


Linux Fundamentals
Services

The above commands are useful for starting or stopping services during the
current session. To tell system to start services automatically at boot, you
must enable them

#systemctl enable “servicename”


#systemctl disable “servicename”

Nginx run (session) > out session > nginx stop


Nginx run (session) > enable > out session > nginx
start

2/6/2023 09e-BM/DT/FSOFT - ©FPT SOFTWARE – Fresher Academy - Internal Use 32


Linux Fundamentals
Process Management
• When you start a program or running an application in Linux, it actually run as a
process
• A Linux process (a daemon), running in foreground or in the background, uses
memory and CPU resources

Command Description
ps –ef List the process which are running in the system
kill / kill -9 Kill a process or service
fg Run the program in the f
bg Run the service in the back group
top List top 20 process which are consuming more
CPU
2/6/2023 33
09e-BM/DT/FSOFT - ©FPT SOFTWARE – Fresher Academy - Internal Use
Linux Fundamentals
Networking
IP Address: An IP address can be thought of as being similar to a phone number. Just as every
person who communicates with a telephone is using a phone with a unique phone number,
every computer that is on the Internet has a unique IP address. Not only on internet but within
an organization every computer is assigned an IP address so that they can communicate with
each other.

Command: ifconfig –a (get network info)


ip addr

2/6/2023 09e-BM/DT/FSOFT - ©FPT SOFTWARE – Fresher Academy - Internal Use 34


Linux Fundamentals
Networking

Command Description
netstat Display all connected network
nslookup Query domain address

2/6/2023 35
09e-BM/DT/FSOFT - ©FPT SOFTWARE – Fresher Academy - Internal Use
Linux Fundamentals
Runlevels (discuss)
Looks at the /etc/inittab file to decide the Linux run level.
Following are the available run levels

• 0 – halt
• 1 – Single user mode
• 2 – Multiuser, without NFS
• 3 – Full multiuser mode
• 4 – Unused
• 5 – X11
• 6 – reboot

2/6/2023 09e-BM/DT/FSOFT - ©FPT SOFTWARE – Fresher Academy - Internal Use 36


Linux Fundamentals
Archiving files or directories

Command Description
gzip Create a compressed file
gunzip Unzip a file

tar Extract tar file

2/6/2023 37
09e-BM/DT/FSOFT - ©FPT SOFTWARE – Fresher Academy - Internal Use
Linux Fundamentals
Crontab
In any operating system, it is possible to create jobs that you want to reoccur. This process known as
job scheduling, is usually done based on user-defind jobs. For RedHat or any other Linux, this process
is handled by the cron service or a daemon called crond, which can be used to schedule tasks

Commands: Field Description Allowed Value


crontab –l (list)
crontab –e (edit) MIN Minute field 0 to 59
HOUR Hour field 0 to 23
DOM Day of the month 1-31
MON Month field 1-12
DOW Day of the week 0-6
CMD Any command

2/6/2023 38
09e-BM/DT/FSOFT - ©FPT SOFTWARE – Fresher Academy - Internal Use
Linux Fundamentals
Crontab Examples
minute | hour | day(month) | month | day(week) | CMD
Execute a job at 8:30 on everyday morning
30 8 * * * Command
Execute a job at 2:00 PM on every Saturday
00 14 * * 6 Command
Execute a job at 12:00 AM on 1st July
00 00 01 07 * Command
Execute a job at 3:30 PM on Every month 25th
30 15 25 * * Command

2/6/2023 39
09e-BM/DT/FSOFT - ©FPT SOFTWARE – Fresher Academy - Internal Use
Linux Fundamentals

DAY 1
SUMMARY

2/6/2023 40
09e-BM/DT/FSOFT - ©FPT SOFTWARE – Fresher Academy - Internal Use
Thank you

2/6/2023 09e-BM/DT/FSOFT - ©FPT SOFTWARE – Fresher Academy - Internal Use 41

You might also like