SlideShare a Scribd company logo
Linux Basics and
Shell Scripting
Rohith Ninan and Akshay Warrier
What Is Linux?
What Is Linux?
● Linux is a family of open-source
operating systems.
● Released in September 17, 1991 by
Linus Torvalds.
● Developed based on the Intel x86
architecture.
● Has been ported to more platforms
than any other operating system.
● Runs on Android, Embedded Systems,
Supercomputers and powers over
96.4% servers of the world.
Linux or GNU/Linux?
Linux or GNU/Linux?
● Operating systems consist of many components
● The kernel provides the most basic level of control over
all of the computer's hardware devices.
● It manages the RAM, the CPU and the devices connected to
it.
Linux or GNU/Linux?
● “Linux” refers to the kernel
● All the supporting system
software and libraries were
provided by the GNU Project.
● GNU Project - Founded by Richard
Stallman, first publicly
announced on September 27,
1983.
● He was the originator of the
many ideas about ‘Free Software’
● The Free Software Foundation
emphasises on the use of
“GNU/Linux” but today most
people simply call it ‘Linux’
How It All Started
How It All Started
Ken Thompson (sitting) and Dennis
Ritchie working together at a PDP-11
>ken thompson, dennis ritchie, douglas
mcilroy, and joe ossanna - exist
>got bored and made unix in 1969 at
at&t bell labs
>completely written in assembly
>dennis realizes “oopsie assembly not very
portable, brb lemme make C”
>starts selling unix as proprietary
product
>unix stonks go brr
>stallman enters the chat
>stallman goes “ples make unix compatible
free software”
>by 1990s most gnu software was complete
but they still needed a kernel
How It All Started
>minix enters the chat
>made by andrew s tanenbaum in 1987
>was made for educational purposes
>its licensing didnt allow it to be
called ‘free software’
>linus exists
>linus sadge
>makes open source and free kernel
>also makes git since that wasnt
enough
How It All Started
Linux Distributions
Linux Distributions
● A Linux distribution (commonly called a distro) is any
operating system that makes use of the Linux kernel
● It can be thought of as the many different flavours it
comes in.
● Each distro is unique and has its own set of philosophies
and communities supporting it.
● Its free and open source nature allows it to be modified
and tailored to different use cases.
Linux Distributions
● Some distros are used for
pen-testing, and some are
tailored to work efficiently
on servers
● While other distros are just
designed for everyday normal
tasks.
Fedora Linux
Pop!_OS
https://upload.wikimedia.org/wikipedia/commons/b/b5/Linux_Distribution_Timeline_21_10_2021.svg
Accurate
description of how
to choose an OS
The UNIX Philosophy
The UNIX philosophy
● All the core UNIX system tools were designed so that they
could operate together.
● Using this philosophy programmers avoided writing some
parts of their program that had already been written by
someone else, and could instead recycle the code.
● This philosophy lives on today in GNU/Linux.
The UNIX philosophy
Monolithic Design
● One big thing
● Does a lot of things
● Does nothing it’s designed to do well
● Difficult to add features without a
design overhaul
Modular Design
● Made up of simple pieces
● Each piece does one thing well
● Every piece is well designed
● Adding features is trivial
The UNIX philosophy
The core UNIX philosophy can be summarised as follows:
● Write programs that Do One Thing And Do It Well (DOTADIW)
● Write programs to work together.
● Write programs to handle text streams, because that is a
universal interface.
Desktop Environments
Desktop Environment
● Components that provides GUI
elements, like toolbar,
wallpaper etc.
● Unlike Windows and MacOS,
Linux has a modular Desktop
Environment, separate from
the OS itself
● Allows extensive
customisation and the
ability to choose a desktop
environment that you like.
GNOME
Popular Desktop Environments
KDE Plasma
MATE LXQt
The Shell
The Shell
● Shell, terminal, console,
command line.
● Olden days of Linux, all you
had to work with was the shell.
● System admins, programmers, and
users all sat at something
called a Linux console
terminal.
● The command line allowed text
input only and could display
only text and rudimentary
graphics output.
Types of Terminals
● Graphical Terminals
Terminal emulators that simulate
working on a console terminal but
within a graphical desktop
window.
● Console Terminals
○ Also called a tty
○ Takes linux out of graphical
mode
○ Emulates the old days of a
Bash
● Bash(Bourne Again Shell), written by Brian Fox for
the GNU Project as a free software replacement for
the Bourne shell.
● Was one of the first programs Linus Torvalds ported
to Linux, alongside GCC.
● The default shell used in many Linux distributions
● Other shells - Zsh and Fish, more feature rich than
bash, provide syntax highlighting, auto-correction
features and have tons of plugins.
The Linux File System
The LINUX File System
● Logical collection of files on a partition or disk
● It manages the file name, file size, creation date, and
much more information about a file.
"On a UNIX system, everything is a file; if something is not
a file, it is a process."
● Just like UNIX, Linux makes no difference between a file
and a directory. A directory is just a file containing
names of other files.
● Programs, services, and input and output devices are also
considered to be files, according to the system.
The LINUX File System
The LINUX File System
Key Features:
● Hierarchical file structure : root directory (/)
● Forward slash (/) in path
● No drive letters
● Case Sensitive
● File Extensions : Not necessary. File type is decoded from
its contents.
● Hidden files - eg configuration file
Basic Linux Commands
ls
cd
pwd
file
touch
mkdir
mv
cp
rm
cat
echo
head/tail
grep
neofetch
top/htop
Environment Variables
Environment Variables
● Defines your Linux shell experience.
● Programs and scripts use environment variables to obtain
system information and store temporary data and
configuration information
● There are two environment variable types in the bash
shell
1. Global Variables
2. Local Variables
Environment Variables
● Global environment variables are visible from the shell
session and from any spawned child subshells.
● Local variables are available only in the shell that
creates them
● printenv, env, echo
● set displays all environment variables
● Global vars - Uppercase
● Local vars - Lowercase
Environment Variables
● A local variable created in parent shell does not pass
down to a child shell
● A local variable set within the child shell doesn’t exist
after a return to the parent shell
● export - exports a local variable as a global variable
● A global variable’s value can be read by a child shell,
but its value can’t be changed even with export.
● unset - remove environment variable
The PATH Environment Variable
● Contains the paths to programs and commands separated
with :
● When a command is entered, the shell searches for the
program in all the paths defined in the PATH variable
● If a new program is installed in a directory not
mentioned in PATH then a new entry needs to be added
● PATH=$PATH:<enter new path>
● The changes made to environment variables don’t persist
between reboots
● .bashrc,.zshrc,.profile
Shell Special Characters
Shell Special Characters
$ variable substitution or expand value of variable
> output redirection
>> output redirection to append
* match any number of characters
? match one character
`cmd`
$(cmd)
execute command cmd
| pipe the output of one command to the input of another
 escape interpretation of a character
Users Groups and
Permissions
Users, Groups and Permissions
● Linux is designed for multiple users to have access to
the same system at the same time
● Managing access to resources is a fundamental task
● Linux divides authorization into two:
1. Ownership
2. Permission
Users, Groups and Permissions
What is a “user”?
Entity that can access the resources of the system.
Types of users:
1. Root user
2. Regular user
3. Service account
A user can belong to one or more groups.
Users, Groups and Permissions
What is a “group”?
● Collection of users.
● Primary group: automatically associated with each user
● A user can also be part of zero or more secondary groups.
● Many distros add the standard user to some useful
secondary groups by default.
Users, Groups and Permissions
Some standard groups:
● sudo
● dialout
● adm
● plugdev
● lpadmin
● audio, video
Users, Groups and Permissions
/etc/passwd
/etc/group
/etc/shadow
Users, Groups and Permissions
Users, Groups and Permissions
File Directory
read read contents
list the contents of the
directory
write modify contents
create, delete and rename
files in the directory
execute run as a program
enter the directory, and
access files and
directories inside
Users, Groups and Permissions
chown,chgrp
chown master file.txt
change owner of file to the user “master”
chown :group1 file.txt
chgrp group1 file.txt
change group owner of file to the group
“group1”
chown master:group1 file.txt
Users, Groups and Permissions
chmod
● Symbolic Mode:
chmod ug+x o-r file.txt
chmod o+w file.txt
● Numeric mode:
chmod 770 file.txt
chmod 644 file.txt
7 rwx 111
6 rw- 110
5 r-x 101
4 r-- 100
3 -wx 011
2 -w- 010
1 --x 001
0 --- 000
Users, Groups and Permissions
Package Managers
Package Managers
● Allows users to install,
remove, upgrade,
configure and manage
software packages on an
operating system.
● May be a graphical or a
command line tool
● Packages used to be built
from source but now
package managers are used
Package Managers
● Packaging formats - .deb,
.rpm, .tar.gz
● Different methods of
install for a distro -
dpkg -i, apt install,
pacman -Syu, dnf install
● Repositories - ensure
integrity and
authenticity using
checksums and digital
signatures
● AUR
● Dependency hell
Everyday stuff
Commonly Used Softwares in Linux
Softwares like...
● Spotify
● Discord
● Visual Studio Code
...are available on Linux.
Open Source softwares like...
● GNU Image Manipulation Program (GIMP), Inkscape, Krita
● LibreOffice, OpenOffice
● GNOME and KDE utilities
● VLC Media Player
● Firefox
...natively support Linux.
WINE
● Wine Is Not an Emulator
● Compatibility layer that allows softwares
developed for Windows to run on Linux
● Can be used to install and run softwares
like
○ Adobe Photoshop
○ MS Office
○ Games
on Linux
Bottles : A modern graphical front-end
for wine
Getting Help
● --help
● man <command>
● Google search
● Online forums:
○ StackOverflow
○ Ubuntu Forums
● wiki.archlinux.org, and similar wikis of other distros
● Blogs like ‘It’s FOSS’
● Reddit
Ricing
Exercises
Clone the repository of AutoJoomer: https://github.com/vishal-lokare/AutoJoomer
“cd” into the repository.
1. List all the files and directories in the directory and save it to a file named "contents".
2. Read the file "contents" using the terminal. You should see the names of files.
3. Now, use the "sort" command to sort the names of files in descending order and save the
output to a file named "contents_desc".
4. Change working directory to “src/pages/login”. Search for files "js" in the name using ls,
grep and pipe (|).
5. Challenging: Change working directory to src/pages/login. Search for "AutoJoomer" in the
contents of all the file in the directory. Hint: Use grep and wildcards.
6. Install neofetch and htop through the terminal. (Use the apt commands if you are on Ubuntu).
7. Search for "scientific calculator" in your package manager (apt, if you are using Ubuntu).
References
● Linux Command Line and Shell Scripting
● Package Managers - It’s Foss
● Users, Groups and Permissions - Medium
● File Permissions - Guru 99

More Related Content

Similar to Introduction to Linux

Linux administration training
Linux administration trainingLinux administration training
Linux administration training
iman darabi
 
Linux
LinuxLinux
Linux basic
Linux basicLinux basic
Linux basic
Pragyagupta37
 
Linux
LinuxLinux
Linux concept workshop
Linux concept workshopLinux concept workshop
Linux concept workshop
Tahmoures Shabanian
 
Introduction to linux
Introduction to linuxIntroduction to linux
Introduction to linux
Prasanth V
 
Linuxtraining 130710022121-phpapp01
Linuxtraining 130710022121-phpapp01Linuxtraining 130710022121-phpapp01
Linuxtraining 130710022121-phpapp01Chander Pandey
 
Network and System Administration Power Point
Network and System Administration Power PointNetwork and System Administration Power Point
Network and System Administration Power Point
kemal678348
 
UNIX/Linux training
UNIX/Linux trainingUNIX/Linux training
UNIX/Linux training
Michael Olafusi
 
3CS LSP UNIT 1-1.pdf
3CS LSP UNIT 1-1.pdf3CS LSP UNIT 1-1.pdf
3CS LSP UNIT 1-1.pdf
DeepakKumar783815
 
Introduction to linux
Introduction to linuxIntroduction to linux
Introduction to linux
nanocdac
 
Hillel kobrovski Linux security overview for ciso
Hillel kobrovski   Linux security overview for cisoHillel kobrovski   Linux security overview for ciso
Hillel kobrovski Linux security overview for ciso
Hillel Kobrovski
 
Linux
LinuxLinux

Similar to Introduction to Linux (20)

Linux administration training
Linux administration trainingLinux administration training
Linux administration training
 
Linux
LinuxLinux
Linux
 
Linux forensics
Linux forensicsLinux forensics
Linux forensics
 
Linux basic
Linux basicLinux basic
Linux basic
 
Linux
LinuxLinux
Linux
 
Linux concept workshop
Linux concept workshopLinux concept workshop
Linux concept workshop
 
Linux basics
Linux basicsLinux basics
Linux basics
 
Introduction to linux
Introduction to linuxIntroduction to linux
Introduction to linux
 
Linuxtraining 130710022121-phpapp01
Linuxtraining 130710022121-phpapp01Linuxtraining 130710022121-phpapp01
Linuxtraining 130710022121-phpapp01
 
Network and System Administration Power Point
Network and System Administration Power PointNetwork and System Administration Power Point
Network and System Administration Power Point
 
UNIX/Linux training
UNIX/Linux trainingUNIX/Linux training
UNIX/Linux training
 
Linux Presentation
Linux PresentationLinux Presentation
Linux Presentation
 
3CS LSP UNIT 1-1.pdf
3CS LSP UNIT 1-1.pdf3CS LSP UNIT 1-1.pdf
3CS LSP UNIT 1-1.pdf
 
Linux
LinuxLinux
Linux
 
Introduction to linux
Introduction to linuxIntroduction to linux
Introduction to linux
 
Hillel kobrovski Linux security overview for ciso
Hillel kobrovski   Linux security overview for cisoHillel kobrovski   Linux security overview for ciso
Hillel kobrovski Linux security overview for ciso
 
beginner.en.print
beginner.en.printbeginner.en.print
beginner.en.print
 
beginner.en.print
beginner.en.printbeginner.en.print
beginner.en.print
 
beginner.en.print
beginner.en.printbeginner.en.print
beginner.en.print
 
Linux
LinuxLinux
Linux
 

Recently uploaded

World environment day ppt For 5 June 2024
World environment day ppt For 5 June 2024World environment day ppt For 5 June 2024
World environment day ppt For 5 June 2024
ak6969907
 
Pride Month Slides 2024 David Douglas School District
Pride Month Slides 2024 David Douglas School DistrictPride Month Slides 2024 David Douglas School District
Pride Month Slides 2024 David Douglas School District
David Douglas School District
 
Reflective and Evaluative Practice PowerPoint
Reflective and Evaluative Practice PowerPointReflective and Evaluative Practice PowerPoint
Reflective and Evaluative Practice PowerPoint
amberjdewit93
 
A Strategic Approach: GenAI in Education
A Strategic Approach: GenAI in EducationA Strategic Approach: GenAI in Education
A Strategic Approach: GenAI in Education
Peter Windle
 
Introduction to AI for Nonprofits with Tapp Network
Introduction to AI for Nonprofits with Tapp NetworkIntroduction to AI for Nonprofits with Tapp Network
Introduction to AI for Nonprofits with Tapp Network
TechSoup
 
The basics of sentences session 5pptx.pptx
The basics of sentences session 5pptx.pptxThe basics of sentences session 5pptx.pptx
The basics of sentences session 5pptx.pptx
heathfieldcps1
 
Azure Interview Questions and Answers PDF By ScholarHat
Azure Interview Questions and Answers PDF By ScholarHatAzure Interview Questions and Answers PDF By ScholarHat
Azure Interview Questions and Answers PDF By ScholarHat
Scholarhat
 
Best Digital Marketing Institute In NOIDA
Best Digital Marketing Institute In NOIDABest Digital Marketing Institute In NOIDA
Best Digital Marketing Institute In NOIDA
deeptiverma2406
 
Pollock and Snow "DEIA in the Scholarly Landscape, Session One: Setting Expec...
Pollock and Snow "DEIA in the Scholarly Landscape, Session One: Setting Expec...Pollock and Snow "DEIA in the Scholarly Landscape, Session One: Setting Expec...
Pollock and Snow "DEIA in the Scholarly Landscape, Session One: Setting Expec...
National Information Standards Organization (NISO)
 
Fresher’s Quiz 2023 at GMC Nizamabad.pptx
Fresher’s Quiz 2023 at GMC Nizamabad.pptxFresher’s Quiz 2023 at GMC Nizamabad.pptx
Fresher’s Quiz 2023 at GMC Nizamabad.pptx
SriSurya50
 
"Protectable subject matters, Protection in biotechnology, Protection of othe...
"Protectable subject matters, Protection in biotechnology, Protection of othe..."Protectable subject matters, Protection in biotechnology, Protection of othe...
"Protectable subject matters, Protection in biotechnology, Protection of othe...
SACHIN R KONDAGURI
 
The simplified electron and muon model, Oscillating Spacetime: The Foundation...
The simplified electron and muon model, Oscillating Spacetime: The Foundation...The simplified electron and muon model, Oscillating Spacetime: The Foundation...
The simplified electron and muon model, Oscillating Spacetime: The Foundation...
RitikBhardwaj56
 
Biological Screening of Herbal Drugs in detailed.
Biological Screening of Herbal Drugs in detailed.Biological Screening of Herbal Drugs in detailed.
Biological Screening of Herbal Drugs in detailed.
Ashokrao Mane college of Pharmacy Peth-Vadgaon
 
Exploiting Artificial Intelligence for Empowering Researchers and Faculty, In...
Exploiting Artificial Intelligence for Empowering Researchers and Faculty, In...Exploiting Artificial Intelligence for Empowering Researchers and Faculty, In...
Exploiting Artificial Intelligence for Empowering Researchers and Faculty, In...
Dr. Vinod Kumar Kanvaria
 
Group Presentation 2 Economics.Ariana Buscigliopptx
Group Presentation 2 Economics.Ariana BuscigliopptxGroup Presentation 2 Economics.Ariana Buscigliopptx
Group Presentation 2 Economics.Ariana Buscigliopptx
ArianaBusciglio
 
CACJapan - GROUP Presentation 1- Wk 4.pdf
CACJapan - GROUP Presentation 1- Wk 4.pdfCACJapan - GROUP Presentation 1- Wk 4.pdf
CACJapan - GROUP Presentation 1- Wk 4.pdf
camakaiclarkmusic
 
PIMS Job Advertisement 2024.pdf Islamabad
PIMS Job Advertisement 2024.pdf IslamabadPIMS Job Advertisement 2024.pdf Islamabad
PIMS Job Advertisement 2024.pdf Islamabad
AyyanKhan40
 
kitab khulasah nurul yaqin jilid 1 - 2.pptx
kitab khulasah nurul yaqin jilid 1 - 2.pptxkitab khulasah nurul yaqin jilid 1 - 2.pptx
kitab khulasah nurul yaqin jilid 1 - 2.pptx
datarid22
 
The Diamonds of 2023-2024 in the IGRA collection
The Diamonds of 2023-2024 in the IGRA collectionThe Diamonds of 2023-2024 in the IGRA collection
The Diamonds of 2023-2024 in the IGRA collection
Israel Genealogy Research Association
 
Advantages and Disadvantages of CMS from an SEO Perspective
Advantages and Disadvantages of CMS from an SEO PerspectiveAdvantages and Disadvantages of CMS from an SEO Perspective
Advantages and Disadvantages of CMS from an SEO Perspective
Krisztián Száraz
 

Recently uploaded (20)

World environment day ppt For 5 June 2024
World environment day ppt For 5 June 2024World environment day ppt For 5 June 2024
World environment day ppt For 5 June 2024
 
Pride Month Slides 2024 David Douglas School District
Pride Month Slides 2024 David Douglas School DistrictPride Month Slides 2024 David Douglas School District
Pride Month Slides 2024 David Douglas School District
 
Reflective and Evaluative Practice PowerPoint
Reflective and Evaluative Practice PowerPointReflective and Evaluative Practice PowerPoint
Reflective and Evaluative Practice PowerPoint
 
A Strategic Approach: GenAI in Education
A Strategic Approach: GenAI in EducationA Strategic Approach: GenAI in Education
A Strategic Approach: GenAI in Education
 
Introduction to AI for Nonprofits with Tapp Network
Introduction to AI for Nonprofits with Tapp NetworkIntroduction to AI for Nonprofits with Tapp Network
Introduction to AI for Nonprofits with Tapp Network
 
The basics of sentences session 5pptx.pptx
The basics of sentences session 5pptx.pptxThe basics of sentences session 5pptx.pptx
The basics of sentences session 5pptx.pptx
 
Azure Interview Questions and Answers PDF By ScholarHat
Azure Interview Questions and Answers PDF By ScholarHatAzure Interview Questions and Answers PDF By ScholarHat
Azure Interview Questions and Answers PDF By ScholarHat
 
Best Digital Marketing Institute In NOIDA
Best Digital Marketing Institute In NOIDABest Digital Marketing Institute In NOIDA
Best Digital Marketing Institute In NOIDA
 
Pollock and Snow "DEIA in the Scholarly Landscape, Session One: Setting Expec...
Pollock and Snow "DEIA in the Scholarly Landscape, Session One: Setting Expec...Pollock and Snow "DEIA in the Scholarly Landscape, Session One: Setting Expec...
Pollock and Snow "DEIA in the Scholarly Landscape, Session One: Setting Expec...
 
Fresher’s Quiz 2023 at GMC Nizamabad.pptx
Fresher’s Quiz 2023 at GMC Nizamabad.pptxFresher’s Quiz 2023 at GMC Nizamabad.pptx
Fresher’s Quiz 2023 at GMC Nizamabad.pptx
 
"Protectable subject matters, Protection in biotechnology, Protection of othe...
"Protectable subject matters, Protection in biotechnology, Protection of othe..."Protectable subject matters, Protection in biotechnology, Protection of othe...
"Protectable subject matters, Protection in biotechnology, Protection of othe...
 
The simplified electron and muon model, Oscillating Spacetime: The Foundation...
The simplified electron and muon model, Oscillating Spacetime: The Foundation...The simplified electron and muon model, Oscillating Spacetime: The Foundation...
The simplified electron and muon model, Oscillating Spacetime: The Foundation...
 
Biological Screening of Herbal Drugs in detailed.
Biological Screening of Herbal Drugs in detailed.Biological Screening of Herbal Drugs in detailed.
Biological Screening of Herbal Drugs in detailed.
 
Exploiting Artificial Intelligence for Empowering Researchers and Faculty, In...
Exploiting Artificial Intelligence for Empowering Researchers and Faculty, In...Exploiting Artificial Intelligence for Empowering Researchers and Faculty, In...
Exploiting Artificial Intelligence for Empowering Researchers and Faculty, In...
 
Group Presentation 2 Economics.Ariana Buscigliopptx
Group Presentation 2 Economics.Ariana BuscigliopptxGroup Presentation 2 Economics.Ariana Buscigliopptx
Group Presentation 2 Economics.Ariana Buscigliopptx
 
CACJapan - GROUP Presentation 1- Wk 4.pdf
CACJapan - GROUP Presentation 1- Wk 4.pdfCACJapan - GROUP Presentation 1- Wk 4.pdf
CACJapan - GROUP Presentation 1- Wk 4.pdf
 
PIMS Job Advertisement 2024.pdf Islamabad
PIMS Job Advertisement 2024.pdf IslamabadPIMS Job Advertisement 2024.pdf Islamabad
PIMS Job Advertisement 2024.pdf Islamabad
 
kitab khulasah nurul yaqin jilid 1 - 2.pptx
kitab khulasah nurul yaqin jilid 1 - 2.pptxkitab khulasah nurul yaqin jilid 1 - 2.pptx
kitab khulasah nurul yaqin jilid 1 - 2.pptx
 
The Diamonds of 2023-2024 in the IGRA collection
The Diamonds of 2023-2024 in the IGRA collectionThe Diamonds of 2023-2024 in the IGRA collection
The Diamonds of 2023-2024 in the IGRA collection
 
Advantages and Disadvantages of CMS from an SEO Perspective
Advantages and Disadvantages of CMS from an SEO PerspectiveAdvantages and Disadvantages of CMS from an SEO Perspective
Advantages and Disadvantages of CMS from an SEO Perspective
 

Introduction to Linux

  • 1. Linux Basics and Shell Scripting Rohith Ninan and Akshay Warrier
  • 3. What Is Linux? ● Linux is a family of open-source operating systems. ● Released in September 17, 1991 by Linus Torvalds. ● Developed based on the Intel x86 architecture. ● Has been ported to more platforms than any other operating system. ● Runs on Android, Embedded Systems, Supercomputers and powers over 96.4% servers of the world.
  • 5. Linux or GNU/Linux? ● Operating systems consist of many components ● The kernel provides the most basic level of control over all of the computer's hardware devices. ● It manages the RAM, the CPU and the devices connected to it.
  • 6. Linux or GNU/Linux? ● “Linux” refers to the kernel ● All the supporting system software and libraries were provided by the GNU Project. ● GNU Project - Founded by Richard Stallman, first publicly announced on September 27, 1983. ● He was the originator of the many ideas about ‘Free Software’ ● The Free Software Foundation emphasises on the use of “GNU/Linux” but today most people simply call it ‘Linux’
  • 7. How It All Started
  • 8. How It All Started Ken Thompson (sitting) and Dennis Ritchie working together at a PDP-11 >ken thompson, dennis ritchie, douglas mcilroy, and joe ossanna - exist >got bored and made unix in 1969 at at&t bell labs >completely written in assembly >dennis realizes “oopsie assembly not very portable, brb lemme make C” >starts selling unix as proprietary product >unix stonks go brr >stallman enters the chat >stallman goes “ples make unix compatible free software” >by 1990s most gnu software was complete but they still needed a kernel
  • 9. How It All Started >minix enters the chat >made by andrew s tanenbaum in 1987 >was made for educational purposes >its licensing didnt allow it to be called ‘free software’ >linus exists >linus sadge >makes open source and free kernel >also makes git since that wasnt enough
  • 10. How It All Started
  • 12. Linux Distributions ● A Linux distribution (commonly called a distro) is any operating system that makes use of the Linux kernel ● It can be thought of as the many different flavours it comes in. ● Each distro is unique and has its own set of philosophies and communities supporting it. ● Its free and open source nature allows it to be modified and tailored to different use cases.
  • 13. Linux Distributions ● Some distros are used for pen-testing, and some are tailored to work efficiently on servers ● While other distros are just designed for everyday normal tasks. Fedora Linux Pop!_OS
  • 17. The UNIX philosophy ● All the core UNIX system tools were designed so that they could operate together. ● Using this philosophy programmers avoided writing some parts of their program that had already been written by someone else, and could instead recycle the code. ● This philosophy lives on today in GNU/Linux.
  • 18. The UNIX philosophy Monolithic Design ● One big thing ● Does a lot of things ● Does nothing it’s designed to do well ● Difficult to add features without a design overhaul Modular Design ● Made up of simple pieces ● Each piece does one thing well ● Every piece is well designed ● Adding features is trivial
  • 19. The UNIX philosophy The core UNIX philosophy can be summarised as follows: ● Write programs that Do One Thing And Do It Well (DOTADIW) ● Write programs to work together. ● Write programs to handle text streams, because that is a universal interface.
  • 21. Desktop Environment ● Components that provides GUI elements, like toolbar, wallpaper etc. ● Unlike Windows and MacOS, Linux has a modular Desktop Environment, separate from the OS itself ● Allows extensive customisation and the ability to choose a desktop environment that you like.
  • 24. The Shell ● Shell, terminal, console, command line. ● Olden days of Linux, all you had to work with was the shell. ● System admins, programmers, and users all sat at something called a Linux console terminal. ● The command line allowed text input only and could display only text and rudimentary graphics output.
  • 25. Types of Terminals ● Graphical Terminals Terminal emulators that simulate working on a console terminal but within a graphical desktop window. ● Console Terminals ○ Also called a tty ○ Takes linux out of graphical mode ○ Emulates the old days of a
  • 26. Bash ● Bash(Bourne Again Shell), written by Brian Fox for the GNU Project as a free software replacement for the Bourne shell. ● Was one of the first programs Linus Torvalds ported to Linux, alongside GCC. ● The default shell used in many Linux distributions ● Other shells - Zsh and Fish, more feature rich than bash, provide syntax highlighting, auto-correction features and have tons of plugins.
  • 27. The Linux File System
  • 28. The LINUX File System ● Logical collection of files on a partition or disk ● It manages the file name, file size, creation date, and much more information about a file. "On a UNIX system, everything is a file; if something is not a file, it is a process." ● Just like UNIX, Linux makes no difference between a file and a directory. A directory is just a file containing names of other files. ● Programs, services, and input and output devices are also considered to be files, according to the system.
  • 29. The LINUX File System
  • 30. The LINUX File System Key Features: ● Hierarchical file structure : root directory (/) ● Forward slash (/) in path ● No drive letters ● Case Sensitive ● File Extensions : Not necessary. File type is decoded from its contents. ● Hidden files - eg configuration file
  • 31.
  • 33. ls
  • 34. cd
  • 35. pwd
  • 36. file
  • 37. touch
  • 38. mkdir
  • 39. mv
  • 40. cp
  • 41. rm
  • 42. cat
  • 43. echo
  • 45. grep
  • 49. Environment Variables ● Defines your Linux shell experience. ● Programs and scripts use environment variables to obtain system information and store temporary data and configuration information ● There are two environment variable types in the bash shell 1. Global Variables 2. Local Variables
  • 50. Environment Variables ● Global environment variables are visible from the shell session and from any spawned child subshells. ● Local variables are available only in the shell that creates them ● printenv, env, echo ● set displays all environment variables ● Global vars - Uppercase ● Local vars - Lowercase
  • 51. Environment Variables ● A local variable created in parent shell does not pass down to a child shell ● A local variable set within the child shell doesn’t exist after a return to the parent shell ● export - exports a local variable as a global variable ● A global variable’s value can be read by a child shell, but its value can’t be changed even with export. ● unset - remove environment variable
  • 52. The PATH Environment Variable ● Contains the paths to programs and commands separated with : ● When a command is entered, the shell searches for the program in all the paths defined in the PATH variable ● If a new program is installed in a directory not mentioned in PATH then a new entry needs to be added ● PATH=$PATH:<enter new path> ● The changes made to environment variables don’t persist between reboots ● .bashrc,.zshrc,.profile
  • 54. Shell Special Characters $ variable substitution or expand value of variable > output redirection >> output redirection to append * match any number of characters ? match one character `cmd` $(cmd) execute command cmd | pipe the output of one command to the input of another escape interpretation of a character
  • 56. Users, Groups and Permissions ● Linux is designed for multiple users to have access to the same system at the same time ● Managing access to resources is a fundamental task ● Linux divides authorization into two: 1. Ownership 2. Permission
  • 57. Users, Groups and Permissions What is a “user”? Entity that can access the resources of the system. Types of users: 1. Root user 2. Regular user 3. Service account A user can belong to one or more groups.
  • 58. Users, Groups and Permissions What is a “group”? ● Collection of users. ● Primary group: automatically associated with each user ● A user can also be part of zero or more secondary groups. ● Many distros add the standard user to some useful secondary groups by default.
  • 59. Users, Groups and Permissions Some standard groups: ● sudo ● dialout ● adm ● plugdev ● lpadmin ● audio, video
  • 60. Users, Groups and Permissions /etc/passwd /etc/group /etc/shadow
  • 61. Users, Groups and Permissions
  • 62. Users, Groups and Permissions File Directory read read contents list the contents of the directory write modify contents create, delete and rename files in the directory execute run as a program enter the directory, and access files and directories inside
  • 63. Users, Groups and Permissions chown,chgrp chown master file.txt change owner of file to the user “master” chown :group1 file.txt chgrp group1 file.txt change group owner of file to the group “group1” chown master:group1 file.txt
  • 64. Users, Groups and Permissions chmod ● Symbolic Mode: chmod ug+x o-r file.txt chmod o+w file.txt ● Numeric mode: chmod 770 file.txt chmod 644 file.txt 7 rwx 111 6 rw- 110 5 r-x 101 4 r-- 100 3 -wx 011 2 -w- 010 1 --x 001 0 --- 000
  • 65. Users, Groups and Permissions
  • 67. Package Managers ● Allows users to install, remove, upgrade, configure and manage software packages on an operating system. ● May be a graphical or a command line tool ● Packages used to be built from source but now package managers are used
  • 68. Package Managers ● Packaging formats - .deb, .rpm, .tar.gz ● Different methods of install for a distro - dpkg -i, apt install, pacman -Syu, dnf install ● Repositories - ensure integrity and authenticity using checksums and digital signatures ● AUR ● Dependency hell
  • 70. Commonly Used Softwares in Linux Softwares like... ● Spotify ● Discord ● Visual Studio Code ...are available on Linux. Open Source softwares like... ● GNU Image Manipulation Program (GIMP), Inkscape, Krita ● LibreOffice, OpenOffice ● GNOME and KDE utilities ● VLC Media Player ● Firefox ...natively support Linux.
  • 71. WINE ● Wine Is Not an Emulator ● Compatibility layer that allows softwares developed for Windows to run on Linux ● Can be used to install and run softwares like ○ Adobe Photoshop ○ MS Office ○ Games on Linux Bottles : A modern graphical front-end for wine
  • 72. Getting Help ● --help ● man <command> ● Google search ● Online forums: ○ StackOverflow ○ Ubuntu Forums ● wiki.archlinux.org, and similar wikis of other distros ● Blogs like ‘It’s FOSS’ ● Reddit
  • 74.
  • 75.
  • 76.
  • 77.
  • 78. Exercises Clone the repository of AutoJoomer: https://github.com/vishal-lokare/AutoJoomer “cd” into the repository. 1. List all the files and directories in the directory and save it to a file named "contents". 2. Read the file "contents" using the terminal. You should see the names of files. 3. Now, use the "sort" command to sort the names of files in descending order and save the output to a file named "contents_desc". 4. Change working directory to “src/pages/login”. Search for files "js" in the name using ls, grep and pipe (|). 5. Challenging: Change working directory to src/pages/login. Search for "AutoJoomer" in the contents of all the file in the directory. Hint: Use grep and wildcards. 6. Install neofetch and htop through the terminal. (Use the apt commands if you are on Ubuntu). 7. Search for "scientific calculator" in your package manager (apt, if you are using Ubuntu).
  • 79. References ● Linux Command Line and Shell Scripting ● Package Managers - It’s Foss ● Users, Groups and Permissions - Medium ● File Permissions - Guru 99