Module 1 - Lecture - 7CSE1
Module 1 - Lecture - 7CSE1
Outline
1. Administrivia
2. Substance
Amity School of Engineering & Technology
Administrivia
Class web page: Amizone LMS URL
All assignments, handouts, lecture notes on-line
Textbook:
Linux Bible, The comprehensive Tutorial Resource, 8th
Edition
Linux: The Complete Reference, Sixth Edition
Goal is to make lecture slides the primary reference
Almost everything I talk about will be on slides
Please download slides from LMS
Amity School of Engineering & Technology
Assignment Requirements
Do not copy other student’s solutions. Your marks will be zero if
you do this.
You must submit your assignments in Google Classroom
Ask me for deadline extension if you run into trouble
Be sure to tell me: How much have you done? How much is left? When
can you finish by?
Amity School of Engineering & Technology
Syllabus
Syllabus_Linux for Devices_CSE438.docx
Course Goals
Introduce you to basics of Linux.
Explores the basic characteristics of Linux Networking.
Teach you to learn Linux Shell, File Structure and Network
Administration Services.
Makes you understand various Linux security techniques.
Amity School of Engineering & Technology
Outline
1. Administrivia
2. Substance
Amity School of Engineering & Technology
Learning Objective
To understand how Linux was developed and which are the features that make
it popular as compared to other operating systems
To give the abstract description of the overall architecture of Linux
To present various designs of the kernel and among them which design is
adopted for Linux kernel development
To present the design and importance of each directory/file in the Linux file
system
To present the idea that how a communicator take responsibility to send only
correct instruction to the master component of O/S so that master can do more
productive work
To impart the most useful Linux commands
Understand the basics of Linux
Application of Linux in Industry usage
Amity School of Engineering & Technology
Learning Objective
Can understand the popularity of Linux and various distribution of it that can
be used for personal and commercial purposes without any cost
Understand the essential components of Linux system architecture
Able to distinguish the design of Linux kernel with non-Linux O/S kernel
Able to understand the importance of file system
Able to understand that to increase the throughput of the system correctness
of the user instruction must be checked by the mediator before execution
Comfortable to use commands in any organization where Linux o/s is
primarily used
Analyze the category of different type of users
Able to assign appropriate access permission to users working in same system
Perform the basic operations for Linux
Analyse the potential of Linux in Industry
Amity School of Engineering & Technology
Topics
Introduction to Linux
File System of the Linux
General usage of Linux kernel & basic commands
Linux users and group
Permissions for file
Directory and users
Searching a file & directory
Zipping and Unzipping concepts
Linux for the Industry 4.0 Era
OPENIL and its advantages
Features of OPENIL
Amity School of Engineering & Technology
Why Linux
A Linux Distribution has thousands of dollars worth of software
for no cost.
Linux is a complete operating system:
Stable - the crash of an application is much less likely to
bring down the OS under Linux.
Reliable - Linux servers are often up for hundreds of days
compared with the regular reboots required with a Windows
system.
Extremely powerful
Amity School of Engineering & Technology
Before Linux
In 80’s, Microsoft’s DOS was the dominated OS for PC
single-user, single-process system
Apple MAC is better, but expensive
UNIX is much better, but much 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 are proprietary, i.e., the
source code of their kernel is protected
No modification is possible without paying high
license fees
Amity School of Engineering & Technology
GNU Project
Established in 1984 by Richard Stallman, who believes that
software should be free from restrictions against copying or
modification in order to make better and efficient computer
programs
GNU is a recursive acronym for “GNU's Not Unix”
Aim at developing a complete Unix-like operating system
which is free for copying and modification
Companies make their money by maintaining and distributing
the software, e.g. optimally packaging the software with
different tools (Redhat, Slackware, Mandrake, SuSE, etc)
Stallman built the first free GNU C Compiler in 1991.
But still, an OS was yet to be developed
Amity School of Engineering & Technology
Beginning of Linux
A famous professor Andrew Tanenbaum developed Minix, a
simplified version of UNIX that runs on PC
Minix is for class teaching only. No intention for commercial
use
In Sept 1991, Linus Torvalds, a second year student of
Computer Science at the University of Helsinki, developed the
preliminary kernel of Linux, known as Linux version 0.0.1
It was put to the Internet and received enormous response
from worldwide software developers
By December came version 0.10. Still Linux
was little more than in skeletal form.
Amity School of Engineering & Technology
Confrontation and
Development
Message from Professor Andrew Tanenbaum
" I still maintain the point that designing a monolithic kernel in 1991 is
a fundamental error. Be thankful you are not my
student. You would not get a high grade for such a design :-)"
(Andrew Tanenbaum to Linus Torvalds)
"Linux is obsolete".
(Remark made by Andrew Tanenbaum)
But work went on. Soon more than a hundred people joined the Linux
camp. Then thousands. Then hundreds of thousands
It was licensed under GNU General Public License, thus ensuring that the
source codes will be free for all to copy, study and to change.
Amity School of Engineering & Technology
Linux
Created by Linus Torvalds in 1991
Includes system utilities & libraries from the GNU Project
Open Source Hardware:
Free
Stable
Easily fixed if bugs appear
Linux Today
Linux has been used for many computing platforms
PC, PDA, Supercomputer,…
Current kernel version 2.6.13
Not only character user interface but graphical user interface,
thanks to the X-Window technology
Commercial vendors moved in Linux itself to provide freely
distributed code. They make their money by compiling up
various software and gathering them in a distributable format
Red Hat, Slackware, etc
Chinese distribution of Linux also appeared in Taiwan and
China - CLE, Red Flag Linux
Amity School of Engineering & Technology
• Device drivers
• Interfaces between the kernel and the BIOS
• Different device has different driver
• Kernel
• A core component of Operating System without which
OS can't work
• Kernel is the nervous system of OS
• It controls everything in OS including I/O Management,
Process Management and so on
• It is a bridge between applications and the actual data
processing done at the hardware level
• It acts as an interface between the user applications and the
hardware
Amity School of Engineering & Technology
Amity School of Engineering & Technology
Amity School of Engineering & Technology
Tasks of kernel
1. Central Processing Unit
The Kernel takes responsibility for deciding at anytime which of
the many running programs should be allocated to the processors
Tasks of kernel(Continued..)
3. Input/output Devices
The Kernel allocates requests from applications to perform I/O to an
appropriate device and provides convenient methods for using the
device
4. Memory Management
The Kernel has full access to the system's memory and must allow
processes to safely access this memory as they require it
5.Device Management
A Kernel must maintain a list of available devices. This list may be
known in advance configured by the user or detected by the
operating system at run time (normally called plug and play)
Amity School of Engineering & Technology
Types of Kernel
Amity School of Engineering & Technology
Monolithic Kernel
• Run in Kernel space every basic system services like
• process and memory management,
• interrupt handling and I/O Communication,
• file system etc in Kernel space
Monolithic Kernel
Amity School of Engineering & Technology
Micro Kernel
• The kernel provides basic functionality that allows the execution of
servers and separate programs
• The Kernel is broken into separate processes known as server
• Some of the servers run in user space and some in kernel space
• All servers are kept separate and run in different address spaces
• The communication in microkernels is done via message passing
• The servers communicate through Interprocess
Communication(IPC)
• Servers invoke "services" from each other by sending messages
• It is also possible to dynamically switch among operating systems
and to have more than one active simultaneously
Amity School of Engineering & Technology
Micro Kernel
Amity School of Engineering & Technology
Key Comparisons
Basis for Comparison Micro Kernel Monolithic Kernel
Topics
Introduction to Linux
File System of the Linux
General usage of Linux kernel & basic commands
Linux users and group
Permissions for file
Directory and users
Searching a file & directory
Zipping and Unzipping concepts
Linux for the Industry 4.0 Era
OPENIL and its advantages
Features of OPENIL
Amity School of Engineering & Technology
Topics
Introduction to Linux
File System of the Linux
General usage of Linux kernel & basic commands
Linux users and group
Permissions for file
Directory and users
Searching a file & directory
Zipping and Unzipping concepts
Linux for the Industry 4.0 Era
OPENIL and its advantages
Features of OPENIL
Amity School of Engineering & Technology
Linux Shell
Shell interprets the command whoami pwd
ls Bash, Tcsh, Zsh
and request service from kernel
Similar to DOS but DOS has only one set of interface while
Linux can select different shell Kernel
– Bourne Again shell (Bash), TC shell (Tcsh), Z shell
(Zsh)
Different shell has similar but different functionality
Bash is the default for Linux
Graphical user interface of Linux is in fact an application
program work on the shell
Amity School of Engineering & Technology
Topics
Introduction to Linux
File System of the Linux
General usage of Linux kernel & basic commands
Linux users and group
Permissions for file
Directory and users
Searching a file & directory
Zipping and Unzipping concepts
Linux for the Industry 4.0 Era
OPENIL and its advantages
Features of OPENIL
Amity School of Engineering & Technology
Topics
Introduction to Linux
File System of the Linux
General usage of Linux kernel & basic commands
Linux users and group
Permissions for file
Directory and users
Searching a file & directory
Zipping and Unzipping concepts
Linux for the Industry 4.0 Era
OPENIL and its advantages
Features of OPENIL
Amity School of Engineering & Technology
File Management
In Linux, file is defined as simply the thing that deals with a
sequence of bytes
Hence everything are files
– An ordinary file is a file; a directory isKernel
also file; a
network card, a hard disk, any device are also files since
they deal with a sequence of bytes
Linux supports five types of files
simple/ordinary file (text file, c++ file, etc)
directory
symbolic (soft) link
special file (device)
named pipe (FIFO)
Amity School of Engineering & Technology
Kernel
Linux File
Symbolic (soft) link
Not a real file, just a link to another file
Allow giving another name to a file without actually
duplicates it – hence save memory space
Kernel
Special file (device)
Each hardware device, e.g. keyboard, hard disk, CD-ROM,
etc is associated with at least one file
Usually stored in /dev directory
Applications can read and write any devices by reading
and writing their associated file – hence the access method
is known as device independent
Divide into two types: character special files, e.g.
keyboard, and block special files, e.g. disk
Amity School of Engineering & Technology
Linux File
Kernel
Amity School of Engineering & Technology
Linux File
Kernel
Amity School of Engineering & Technology
Quiz-II
Amity School of Engineering & Technology
Topics
Introduction to Linux
File System of the Linux
General usage of Linux kernel & basic commands
Linux users and group
Permissions for file
Directory and users
Searching a file & directory
Zipping and Unzipping concepts
Linux for the Industry 4.0 Era
OPENIL and its advantages
Features of OPENIL
Amity School of Engineering & Technology
• Note that this command searches for the binary using the $PATH
environment variable
• This means if the $PATH does not have the folder of the binary,
which will not be able to find it
• In other words, if you can not run the command, which will
not be able to locate it
Amity School of Engineering & Technology
Limitation of “locate”
Command
• The locate command is a very useful command because:
• It is very simple
• You can search for a file based on its name, part of its name, part of its path,
…etc
• It is very fast command (because it uses a pre-prepared database)
• However, it comes with some limitations,
• It can only search based on file name (or path name)
• It may not find new files
• It may result in wrong results since it does not use the current tree in its
search (instead it uses an old snapshot of the tree)
• The locate command is useful for searching for system files or traditional
Linux files but can not be used in a lot of other scenarios
Amity School of Engineering & Technology
Inverting Conditions
You can have one of the filters inverted in the search criteria
• Using “!”
– $ find ~ \! -name “*.pdf”
• Using “-not”
– $ find ~ -not -name “*.pdf”
Amity School of Engineering & Technology
Skipping Files
(The -prune Action)
• The find command performs its search recursively in all sub-
directories
• In case we need to skip some search results, we can use a
search filter with the -prune action with the other search filters
• Example:
• $ find ~ -type l -prune -o -name "*.txt" -print
• $ find . -path ./misc -prune -o -name '*.txt' -print
• $ find . -type d \( -path dir1 -o -path dir2 -o -path dir3 \) -
prune -o -print
Amity School of Engineering & Technology
Quiz-III
Amity School of Engineering & Technology
Topics
Introduction to Linux
File System of the Linux
General usage of Linux kernel & basic commands
Linux users and group
Permissions for file
Directory and users
Searching a file & directory
Zipping and Unzipping concepts
Linux for the Industry 4.0 Era
OPENIL and its advantages
Features of OPENIL
Amity School of Engineering & Technology
ZIP command
ZIP is a compression and file packaging utility for Unix.
Each file is stored in single .zip {.zip-filename} file with the
extension .zip.
The zip program puts one or more compressed files into a
single zip archive, along with information about the files (name,
path, date, time of last modification, protection, and check
information to verify file integrity). An entire directory structure
can be packed into a zip archive with a single command.
Compression ratios of 2:1 to 3:1 are common for text files.
zip has one compression method (deflation) and can also store files
without compression.
zip automatically chooses the better of the two for each file to be
compressed.
Amity School of Engineering & Technology
Syntax
ZIP Command
zip [options] zipfile files_list
Extracting from .zip
Unzip <filename.zip>
Possibilities:
1. -d removes files from a zip archieve
Zip –d <filename.zip> <file.txt>
2. -u updates a file in zip archieve
Zip –u <filename.zip> <file.txt>
3. -m deletes original files after zipping
Zip –m <filename.zip> file.txt
4. -r recursively zips files in a directory
Zip –r <filename.zip> <directory_name>
5. -v verbose mode or prints diagnostic information
Zip –v <filename.zip> <file1.txt>
Amity School of Engineering & Technology
Gzip/gunzip Command
Another popular compression algorithm that allows to reduce the size of a
file and keep original file mode, ownership and timestamp.
.gz file format and uses gzip utility to compress and decompress files
By default, gzip keeps the original file name and
timestamp in the compressed file
Syntax:
gzip <test.txt>
Shall create a <test.txt.gz> and delete the original file
For compress multiple files or directory into one file, first you need to
create a Tar archive and then compress the .tar file with Gzip. A file
that ends in .tar.gz or .tgz is a Tar archive compressed with Gzip.
Amity School of Engineering & Technology
Gzip/gunzip Command
Gunzip synopsis
gunzip [ -acfhlLnNrtvV ] [-S suffix] [ name ... ]
gunzip also recognizes the special extensions .tgz and .taz as shorthands
for .tar.gz and .tar.Z respectively.
Possibilities:
1. -k allows to keep original file
Gzip –k <filename>
Or –c
Gzip –c <filename> > filename.gz
2. -v prints the percentage reduction and name of files processed
Gzip –v <filename>
3. Compress multiple files
Gzip <file1> <file2> <file3>
Amity School of Engineering & Technology
gzip OPTIONS
• -f –force
Force compression or decompression even if the file has
multiple links or the corresponding file already exists
Amity School of Engineering & Technology
gzip OPTIONS
• -l –list
For each compressed file, list the following fields:
compressed size: size of the compressed file
uncompressed size: size of the uncompressed file
ratio: compression ratio (0.0% if unknown)
uncompressed_name: name of the uncompressed file
•-n --no-name
– When compressing, do not save the original file name and
time stamp by default.
– When decompressing, do not restore the original file name if
present (remove only the gzip suffix from the compressed file
name) and do not restore the original time stamp if present.
Amity School of Engineering & Technology
gzip OPTIONS
• change the compression level
• -# --fast –best
– Regulate the speed of compression using the specified digit #
• -1 or --fast
indicates the fastest compression method, less compression
• -9 or --best
indicates the slowest compression method
best compression
• The default compression level is-6
• That is, biased towards high compression
– Gzip –9 <filename>
Amity School of Engineering & Technology
gzip decompression
Compressed files can be restored to their original form using:
– gzip -dor
– gunzip or
– Zcat
– Gzip –d <filename.gz>
gunzip can currently decompress files created by gzip, zip,
compress, compress -H or pack.
– The detection of the input format is automatic.
gzip and gunzip can also compress or decompress data from
standard input and output
– ls -laR $HOME | gzip > filelist.gz
– Or by using –c option
Amity School of Engineering & Technology
bzip2: Synopsis
bzip2 [ -cdfkqstvzVL123456789 ] [ filenames ... ]
bunzip2 [ -fkvsVL ] [ filenames ... ]
bzcat [ -s ] [ filenames ... ]
bzip2recover filename
Each file is replaced by a compressed version of itself, with
the name "original_name.bz2“
https://www.geeksforgeeks.org/bzip2-command-in-linux-with-examples/
https://www.javatpoint.com/linux-bzip2-bunzip2
https://www.javatpoint.com/linux-bzcat-bzmore
https://www.geeksforgeeks.org/tar-command-linux-examples/
Amity School of Engineering & Technology
bzip2 OPTIONS
-c –stdout
– (as in gzip) Compress or decompress to standard output.
• -t –test
– Check integrity of the specified file(s), but don't
decompress them.
This really performs a trial decompression and throws
away the result.
• -k –keep
– Keep (don't delete) input files during compression or
decompression.
Amity School of Engineering & Technology
bzip2 OPTIONS
• -s –small
Reduce memory usage, for compression, decompression
and testing.
• -1 (or --fast) to -9 (or --best)
Set the block size to 100 k, 200 k .. 900 k when
compressing.
Has no effect when decompressing.
Amity School of Engineering & Technology
bzcat
bzip2 decompression
decompresses files to stdout
• bunzip2
• Cannot use bunzip2 to uncompress files compressed with gzip
and vice versa
• bzip2 -d
decompresses all specified files.
Files which were not created by bzip2 will be detected and
ignored
warning issued.
Amity School of Engineering & Technology
bzip2 decompression
filename.bz2 filename filename
filename.bz filename.tar
filename.tbz2 filename.tar
filename.tbz anyothername.out
anyothername
Amity School of Engineering & Technology
tar options
• -c
Create a new archive
• -x
Extract files from an archive
• -t
List table of contents to an archive
• -r
append
Amity School of Engineering & Technology
tar options
• -u
Update files
• -d
Compare files in the archive to those in the file system
• -v
• – print verbose information
• -k
To keep any existing files when extracting
• B filename
To specify that the tar file to be read or written is filename.
Amity School of Engineering & Technology
Other commands
Synopsis:
compress [ -f ] [ -v ] [ -c ] [ -V ] [ -r ] [ -b bits ]
[ name ... ]
uncompress [ -f ] [ -v ] [ -c ] [ -V ] [ name ... ]
zip [-aABcdDeEfFghjklLmoqrRSTuvVwXyz!@$] [- b
path] [-n suffixes] [-t mmddyyyy] [-tt mmddyyyy]
[ zipfile [ file1 file2 ...]] [-xi list]
unzip [-Z] [-cflptuvz[abjnoqsCLMVX$/:]] file[.zip]
[file(s) ...] [-x xfile(s) ...] [-d exdir]
Amity School of Engineering & Technology
Short Quiz-III
Amity School of Engineering & Technology
Topics
Introduction to Linux
File System of the Linux
General usage of Linux kernel & basic commands
Linux users and group
Permissions for file
Directory and users
Searching a file & directory
Zipping and Unzipping concepts
Linux for the Industry 4.0 Era
OPENIL and its advantages
Features of OPENIL
Amity School of Engineering & Technology
OPENIL
It is an open source software platform for industrial automation
It provides following features:
Secure:
Industrial-grade security
Trusted computing
Hardened software
Cryptographic operations
End to end security
Real-Time
OpenIL provides a true real-time software platform
Real-time Linux kernel, professionally developed, tested and validated
Deterministic
OpenIL supports the latest Time-Sensitive Networking technology.
OpenTSN architecture runs on various hardware.
Amity School of Engineering & Technology
OPENIL Advantages
100% OPEN SOURCE
Linux distribution specifically developed, tested, and packaged for
industrial systems
CROSS PLATFORM
True cross-platform software platform, not limited to specific device or
hardware architecture
INDUSTRY LEADING EXPERTS
Technology experts and developers from industry-leading companies are
actively building OpenIL software and solutions
Amity School of Engineering & Technology
OPENIL Advantages
WELL DOCUMENTED AND SUPPORTED
Development and user manuals are well documented with active
community support.
FIELD PROVEN
Every release is rigorously tested in industrial environments on
production systems.
CONTINUOUSLY EVOLVING
OpenIL targets broad industrial applications, and is always evolving.
Summary
Linux is an operating system that is built by a community of
software developers around the world and led by its creator,
Linus Torvalds
It is derived originally from the UNIX operating system, but has
grown beyond UNIX in popularity and power over the years
Most Linux software projects are protected by one of a set of
licenses that fall under the Open Source Initiative umbrella. The
most prominent of these is the GNU Public License (GPL)
The GNOME desktop environment has become the default
desktop environment for many Linux systems, including Fedora
and RHEL
Amity School of Engineering & Technology
Summary
• To become an expert Linux user, you must be able to use the
shell to type commands
• Commands for moving around the filesystem, copying files,
moving files, and removing files are among the most basic
commands you need to work from the shell
• Use the locate and find commands for finding files and grep for
searching files
Amity School of Engineering & Technology
Short Quiz-IV
Amity School of Engineering & Technology
Job Positions
DevOps Engineer Software Developer
Java Developer Linux Engineer
Software Engineer
TechOps Engineer
Systems Administrator
Systems Engineer
Senior Java Developer
Senior Software Engineer Build release
Python Developer management Engineer
Network Engineer
Software Developer
Linux Engineering Admin
Amity School of Engineering & Technology
Linux Certifications
Most of the hiring manager are looking to recruit Linux
professionals.
The emergence of open cloud platforms is creating increasing
demand for Linux professionals who have the right expertise
Linux-certified professionals always be a better position in the
job market
Employers are looking for more Linux talent.
Better salary increments for Linux certified professionals
Amity School of Engineering & Technology
Linux Certifications
Some of the best Linux certification are given below:
Linux Foundation
Red Hat Linux SuSE Linux
Oracle
Linux Professional Institute (LPIC)
CompTIA
Check it
Amity School of Engineering & Technology
References
Linux Bible, The comprehensive Tutorial Resource, 8th
Edition
Linux: The Complete Reference, Sixth Edition
Linux Programming and Scripting, Video Course NPTEL
https://www.openil.org/