02 IntroLinux
02 IntroLinux
4.0
fit@hcmus
Unix
Unix was originally developed in 1969 by Ken
Thompson, Dennis Ritchie, … at Bell Labs.
Mainly used for scientific-technical applications on
mainframes and workstations, but has become,
because of Linux, also popular for classical PC-
applications throughout the last years.
Is perfectly suited for application in networks. Larger
systems and networks require an administrator.
Offers various alternatives for the solution of most
tasks. The multitude of commands (more than in any
other OS) are brief and flexible.
Is originally command-line oriented, but can be used
via a graphical user interface
2
Unix Architecture
Kernel: The kernel is the heart
of the OS. It interacts with the
hardware and most of the
important tasks.
Shell: The shell is the utility that
processes your requests. When
you type in a command at your
terminal, the shell interprets the
command and calls the program
that you want.
Commands and Utilities:
There are various commands
and utilities which you can make
use
Files and Directories: all the
data of Unix is organized into
files. All files are then organized
into directories. 3
Linux
Linus devised a kernel named Linux in 1991.
(Lacking programs like File Manager, Document
Editors, Audio-Video programs)
He collaborated with other programmers in places
like MIT and applications for Linux started to
appear.
The earlier versions of Linux OS were not so
user-friendly
This definitely curbed the Linux’s popularity as
other commercially oriented Operating System
Windows got famous.
Nonetheless, the open-source aspect of the
Linux operating system made it more robust.
4
OPERATING SYSTEMS
https://github.com/EG-tech/digipres-posters
5
Linux
The main advantage of Linux was that programmers
were able to use the Linux Kernel to design their own
custom operating systems.
With time, a new range of user-friendly OS’s stormed
the computer world.
Now, Linux is one of the most popular and widely used
Kernel
6
Benefits of Linux
Being open-source, anyone can modify it.
It is easy to learn Linux for beginners
The Linux operating systems now offer millions of
programs/applications and Linux softwares to choose
from, most of them are free!
Once you have Linux installed you no longer need an
antivirus! Linux is a highly secure system.
Linux freeware is the OS of choice for Server
environments due to its stability and reliability
(Mega-companies like Amazon, Facebook, and
Google use Linux for their Servers). A Linux based
server could run non-stop without a reboot for years
on end.
7
Why using Linux
When working for companies in the future, it’s likely that
you have to interact with Linux computer, and probably
have to interact with it through commands (e.g. when
you use remote server)
Or when you work with Google Colab, the only way to
interact with Linux computer behind Google Colab is to
use commands
8
What is Linux Distro
A Linux distribution (distro) is a complete operating
system that includes the Linux kernel, system libraries,
utilities, application software, and a package
management system.
It is created by assembling various software
components from different sources and packaging them
together to provide a cohesive and user-friendly
computing environment.
9
What is Linux Distro
Linux Kernel: core component of the operating system, providing low-
level functionality, hardware abstraction, and device drivers.
System Libraries: a set of system libraries, such as the GNU C Library
(glibc), which provide essential functions and interfaces for applications to
interact with the underlying operating system.
User Interface: Linux distributions offer different user interfaces, including
graphical user interfaces (GUIs) like GNOME, KDE, or Xfce, as well as
command-line interfaces (CLIs).
Software Packages: Linux distributions come with a collection of software
packages
Package Management System: Linux distributions utilize a package
management system to install, update, and remove software packages.
Configuration and Customization: tools and utilities for configuring
various aspects of the system
Support and Community: Linux distributions are often backed by
communities and support forums.
10
What is Linux Distro
Popular free Linux distributions:
Ubuntu from Canonical
Debian from the Debian Project
Fedora from the Fedora Project
OpenSUSE from SUSE
Rocky and AlmaLinux
Commercial distributions:
Oracle Linux
Red Hat Enterprise Linux (RHEL)
SUSE Enterprise Server (SLES).
11
Key points about linux
Linux is an OS which is open-source, free, and widely used
(especially for server computer)
Precisely, Linux is not a full-fledged OS, but is the OS’s
core/kernel
Because Linux source code is published, many groups out
there have used Linux to build OS’s with different flavors (a
Linux-based OS with a specific flavor is call a Linux
distribution or Linux distro): Debian, Ubuntu, Linux Mint,
Arch, Manjaro, …
Why are Linux commands and Mac commands similar to
each other? Because both share the same root: the ancient
Unix OS (Linux gets inspired by Unix, but Linux source code
is rewritten from scratch and different from Unix source code;
Mac is related more directly to Unix)
12
Linux vs. Windows
Linux is an open source operating system so user
can change source code as per requirement whereas
Windows OS is a commercial operating system so user
doesn’t have access to source code.
Linux is very well secure as it is easy to detect bugs
and fix whereas Windows has a huge user base, so it
becomes a target of hackers to attack windows system.
Comparing Windows file system vs Linux file system,
Linux runs faster even with older hardware whereas
Windows are slower compared to Linux.
13
Linux vs. Windows
Linux peripherals like hard drives, CD-ROMs, printers
are considered files whereas Windows, hard drives,
CD-ROMs, printers are considered as devices
Linux files are ordered in a tree structure starting with
the root directory whereas in Windows, files are stored
in folders on different data drives like C: D: E:
In Linux you would find the system and program files in
different directories whereas in Windows, system and
program files are usually saved in C: drive.
Linux filename is case-sensitive. Windows is not
14
Command Line Interface
Even though the world is moving to GUI based systems,
CLI has its specific uses and is widely used in scripting
and server administration.
Comparatively, Commands offer more options & are flexible.
Piping and stdin/stdout are immensely powerful are not
available in GUI
Some configurations in GUI are up to 5 screens deep while in a
CLI it’s just a single command
Moving, renaming 1000’s of the file in GUI will be time-
consuming while in CLI, using regular expressions so can do
the same task with a single command.
CLI load fast and do not consume RAM compared to GUI. In
crunch scenarios this matters.
15
Command Line Interface
16
How to install Linux (on Windows)
https://ubuntu.com/tutorials/install-ubuntu-
on-wsl2-on-windows-11-with-gui-support
Install WSL
Download Ubuntu
Configure Ubuntu
17
How to install Linux (on Windows)
After install:
Type: “Ubuntu”
Choose ubuntu version
18
Root
19
https://github.com/EG-tech/digipres-posters
File Permission
Owner permissions
Group permissions
Other (world) permissions
Specific permission:
read (r)
write (w)
execute (x)
−
20
File Permission
21
Bash Scripting
A Bash script: define a series of actions which the
computer will then perform without us having to enter
the commands ourselves.
If a particular task is done often, or it is repetetive, then a script
can be a useful tool.
A Bash script is interpreted
Anything you can run on the command line you may
place into a script and they will behave exactly the
same.
Anything you can put into a script, you may run on the
command line and again it will perform exactly the same.
22
Bash Scripting: Example
Create a script file (DemoScript.sh)
#!/bin/bash
# Simple demo script
echo Here is the files in your directory:
ls -l
23
Bash Scripting: Example
Run the script
24
Bash Scripting: Variables
Create a script file (variableexample.sh)
#!/bin/bash
# A simple demonstration of variables
name='Ryan'
echo Hello $name
25
Bash Scripting:
Command line arguments
Create a script file (commandlineagvDemo.sh)
#!/bin/bash
# A simple demonstration of variables
26
A Sample Backup Script
Create a script file (projectbackup)
#!/bin/bash
# Backs up a single project directory
date=`date +%F`
mkdir backups/$1_$date
cp -R $1 backups/$1_$date
echo Backup of $1 completed
For more info about bash scripting (if statement, loop, function…)
can check this Bash Scripting Tutorial
27
Basic command line
https://cheatography.com/davechild/cheat
-sheets/linux-command-line/
28
Simple Tutorial
https://missing.csail.mit.edu/2020/course-
shell/
https://ubuntu.com/tutorials/command-
line-for-beginners
https://missing.csail.mit.edu/
https://ryanstutorials.net/linuxtutorial/
29
Reference
30