linux overview - events.bdren.net.bd
TRANSCRIPT
Index
Before Linux
Road to Linux
Linux arrived
Linux development method?
What is GNU?
Language of Linux
Unix and Linux
Unix System Architecture
Unix Philosophy
Linux File system Hierarchy
2
Before Linux
In 80‟s, Microsoft‟s DOS was the dominated OS for PC
Apple MAC was better, but expensive
UNIX was much better, but much, much more expensive. Only for minicomputer for commercial applications
People was looking for a UNIX based system, which is cheaper and can run on PC
Both DOS, MAC and UNIX were proprietary, i.e., the source code of their kernel is protected
No modification is possible without paying high license fees
3
Road to Linux
Inspired by the UNIX OS, the Linux kernel was developed as a clone of UNIX
GNU was started in 1984 with a mission to develop a free UNIX-like OS
Linux was the best fit as the kernel for the GNU Project
Linux kernel was passed onto many interested developers throughout the Internet
Linux today is a result of efforts of Linus Torvalds and thousands of individuals, in 1991
4
Linux arrived
Linux is basically a kernel, it was combined with the various software and compilers from GNU Project to form an OS, called GNU/Linux
Linux is a full-fledged OS available in the form of various Linux Distributions
RedHat, Fedora, SuSE, Ubuntu, Debian are examples of Linux distros
Linux is supported by big names as IBM, Google, Sun, Novell, Oracle, HP, Dell, and many more
5
Linux development method
Linux development method
Person identifies need and begins writing program
Developer announces project on Internet
Others respond and work on different parts of project
Person leading project releases software
People download source code and try program; send back information about problems
Developers fix bugs
Forking
Creating new project based on existing source code
6
What is GNU?
Stands for GNUs Not Unix. GNU General Public License. GNU - GPL – Copyleft
Free software, as defined by the FSF (Free Software Foundation), is a "matter of liberty, not price."
Terms for using Linux
You can modify / copy / redistribute the source code at no cost provided you do so under the GPL
If you get source under the GPL, any changes / improvements / spin offs you make to it are also under GPL
You must always distribute source code + GPL of programs that you develop with the help of GPL software online.
7
Language of Linux
Linux was written completely in C and ASM.
UNIX (1969) was written in PDP-7 Assembly.
This version of UNIX was not portable to new hardware.
Thomson developed B as a machine independent language to make UNIX portable.
Dennis Ritchie rewrote UNIX in C, a language he developed from B and concepts from other languages.
8
Unix System Architecture
9
The shell and the window environment are programs
Programs‟ only access to hardware is via the kernel
Fig: Unix System Architecture
Unix and Linux
10
Linux is based on Unix Unix philosophy
Unix commands
Unix standards and conventions
Unix Philosophy
11
Multi-user
A user needs an account to use a computer
Each user must log in
Complete separation of different users‟ files and configuration
settings
Small components
Each component should perform a single task
Multiple components can be combined and chained together for
more complex tasks
An individual component can be substituted for another, without
affecting other components
What is Linux?
Linux kernel
Developed by Linus Torvalds
Strictly speaking, „Linux‟ is just the kernel
Associated utilities
Standard tools found on (nearly) all Linux systems
Many important parts come from the GNU project
Free Software Foundation‟s project to make a free Unix
Some claim the OS as a whole should be „GNU/Linux‟
Linux distributions
Kernel plus utilities plus other tools, packaged up for end users
Generally with installation program
Distributors include: Red Hat, Debian, SuSE, Ubuntu etc.
12
Hierarchical File System
Files are kept in directories
Directories can hold other directories.
FHS – File system Hierarchy Standard defines the rules for where certain files will always be kept.
The “root” of the Linux FS is always „/‟
Files & directories can be owned by users to enforce security privileges.
14
Directories defined by the FHS
16
Directory Description
/bin Contains binary commands that can be used by system administrators, users, and scripts; this directory shouldn’t contain subdirectories and can be accessed in single user mode
/boot Contains the Linux kernel and static files needed to boot the computer
/dev Contains device files, such as the CD/DVD-ROM drive
/etc Contains static configuration files, which are also unshareable files, meaning they’re local to the machine
/home An optional directory that might not be included in all Linux distributions; in openSUSE, it’s the user’s home directory
/lib Contains shared libraries that are loaded when a program starts
/media Contains the mount point for removable media
Directories defined by the FHS (Cont.)
17
Directory Description
/mnt Empty by default, but administrators can use it to mount other resources, such as CD/DVD-ROM drives
/opt Contains static shareable add-on software packages
/root Contains the recommended home directory for the root user; not all Linux distributions use it, but it’s used in CentOS, RHEL, openSUSE,
/sbin Contains system binaries used by the system administrator
/srv Contains data files for services
/tmp Contains temporary files that system administrators should delete whenever the system is booted
/usr Contains shareable, read-only applications and files
/var Contains variable data files, such as log files
BASH – the Linux Shell system
Bourne Again Shell is s command processor
It acts as an interface between the user and the operating system
Commands / applications can be given to this interpreter which can then make the operating system do various tasks
Commands can be stored in shell scripts for ease of access
18
Device independent I/O
All physical devices – monitor, mouse, keyboard
printer appear as files in the Linux file system that
are manipulated by the kernel.
This means that if a program is written to manipulate
this file, then the kernel will take it to mean an action
on the physical I/O device.
This allows for a standard API for I/O in all Linux
systems.
19
Linux User Interface
Can be controlled through command Line
Interface(CLI) or Graphical User Interface (GUI)
GUI run through Desktop Environments (DE)
KDE, GNOME, Xfce, E17 are popular Desktop
Environments (DE)
The GUI interface is easy-to-use and much like that
of Windows and Mac OSX
The CLI is similar to that of UNIX/BSD
20
Programming in Linux
Modern languages are cross-platform, like Python,
Ruby, Perl, Java
Most Linux distros support these languages and
have their runtimes pre-installed
GTK+ and Qt are widely used to design applications
for Linux
IDEs like NetBeans, Anjuta, KDevelop,
MonoDevelop, Eclipse are available for Linux too
21
Linux on the Desktop
Linux is desktop computer ready
Large number of distros targeted at Desktop users
are available
Linux desktop distros come with many commonly
used pre-installed software's
The modern Linux interface is user-friendly and
makes the interaction with computer easy
22
Linux on Servers and Supercomputers
Linux is the most used OS on servers
6 out of 10 reliable web hosting companies use Linux
Linux is the cornerstone of the LAMP server software
combination (Linux, Apache, MySQL, Perl, PHP,
Python) which has achieved popularity among
developers
Out of top 500 supercomputers, Linux is deployed
on 427 of them
23
Why should you use Linux?
24
Linux systems are extremely stable
Linux is Free
No/Very few threat of viruses
Linux comes with most of the required software pre-installed
Update all your software with minimum fuss
Linux never gets slow
Linux does not need defragmentation
Linux can even run on oldest hardware
Adding more software is a matter of a few clicks
Most Windows-only apps have their either their native version or alternatives for Linux
With Linux, you get the highest degree of possible customizability
Basic commands
27
Basic Linux Commands
– File Handling
– Text Processing
– System Administration
– Managing Users and Groups
– Archival
– Network
– File Systems
– Advanced Commands
File Handling
28
mkdir – make directories
Usage: mkdir [OPTION] DIRECTORY...
Example: mkdir mahedi
ls – list directory contents
Usage: ls [OPTION] [FILE]
Example: ls, ls -l, ls –l mahedi
cd – changes directories
Usage: cd [DIRECTORY PATH]
Example: cd mahedi
File Handling (cont.)
29
pwd -print name of current working directory
Usage: pwd
vim – Vi Improved, a programmers text editor
Usage: vim [OPTION] [file]...
Example: vim file1.txt
cp – copy files and directories
Usage: cp [OPTION]... [SOURCE] [DEST]
Example: cp sample.txt sample_copy.txt
cp sample_copy.txt target_dir
File Handling (cont.)
30
rm -remove files or directories
Usage: rm [OPTION]... FILE...
Example: rm file1.txt
rm –rf file1.txt
find – search for files in a directory hierarchy
Usage: find [OPTION] [path] [pattern]
Example: find / -name mahedi
history – prints recently used commands
Usage: history
Text Processing
31
cat- concatenate files and print on the standard output
Usage: cat [OPTION] [FILE]...
Example: cat file1.txt file2.txt
cat -n file1.txt
echo – display a line of text Usage: echo [OPTION] [string] ...
Example: echo I love Debian
echo $
Text Processing (Cont.)
32
grep- print lines matching a pattern
Usage: grep [OPTION] PATTERN [FILE]...
Example: grep mahedi file1.txt
wc – print the number of newlines, words, and bytes
in files Usage: wc [OPTION]... [FILE]...
Example: wc file1.txt
wc L file1.txt
Managing Users and Groups
33
Account information is stored in: /etc/passwd and /etc/shadow
Accounts have the following attributes: username
UID
GID (default group)
Comment
home directory
shell
Managing Users and Groups (Cont.)
34
Create accounts with useradd.
Delete accounts with userdel.
Modify accounts with usermod.
Managing Users and Groups (Cont.)
35
Group information is stored in /etc/group.
Create groups with groupadd.
Delete groups with groupdel.
Modify groups with groupmod.
To view group memberships use groups. groups [ACCOUNT]
groups
groups mahedi
System Administration
36
chmod - change file access permissions
Usage: chmod [OPTION] [MODE] [FILE]
Example: chmod 744 file1.txt
chown – change file owner and group
Usage: chown [OPTION]... OWNER:GROUP FILE
Example: chown mahedi file1.txt
ls -la
System Administration (Cont.)
37
su - change user ID or become super user
Usage: su [OPTION] [LOGIN]
Example: su - mahedi
passwd – update a user’s authentication tokens(s) Usage: passwd [OPTION]
Example: passwd mahedi
who – show who is logged on
Usage: who [OPTION]
Example: who
Advanced Commands
38
reboot - reboot the system
Usage: reboot [OPTION]]
Example: reboot
poweroff – power off the system Usage: poweroff [OPTION]
Example: poweroff