SlideShare a Scribd company logo
1 of 71
LINUX OS AND SHELL
PROGRAMMING
MODULE 1
PREPARED BY
SHAHILA SHAHUL
ASSISTANT PROFESSOR
MCA DEPARTMENT
MES AIMAT MARAMPALLY
syllabus
 UNIT I
 Introduction to Linux – History, Architecture, Comparison with
UNIX, Features and Facilities of Linux, Basic commands in Linux,
 Files and File Structure - Linux File System, Boot block, Super
block, Inode table, Data blocks, Linux standard directories. File
naming Conventions, Path, Types of file names and Users, File
Commands in Linux, file comparisons, Directory Commands,
 Text Editors-Functions of a Text Editor, vi Editor, Locating Files,
File Access Permissions [FAP], Viewing and Changing FAPs,
Redirection, Filters, Pipes.
Linux evolved from a project started by a
university student to the robust OS it is now
HISTORY
In June 1971, Richard Matthew Stallman
joined MIT Artificial Intelligence Laboratory as
a programmer where he gained popularity with
the hacker community and came to be known
by his now popular name RMS.
• At that time, all the programmers used to
share their code freely among each other cutting
across various institutions
 In 1980, with the advent of portable software - ie software that can
be compiled to run on different computers, a business model
emerged.
 So the companies developing the code refused to share the code
with their clients and began restricting copying and redistribution of
their software by copyrighting it.
 In response to this trend, Stallman, who believed in the principle
that software has to be free always, founded the Free Software
Foundation and in 1985, published the GNU Manifesto.
 This manifesto outlined his motivation for creating a free OS called
GNU, which would be compatible with Unix.
 He along with a group of like minded programmers started work in
developing the tools needed to make a complete OS
Andy Tanenbaum
 In 1989, Stallman released the first program independent GNU General Public
Licence now popularly known as GPL or copyleft.
 Now the only thing that GNU lacked was a completely free OS kernel
 In 1990, A finnish student by name Linus Torvalds studying in the University of
Helsinki came into contact with Andy Tanenbaum's OS, Minix.
 Linus wanted to upgrade Minix by putting in more features and improvements.
 But he was prohibited by Tanenbaum to do so.
 Then Linus decided to write his own kernel and released it under GPL.
 This kernel is now popularly known as Linux
Linus Torvalds
Tux the penguin: Linux’s Dear Logo
Architecture of Linux
 1). The kernel is the core part of the operating system, which is responsible for all
the major activities of the LINUX operating system. This operating system
consists of different modules and interacts directly with the underlying hardware.
The kernel offers the required abstraction to hide application programs or low-
level hardware details to the system. The types of Kernels are as follows:
• Monolithic Kernel
• Microkernels
• Exo kernels
• Hybrid kernels
 2). System libraries are special functions, that are used to implement the
functionality of the operating system and do not require code access rights of
kernel modules.
 3). System Utility programs are liable to do individual and specialized-level tasks.
 4). The hardware layer of the LINUX operating system consists of peripheral
devices such as RAM, HDD, CPU.
 5). The shell is an interface between the user and the kernel, and it affords services
of the kernel. It takes commands from the user and executes the kernel’s
functions. The Shell is present in different types of operating systems, which are
classified into two types: command-line shells and graphical shells.
 The command-line shells provide a command-line interface, while the graphical
line shells provide a graphical user interface. Though both shells perform
operations, the graphical user interface shells perform slower than the command
line interface shells. Types of shells are classified into four:
• Korn shell
• Bourne shell
• C shell
• POSIX shell
 Features of Unix OS
• When compare Unix to Linux, Unix is a Multi-user, multitasking
operating system
• It can be used as the master control program in workstations and
servers.
• Hundreds of commercial applications are available
• In its heydays, UNIX was rapidly adopted and became the standard
OS in universities.
 Features of Linux Operating System
• Support multitasking
• Programs consist of one or more processes, and each process have one or
more threads
• It can easily co-exists along with other Operating systems.
• Comparing features of Linux and Unix, Linux can run multiple user
programs
• Individual accounts are protected because of appropriate authorization
• When comparing Unix vs Linux, Linux is a replica of UNIX but does not
use its code.
 KEY DIFFERENCE
• Comparing Unix vs Linux, Linux source code is available to the general public
whereas, in Unix, the source code is proprietary.
• UNIX OS was created in the late 1960s at AT&T Bell Labs whereas Linux is an
operating system built by Linus Torvalds at the University of Helsinki in 1991.
• The main difference between Linux and Unix is Linux is a clone of Unix
• When we compare Unix to Linux, Linux default shell is BASH while the Unix
shell is Bourne Shell.
• One key Unix and Linux difference is that Linux threat detection and solution are
very fast while Unix users require longer wait times to get the proper bug fixing
patch.
• Important versions of Linux are Redhat, Ubuntu, OpenSource, Solaris, whereas
important versions of Unix are HP-UX, AIS, BSD, etc.
Features and Facilities of Linux
 Following are some of the important features of Linux Operating System.
• Portable – Portability means software's can works on different types of hardware's in
same way. Linux kernel and application programs supports their installation on any kind
of hardware platform.
• Open Source – Linux source code is freely available and it is community based
development project. Multiple teams works in collaboration to enhance the capability of
Linux operating system and it is continuously evolving.
• Multi-User – Linux is a multiuser system means multiple users can access system
resources like memory/ ram/ application programs at same time.
• Multiprogramming – Linux is a multiprogramming system means multiple
applications can run at same time.
• Hierarchical File System – Linux provides a standard file structure in which system
files/ user files are arranged.
• Shell – Linux provides a special interpreter program which can be used to execute
commands of the operating system. It can be used to do various types of operations,
call application programs etc.
• Security – Linux provides user security using authentication features like password
protection/ controlled access to specific files/ encryption of data.
Basic commands in linux
File system
Physical structure on the disk
Linux directory's
Root structure
File naming convention
1. All file names are case sensitive. So filename vivek.txt Vivek.txt VIVEK.txt all are
three different files.
2. You can use upper and lowercase letters, numbers, “.” (dot), and “_” (underscore)
symbols.
3. You can use other special characters such as blank space, but they are hard to
use and it is better to avoid them.
4. In short, filenames may contain any character except / (root directory), which is
reserved as the separator between files and directories in a pathname. You cannot
use the null character.
5. No need to use . (dot) in a filename. Some time dot improves readability of
filenames. And you can use dot based filename extension to identify file. For
example:
• .sh = Shell file
• .tar.gz = Compressed archive
 Most modern Linux and UNIX limit filename to 255 characters (255 bytes).
However, some older version of UNIX system limits filenames to 14 characters
only.
 A filename must be unique inside its directory. For example, inside /home/vivek
directory you cannot create a demo.txt file and demo.txt directory name. However,
other directory may have files with the same names. For example, you can create
demo.txt directory in /tmp.
 Please note that Linux and UNIX allows white spaces, , |, , :, (, ), &, ;, as well as
wildcards such as ? and *, to be quoted or escaped using  symbol.
File Management Commands
 mkdir - creating directory
mkdir dirname
 rmdir – removing directory and its contents
rmdir dirname
 cd – Change directory
cd dirpath
 cp – Copying files
cp file1 file2
 mv – Moving or renaming files
mv oldfile newfile
File Management – contd..
ln – Creating links between files
ln file1 file2
Difference between copying files and linking files
cp src dst
 Contents of src will be present in dst
 Changing content in src will not affect contents of dst and vice
versa
ln src dst
 Contents of src will be present in dst
 Changing content in src or dst will get reflected in the other
file
Commands
 Help about commands
 Man (man <<cmd name>>)
 Viewing file’s content
 cat <<filename>>
 Viewing users
 who – List all Users
 who am I – List the current user
 Changing file permission/owner
 chmod – changes file permission
 chown – changes file owner
User information in /etc/passwd
Password info is in /etc/shadow
Group information is in /etc/group
/etc/passwd and /etc/group divide data fields using “:”
/etc/passwd:
joeuser:x:1000:1000:Joe User,,,:/home/joeuser:/bin/bash
/etc/group:
joeuser:x:1000:
• ps – displays processes owned by the current user
• ps – ef displays all processes.
• pstree – displays all processes running in the system in tree format
Listing files and Emulating Terminal
Listing files in a directory
ls – Lists all files in a directory
ls –a – Lists all files (including hidden files)
ls –l – Lists files in a directory along with owner
information, permission etc
ls –R recursive list
PATH
-r-xr-xr-x 1 root root 68524 2011-12-19 07:18 /usr/bin/top
---------- --- ------- ------- -------- ------------ -------------
| | | | | | |
| | | | | | File Name
| | | | | |
| | | | | +--- Modification Time/Date
| | | | |
| | | | +------------- Size (in bytes
| | | |
| | | +----------------------- Group
| | |
| | +-------------------------------- Owner
| |
| +-------------------------------------- “link count”
|
+---------------------------------------------- File Permissions
Group
The name of the group that has permissions in addition to the file's owner.
Owner
The name of the user who owns the file.
File Permissions
The first character is the type of file. A "-" indicates a regular (ordinary)
file. A "d” indicate a directory. Second set of 3 characters represent the
read, write, and execution rights of the file's owner. Next 3 represent the
rights of the file's group, and the final 3 represent the rights granted to
everybody else.
(Example modified from http://www.linuxcommand.org/lts0030.php)
Types of filename and users
 When looking at the output from “ls -l” in the first column you might see:
d = directory
- = regular file
l = symbolic link
s = Unix domain socket
p = named pipe
c = character device file
b = block device file
Type of users
There are two ways to set permissions when
using the chmod command:
Symbolic mode:
testfile has permissions of -r--r--r--
U G O*
$ chmod g+x testfile ==> -r--r-xr--
$ chmod u+wx testfile ==> -rwxr-xr--
$ chmod ug-x testfile ==> -rw--r--r--
U=user, G=group, O=other (world)
File permissions, Viewing And Changing
FAP’S
Absolute mode:
We use octal (base eight) values represented like this:
Letter Permission Value
R read 4
W write 2
X execute 1
- none 0
For each column, User, Group or Other you can set
values from 0 to 7. Here is what each means:
0= --- 1= --x 2= -w- 3= -wx
4= r-- 5= r-x 6= rw- 7= rwx
File permissions cont.
Numeric mode cont:
Example index.html file with typical permission values:
$ chmod 755 index.html
$ ls -l index.html
-rwxr-xr-x 1 root wheel 0 May 24 06:20 index.html
$ chmod 644 index.html
$ ls -l index.html
-rw-r--r-- 1 root wheel 0 May 24 06:20 index.html
File permissions cont.
Two critical points:
1.The permissions of a directory affect whether
someone can see its contents or add or
remove files in it.
2.The permissions on a file determine what a
user can do to the data in the file.
Example:
If you don't have write permission for a directory, then you can't
delete a file in the directory. If you have write access to the file
you can update the data in the file.
Inherited permissions
.
$umask
022
$umask 755
Further file permissions by default shall be 022 (777-
755)
Masking permissions
TEXT EDITOR
VI Editor(Visual Editor)
 Popular text editor
 Just type vi <<filename>> at the prompt and hit the
enter key.
 A new file will be opened
 Type the contents needed and save
 To save, press the Esc Key and then press : (colon) w
q and then enter
 To quit with out saving Esc + : + q and then enter
Vi editor
 Navigation
 Left - h
 Down- j
 Up - k
 Right - l
 Top of the screen – H (shift + h) //caps lock will not work
 Middle of the screen – M (shift + m)
 Bottom of the screen – L (shift + l)
 $ - End Key, 0 – Home Key
 Edit Commands
 Cut – X, x
 Copy – yy, yw
 Paste – P, p
Locating Files
Redirection and Pipes
 Redirection
 Input redirection
wc < file1 – Content of file 1 is given as input for wc
command that counts the no of lines, words and
characters in a file
 Output redirection
cat file1 > newfile – Copies file’s content to newfile. Over
writes the existing content
cat file1 >> newfile – Appends the new content to the
existing content
 Pipes
 Output of first command is input for the second and so on
 who | wc –l l– Number of lines in the output of who
command will be displayed
FILTERS
Module1
Module1
Module1
Module1

More Related Content

What's hot

What's hot (20)

Introduction 2 linux
Introduction 2 linuxIntroduction 2 linux
Introduction 2 linux
 
Linux
Linux Linux
Linux
 
Linux.ppt
Linux.ppt Linux.ppt
Linux.ppt
 
computer notes - Unix primer
computer notes - Unix primercomputer notes - Unix primer
computer notes - Unix primer
 
Introduction to Linux
Introduction to LinuxIntroduction to Linux
Introduction to Linux
 
Linux course details
Linux course detailsLinux course details
Linux course details
 
Linux basics
Linux basicsLinux basics
Linux basics
 
Presentation on linux
Presentation on linuxPresentation on linux
Presentation on linux
 
Linux notes
Linux notesLinux notes
Linux notes
 
Chapter 1: Introduction to Unix / Linux Kernel
Chapter 1: Introduction to Unix / Linux KernelChapter 1: Introduction to Unix / Linux Kernel
Chapter 1: Introduction to Unix / Linux Kernel
 
Linux
LinuxLinux
Linux
 
UNIX Operating System
UNIX Operating SystemUNIX Operating System
UNIX Operating System
 
Unix files
Unix filesUnix files
Unix files
 
OS Lab: Introduction to Linux
OS Lab: Introduction to LinuxOS Lab: Introduction to Linux
OS Lab: Introduction to Linux
 
Linux operating system
Linux operating systemLinux operating system
Linux operating system
 
Linux operating system - Overview
Linux operating system - OverviewLinux operating system - Overview
Linux operating system - Overview
 
Linux Operating System
Linux Operating SystemLinux Operating System
Linux Operating System
 
Operating systems unix
Operating systems   unixOperating systems   unix
Operating systems unix
 
Ppt af linux
Ppt af linuxPpt af linux
Ppt af linux
 
Introduction to Linux
Introduction to Linux Introduction to Linux
Introduction to Linux
 

Similar to Module1

Introduction, Features, Basic Commands and Distribution of LINUX
Introduction, Features, Basic Commands and Distribution of LINUXIntroduction, Features, Basic Commands and Distribution of LINUX
Introduction, Features, Basic Commands and Distribution of LINUXDeeksha Verma
 
Introduction to linux
Introduction to linuxIntroduction to linux
Introduction to linuxPrasanth V
 
linux-lecture1.ppt
linux-lecture1.pptlinux-lecture1.ppt
linux-lecture1.pptjeronimored
 
chapter 3 linux-lecture.ppt
chapter 3 linux-lecture.pptchapter 3 linux-lecture.ppt
chapter 3 linux-lecture.pptanwarkade1
 
Linux Basics Knowlage sharing.pptx
Linux Basics Knowlage sharing.pptxLinux Basics Knowlage sharing.pptx
Linux Basics Knowlage sharing.pptxbemnitekalegn
 
UNIT II-Programming in Linux
UNIT II-Programming in LinuxUNIT II-Programming in Linux
UNIT II-Programming in LinuxDr.YNM
 
Linux Presentation_SSD.pdf
Linux Presentation_SSD.pdfLinux Presentation_SSD.pdf
Linux Presentation_SSD.pdfssuser37b0e0
 
Linux Operating System. UOG MARGHAZAR Campus
 Linux Operating System. UOG MARGHAZAR Campus Linux Operating System. UOG MARGHAZAR Campus
Linux Operating System. UOG MARGHAZAR CampusSYEDASADALI38
 
UNIT I LINUX.docx
UNIT I LINUX.docxUNIT I LINUX.docx
UNIT I LINUX.docxBhuvanaR13
 
linux-lecture1.ppt
linux-lecture1.pptlinux-lecture1.ppt
linux-lecture1.pptNikhil Raut
 
Linux@assignment ppt
Linux@assignment pptLinux@assignment ppt
Linux@assignment pptRama .
 

Similar to Module1 (20)

3CS LSP UNIT 1-1.pdf
3CS LSP UNIT 1-1.pdf3CS LSP UNIT 1-1.pdf
3CS LSP UNIT 1-1.pdf
 
UNIX_module1.pptx
UNIX_module1.pptxUNIX_module1.pptx
UNIX_module1.pptx
 
Introduction, Features, Basic Commands and Distribution of LINUX
Introduction, Features, Basic Commands and Distribution of LINUXIntroduction, Features, Basic Commands and Distribution of LINUX
Introduction, Features, Basic Commands and Distribution of LINUX
 
Introduction to linux
Introduction to linuxIntroduction to linux
Introduction to linux
 
Intro to linux
Intro to linuxIntro to linux
Intro to linux
 
linux-lecture1.ppt
linux-lecture1.pptlinux-lecture1.ppt
linux-lecture1.ppt
 
chapter 3 linux-lecture.ppt
chapter 3 linux-lecture.pptchapter 3 linux-lecture.ppt
chapter 3 linux-lecture.ppt
 
Linux Basics Knowlage sharing.pptx
Linux Basics Knowlage sharing.pptxLinux Basics Knowlage sharing.pptx
Linux Basics Knowlage sharing.pptx
 
Linux technology
Linux technologyLinux technology
Linux technology
 
UNIT II-Programming in Linux
UNIT II-Programming in LinuxUNIT II-Programming in Linux
UNIT II-Programming in Linux
 
Linux
LinuxLinux
Linux
 
Spsl unit1
Spsl   unit1Spsl   unit1
Spsl unit1
 
Linux Presentation_SSD.pdf
Linux Presentation_SSD.pdfLinux Presentation_SSD.pdf
Linux Presentation_SSD.pdf
 
Linux Operating System. UOG MARGHAZAR Campus
 Linux Operating System. UOG MARGHAZAR Campus Linux Operating System. UOG MARGHAZAR Campus
Linux Operating System. UOG MARGHAZAR Campus
 
UNIT I LINUX.docx
UNIT I LINUX.docxUNIT I LINUX.docx
UNIT I LINUX.docx
 
linux-lecture1.ppt
linux-lecture1.pptlinux-lecture1.ppt
linux-lecture1.ppt
 
Linux basics
Linux basicsLinux basics
Linux basics
 
Linux@assignment ppt
Linux@assignment pptLinux@assignment ppt
Linux@assignment ppt
 
Ch1-Unix.pptx
Ch1-Unix.pptxCh1-Unix.pptx
Ch1-Unix.pptx
 
Linuxppt.pptx
Linuxppt.pptxLinuxppt.pptx
Linuxppt.pptx
 

Recently uploaded

Full Stack Web Development Course for Beginners
Full Stack Web Development Course  for BeginnersFull Stack Web Development Course  for Beginners
Full Stack Web Development Course for BeginnersSabitha Banu
 
Introduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxIntroduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxpboyjonauth
 
Introduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher EducationIntroduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher Educationpboyjonauth
 
Employee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxEmployee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxNirmalaLoungPoorunde1
 
KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...
KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...
KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...M56BOOKSTORE PRODUCT/SERVICE
 
Pharmacognosy Flower 3. Compositae 2023.pdf
Pharmacognosy Flower 3. Compositae 2023.pdfPharmacognosy Flower 3. Compositae 2023.pdf
Pharmacognosy Flower 3. Compositae 2023.pdfMahmoud M. Sallam
 
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17Celine George
 
MARGINALIZATION (Different learners in Marginalized Group
MARGINALIZATION (Different learners in Marginalized GroupMARGINALIZATION (Different learners in Marginalized Group
MARGINALIZATION (Different learners in Marginalized GroupJonathanParaisoCruz
 
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPTECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPTiammrhaywood
 
Painted Grey Ware.pptx, PGW Culture of India
Painted Grey Ware.pptx, PGW Culture of IndiaPainted Grey Ware.pptx, PGW Culture of India
Painted Grey Ware.pptx, PGW Culture of IndiaVirag Sontakke
 
Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17Celine George
 
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdfEnzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdfSumit Tiwari
 
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdfssuser54595a
 
Framing an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdf
Framing an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdfFraming an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdf
Framing an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdfUjwalaBharambe
 
Alper Gobel In Media Res Media Component
Alper Gobel In Media Res Media ComponentAlper Gobel In Media Res Media Component
Alper Gobel In Media Res Media ComponentInMediaRes1
 
Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)eniolaolutunde
 
Presiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha electionsPresiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha electionsanshu789521
 
EPANDING THE CONTENT OF AN OUTLINE using notes.pptx
EPANDING THE CONTENT OF AN OUTLINE using notes.pptxEPANDING THE CONTENT OF AN OUTLINE using notes.pptx
EPANDING THE CONTENT OF AN OUTLINE using notes.pptxRaymartEstabillo3
 
Solving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxSolving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxOH TEIK BIN
 

Recently uploaded (20)

Full Stack Web Development Course for Beginners
Full Stack Web Development Course  for BeginnersFull Stack Web Development Course  for Beginners
Full Stack Web Development Course for Beginners
 
Introduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxIntroduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptx
 
9953330565 Low Rate Call Girls In Rohini Delhi NCR
9953330565 Low Rate Call Girls In Rohini  Delhi NCR9953330565 Low Rate Call Girls In Rohini  Delhi NCR
9953330565 Low Rate Call Girls In Rohini Delhi NCR
 
Introduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher EducationIntroduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher Education
 
Employee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxEmployee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptx
 
KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...
KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...
KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...
 
Pharmacognosy Flower 3. Compositae 2023.pdf
Pharmacognosy Flower 3. Compositae 2023.pdfPharmacognosy Flower 3. Compositae 2023.pdf
Pharmacognosy Flower 3. Compositae 2023.pdf
 
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
 
MARGINALIZATION (Different learners in Marginalized Group
MARGINALIZATION (Different learners in Marginalized GroupMARGINALIZATION (Different learners in Marginalized Group
MARGINALIZATION (Different learners in Marginalized Group
 
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPTECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
 
Painted Grey Ware.pptx, PGW Culture of India
Painted Grey Ware.pptx, PGW Culture of IndiaPainted Grey Ware.pptx, PGW Culture of India
Painted Grey Ware.pptx, PGW Culture of India
 
Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17
 
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdfEnzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
 
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
 
Framing an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdf
Framing an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdfFraming an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdf
Framing an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdf
 
Alper Gobel In Media Res Media Component
Alper Gobel In Media Res Media ComponentAlper Gobel In Media Res Media Component
Alper Gobel In Media Res Media Component
 
Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)
 
Presiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha electionsPresiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha elections
 
EPANDING THE CONTENT OF AN OUTLINE using notes.pptx
EPANDING THE CONTENT OF AN OUTLINE using notes.pptxEPANDING THE CONTENT OF AN OUTLINE using notes.pptx
EPANDING THE CONTENT OF AN OUTLINE using notes.pptx
 
Solving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxSolving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptx
 

Module1

  • 1. LINUX OS AND SHELL PROGRAMMING MODULE 1 PREPARED BY SHAHILA SHAHUL ASSISTANT PROFESSOR MCA DEPARTMENT MES AIMAT MARAMPALLY
  • 2. syllabus  UNIT I  Introduction to Linux – History, Architecture, Comparison with UNIX, Features and Facilities of Linux, Basic commands in Linux,  Files and File Structure - Linux File System, Boot block, Super block, Inode table, Data blocks, Linux standard directories. File naming Conventions, Path, Types of file names and Users, File Commands in Linux, file comparisons, Directory Commands,  Text Editors-Functions of a Text Editor, vi Editor, Locating Files, File Access Permissions [FAP], Viewing and Changing FAPs, Redirection, Filters, Pipes.
  • 3. Linux evolved from a project started by a university student to the robust OS it is now
  • 4. HISTORY In June 1971, Richard Matthew Stallman joined MIT Artificial Intelligence Laboratory as a programmer where he gained popularity with the hacker community and came to be known by his now popular name RMS. • At that time, all the programmers used to share their code freely among each other cutting across various institutions
  • 5.  In 1980, with the advent of portable software - ie software that can be compiled to run on different computers, a business model emerged.  So the companies developing the code refused to share the code with their clients and began restricting copying and redistribution of their software by copyrighting it.  In response to this trend, Stallman, who believed in the principle that software has to be free always, founded the Free Software Foundation and in 1985, published the GNU Manifesto.  This manifesto outlined his motivation for creating a free OS called GNU, which would be compatible with Unix.
  • 6.  He along with a group of like minded programmers started work in developing the tools needed to make a complete OS
  • 8.  In 1989, Stallman released the first program independent GNU General Public Licence now popularly known as GPL or copyleft.  Now the only thing that GNU lacked was a completely free OS kernel  In 1990, A finnish student by name Linus Torvalds studying in the University of Helsinki came into contact with Andy Tanenbaum's OS, Minix.  Linus wanted to upgrade Minix by putting in more features and improvements.  But he was prohibited by Tanenbaum to do so.  Then Linus decided to write his own kernel and released it under GPL.  This kernel is now popularly known as Linux
  • 10. Tux the penguin: Linux’s Dear Logo
  • 12.  1). The kernel is the core part of the operating system, which is responsible for all the major activities of the LINUX operating system. This operating system consists of different modules and interacts directly with the underlying hardware. The kernel offers the required abstraction to hide application programs or low- level hardware details to the system. The types of Kernels are as follows: • Monolithic Kernel • Microkernels • Exo kernels • Hybrid kernels  2). System libraries are special functions, that are used to implement the functionality of the operating system and do not require code access rights of kernel modules.  3). System Utility programs are liable to do individual and specialized-level tasks.
  • 13.  4). The hardware layer of the LINUX operating system consists of peripheral devices such as RAM, HDD, CPU.  5). The shell is an interface between the user and the kernel, and it affords services of the kernel. It takes commands from the user and executes the kernel’s functions. The Shell is present in different types of operating systems, which are classified into two types: command-line shells and graphical shells.  The command-line shells provide a command-line interface, while the graphical line shells provide a graphical user interface. Though both shells perform operations, the graphical user interface shells perform slower than the command line interface shells. Types of shells are classified into four: • Korn shell • Bourne shell • C shell • POSIX shell
  • 14.  Features of Unix OS • When compare Unix to Linux, Unix is a Multi-user, multitasking operating system • It can be used as the master control program in workstations and servers. • Hundreds of commercial applications are available • In its heydays, UNIX was rapidly adopted and became the standard OS in universities.
  • 15.  Features of Linux Operating System • Support multitasking • Programs consist of one or more processes, and each process have one or more threads • It can easily co-exists along with other Operating systems. • Comparing features of Linux and Unix, Linux can run multiple user programs • Individual accounts are protected because of appropriate authorization • When comparing Unix vs Linux, Linux is a replica of UNIX but does not use its code.
  • 16.  KEY DIFFERENCE • Comparing Unix vs Linux, Linux source code is available to the general public whereas, in Unix, the source code is proprietary. • UNIX OS was created in the late 1960s at AT&T Bell Labs whereas Linux is an operating system built by Linus Torvalds at the University of Helsinki in 1991. • The main difference between Linux and Unix is Linux is a clone of Unix • When we compare Unix to Linux, Linux default shell is BASH while the Unix shell is Bourne Shell. • One key Unix and Linux difference is that Linux threat detection and solution are very fast while Unix users require longer wait times to get the proper bug fixing patch. • Important versions of Linux are Redhat, Ubuntu, OpenSource, Solaris, whereas important versions of Unix are HP-UX, AIS, BSD, etc.
  • 17. Features and Facilities of Linux  Following are some of the important features of Linux Operating System. • Portable – Portability means software's can works on different types of hardware's in same way. Linux kernel and application programs supports their installation on any kind of hardware platform. • Open Source – Linux source code is freely available and it is community based development project. Multiple teams works in collaboration to enhance the capability of Linux operating system and it is continuously evolving. • Multi-User – Linux is a multiuser system means multiple users can access system resources like memory/ ram/ application programs at same time. • Multiprogramming – Linux is a multiprogramming system means multiple applications can run at same time. • Hierarchical File System – Linux provides a standard file structure in which system files/ user files are arranged. • Shell – Linux provides a special interpreter program which can be used to execute commands of the operating system. It can be used to do various types of operations, call application programs etc. • Security – Linux provides user security using authentication features like password protection/ controlled access to specific files/ encryption of data.
  • 19.
  • 20.
  • 21.
  • 22.
  • 23.
  • 24.
  • 25.
  • 26.
  • 27.
  • 29.
  • 31.
  • 32.
  • 33.
  • 34.
  • 35.
  • 38.
  • 39.
  • 40.
  • 41.
  • 42. File naming convention 1. All file names are case sensitive. So filename vivek.txt Vivek.txt VIVEK.txt all are three different files. 2. You can use upper and lowercase letters, numbers, “.” (dot), and “_” (underscore) symbols. 3. You can use other special characters such as blank space, but they are hard to use and it is better to avoid them. 4. In short, filenames may contain any character except / (root directory), which is reserved as the separator between files and directories in a pathname. You cannot use the null character. 5. No need to use . (dot) in a filename. Some time dot improves readability of filenames. And you can use dot based filename extension to identify file. For example: • .sh = Shell file • .tar.gz = Compressed archive
  • 43.  Most modern Linux and UNIX limit filename to 255 characters (255 bytes). However, some older version of UNIX system limits filenames to 14 characters only.  A filename must be unique inside its directory. For example, inside /home/vivek directory you cannot create a demo.txt file and demo.txt directory name. However, other directory may have files with the same names. For example, you can create demo.txt directory in /tmp.  Please note that Linux and UNIX allows white spaces, , |, , :, (, ), &, ;, as well as wildcards such as ? and *, to be quoted or escaped using symbol.
  • 44. File Management Commands  mkdir - creating directory mkdir dirname  rmdir – removing directory and its contents rmdir dirname  cd – Change directory cd dirpath  cp – Copying files cp file1 file2  mv – Moving or renaming files mv oldfile newfile
  • 45. File Management – contd.. ln – Creating links between files ln file1 file2 Difference between copying files and linking files cp src dst  Contents of src will be present in dst  Changing content in src will not affect contents of dst and vice versa ln src dst  Contents of src will be present in dst  Changing content in src or dst will get reflected in the other file
  • 46. Commands  Help about commands  Man (man <<cmd name>>)  Viewing file’s content  cat <<filename>>  Viewing users  who – List all Users  who am I – List the current user  Changing file permission/owner  chmod – changes file permission  chown – changes file owner
  • 47. User information in /etc/passwd Password info is in /etc/shadow Group information is in /etc/group /etc/passwd and /etc/group divide data fields using “:” /etc/passwd: joeuser:x:1000:1000:Joe User,,,:/home/joeuser:/bin/bash /etc/group: joeuser:x:1000:
  • 48. • ps – displays processes owned by the current user • ps – ef displays all processes. • pstree – displays all processes running in the system in tree format
  • 49. Listing files and Emulating Terminal Listing files in a directory ls – Lists all files in a directory ls –a – Lists all files (including hidden files) ls –l – Lists files in a directory along with owner information, permission etc ls –R recursive list
  • 50.
  • 51. PATH -r-xr-xr-x 1 root root 68524 2011-12-19 07:18 /usr/bin/top ---------- --- ------- ------- -------- ------------ ------------- | | | | | | | | | | | | | File Name | | | | | | | | | | | +--- Modification Time/Date | | | | | | | | | +------------- Size (in bytes | | | | | | | +----------------------- Group | | | | | +-------------------------------- Owner | | | +-------------------------------------- “link count” | +---------------------------------------------- File Permissions Group The name of the group that has permissions in addition to the file's owner. Owner The name of the user who owns the file. File Permissions The first character is the type of file. A "-" indicates a regular (ordinary) file. A "d” indicate a directory. Second set of 3 characters represent the read, write, and execution rights of the file's owner. Next 3 represent the rights of the file's group, and the final 3 represent the rights granted to everybody else. (Example modified from http://www.linuxcommand.org/lts0030.php)
  • 52. Types of filename and users  When looking at the output from “ls -l” in the first column you might see: d = directory - = regular file l = symbolic link s = Unix domain socket p = named pipe c = character device file b = block device file
  • 53.
  • 55. There are two ways to set permissions when using the chmod command: Symbolic mode: testfile has permissions of -r--r--r-- U G O* $ chmod g+x testfile ==> -r--r-xr-- $ chmod u+wx testfile ==> -rwxr-xr-- $ chmod ug-x testfile ==> -rw--r--r-- U=user, G=group, O=other (world) File permissions, Viewing And Changing FAP’S
  • 56. Absolute mode: We use octal (base eight) values represented like this: Letter Permission Value R read 4 W write 2 X execute 1 - none 0 For each column, User, Group or Other you can set values from 0 to 7. Here is what each means: 0= --- 1= --x 2= -w- 3= -wx 4= r-- 5= r-x 6= rw- 7= rwx File permissions cont.
  • 57. Numeric mode cont: Example index.html file with typical permission values: $ chmod 755 index.html $ ls -l index.html -rwxr-xr-x 1 root wheel 0 May 24 06:20 index.html $ chmod 644 index.html $ ls -l index.html -rw-r--r-- 1 root wheel 0 May 24 06:20 index.html File permissions cont.
  • 58. Two critical points: 1.The permissions of a directory affect whether someone can see its contents or add or remove files in it. 2.The permissions on a file determine what a user can do to the data in the file. Example: If you don't have write permission for a directory, then you can't delete a file in the directory. If you have write access to the file you can update the data in the file. Inherited permissions
  • 59. . $umask 022 $umask 755 Further file permissions by default shall be 022 (777- 755) Masking permissions
  • 61.
  • 62. VI Editor(Visual Editor)  Popular text editor  Just type vi <<filename>> at the prompt and hit the enter key.  A new file will be opened  Type the contents needed and save  To save, press the Esc Key and then press : (colon) w q and then enter  To quit with out saving Esc + : + q and then enter
  • 63. Vi editor  Navigation  Left - h  Down- j  Up - k  Right - l  Top of the screen – H (shift + h) //caps lock will not work  Middle of the screen – M (shift + m)  Bottom of the screen – L (shift + l)  $ - End Key, 0 – Home Key  Edit Commands  Cut – X, x  Copy – yy, yw  Paste – P, p
  • 65.
  • 66. Redirection and Pipes  Redirection  Input redirection wc < file1 – Content of file 1 is given as input for wc command that counts the no of lines, words and characters in a file  Output redirection cat file1 > newfile – Copies file’s content to newfile. Over writes the existing content cat file1 >> newfile – Appends the new content to the existing content  Pipes  Output of first command is input for the second and so on  who | wc –l l– Number of lines in the output of who command will be displayed