LECTURE 1
Shell and scripting Programming with Unix
By
Ashraf Hendam
OUTLINE
• Course Content
• Textbooks
• Grading
• Dates to Remember
• Introduction
• Operating system user interface
• Why use an operating system?
• Operating system architecture
• Types of Operating system
• What is Unix ?
• Unix History
• Linux distributions
• Why learn Linux and its Drawbacks
• Unix/Linux system architecture
• Types of Commands
Course Content
1- Introduction to Linux
• History, distributions and licensing Linux, architecture, Features
and Drawbacks
• File management, handling, File tree, File content, Security
• Directory Management
• User management
• commands and arguments
• control operators ,pipes
• regular expressions
• Memory management
• Network commands (SSH)
Course Content
2- Version Control System(Git and GitHub)
3- Linux Shells(CSH, KSH)
4- introduction to Bash shell scripting
• Bash Commands and Arguments
• Parameters and Variables
• Tests and Loops
• Arrays and associative arrays
• Practices - Choosing shell; quoting; readability; debugging.
Back
Textbooks
• Linux Fundamentals, Paul Cobbaut (2015)
• Bash Reference Manual
• Reference Documentation for Bash
Chet Ramey, Case Western Reserve University
Brian Fox, Free Software Foundation
Edition 5.2, for Bash Version 5.2.
September 2022
Back
Grading
Assignments 20 %
Projects 15 %
Midterm 20 %
Final Exam 35 %
Quizzes 10 %
Back
Dates to Remember
● Week 1: 11-15/2/2024
Add/Drop
● Week 6: 21/3/2024
Last day for Course Withdrawal with Grade "W“
(LTS)
● Week 8: 31/3-4/4/2024
MT Exams
● Week 11: 21-25/4/2024
Spring Break
● Week 13: 5-9/5/2024
2nd MT exam (freshman only)
7
Dates to Remember
● Week 14: 16/5/2024
Last day for Course Withdrawal with Grade "WP" or
"WF“ (LTS) for General Education courses
● Week 15: 23/5/2024
Last day for Course Withdrawal with Grade "WP" or
"WF“ (LTS) for all other courses
● Week 15: 19-23/5/2024
Lab Exams, GE Exams, Posting CW
● Week 16-17: 25/5-6/6/2024
Final Exams
8
Dates to Remember
● 10/6/2024
Incomplete Petition Deadline (LTS)
● 1/7/2024
Incomplete Final Exams must be finalized within a
maximum one month
9
Academic Integrity Policy
● Plagiarism refers to submitting material that is in part or
whole is not entirely one’s own work without properly
citing sources
● Fabrication means the inclusion of falsified, invented, or
fictitious data or information that was not gathered in
accordance with standard guidelines in an academic work
● Cheating is defined as obtaining or attempting to obtain, or
aiding another to obtain credit for work, or any
improvement in performance, by any dishonest or deceptive
means.
● Utilizing AI to generate or assist in generating your work
without giving proper credit, taking permission, or when the
assignment doesn't specifically allow it, is deemed
plagiarism. 10
Academic Integrity Policy
Utilizing AI to generate or assist in
generating your work without taking
permission, giving proper credit, or
when the assignment doesn't
specifically
allow it, is deemed
plagiarism.
Academic Integrity Policy
● Please check the link of the Academic Calendar
[Link]
ias=academic_calendar
● Please check the link of the Undergraduate
Handbook for more information about policies
and regulations
[Link]
ias=undergraduate_handbook
12
Introduction
• What is an operating system?
An operating system (OS) is the program that, after
being initially loaded into the computer by a boot
program, controls and manages all of the
computer hardware and software resources.
• The application programs make use of the
operating system by making requests for services
through a defined application program interface (API).
• In addition, users can interact directly with the
operating system through a user interface, such as a
Command-Line Interface (CLI) or a Graphical User
Interface (GUI).
Back
Operating system user interface
• CLI, or terminal mode window, provides a text-based
interface where users rely on the traditional keyboard to enter
specific commands, parameters and arguments related to
specific tasks.
Operating system user interface
• GUI, or desktop, provides a visual interface based on icons
and symbols where users rely on gestures delivered by
human interface devices, such as touchpads, touchscreens
and mouse devices.
Why using an operating system?
• An operating system brings powerful benefits to
computer software and software development.
• Without an operating system, every application
would need to include its own UI
1. A comprehensive code needed to handle all low-
level functionality of the underlying computer, such
as disk storage, network interfaces and so on.
2. Every application need to consider a vast number
of available hardware this will increase the size of
applications and lead to make the development of
software not practical.
Why using an operating system?
3. operating system provides a comprehensive
platform that identifies, configures and manages a
range of hardware, including
Processors;
Memory devices and memory management
Chipsets
Storage
Networking
Port communication, such as Video Graphics
Array (VGA)
High-Definition Multimedia Interface (HDMI)
Universal Serial Bus (USB). Back
Operating system architecture
• Every operating system requires a UI, enabling users
and administrators to interact with the OS in order to
set up, configure and even troubleshoot the operating
system and its underlying hardware.
Types of Operating system
1. General-purpose operating system. A general-purpose OS
represents an array of operating systems intended to run a
multitude of applications on a broad selection of
hardware, enabling a user to run one or more applications
or tasks simultaneously.
Windows is Microsoft's operating system. Introduced in 1985,
the GUI-based OS has been released in many versions since
then.
Mac OS is the operating system for Apple's Macintosh PCs.
Unix is a multiuser operating system designed for flexibility
and adaptability.
Linux is a Unix-like operating system that was designed to
provide PC users a free or low-cost alternative.
Types of Operating system
2. Mobile operating system are designed to accommodate
the unique needs of mobile computing and
communication-centric devices, such as smartphones and
tablets.
3. Embedded operating system. Not all computing devices
are general purpose. A huge assortment of dedicated
devices -- including home digital assistants, automated
teller machines (ATMs), airplane systems, retail point of
sale (POS) terminals and internet of things (IoT) devices.
4. Network operating system. A network operating system
(NOS) is another specialized OS intended to facilitate
communication between devices operating on a local
area network (LAN)( Windows 10 and Windows
Server 2019)..
What is Unix ?
• Unix is an Operating System that is truly the base of
all Operating Systems like Ubuntu, Solaris, POSIX,
etc.
• Unix was originally developed in 1969 by a group of
AT&T employees Ken Thompson, Dennis Ritchie,
Douglas McIlroy, and Joe Ossanna at Bell Labs and
they shared their source code.
Back
Unix History
•1980s
•Many companies started developing their own Unix:
IBM created AIX
Sun SunOS (later Solaris)
HP HP-UX The
• Many Unix dialects and a dozen different ways to do the same thing.
•The first real root of Linux, when Richard Stallman aimed to end this era
of Unix by starting the GNU project.
•His goal was to make an operating system that was freely available to
everyone, and where everyone could work together (like in the
Seventies).
•Many of the command line tools used today on Linux are GNU tools.
Unix History
•1990s
•Linus Torvalds, a Swedish speaking Finnish student,
buying a 386 computer and writing a brand new
POSIX compliant kernel.
•He put the source code online, thinking it would never
support anything but 386 hardware.
•Many people embraced the combination of this kernel
with the GNU tools.
Unix History
•2015
• More than 97 percent of the world's supercomputers
(including the complete top 10)
• More than 80 percent of all smartphones
• Millions of desktop computers
• Around 70 percent of all web servers, a large chunk of
tablet computers
• several appliances (dvdplayers, washing machines, dsl
modems, routers, self-driving cars, space station
laptops...)run Linux
• Linux is by far the most commonly used operating
system in the world. Back
Linux distributions
•A Linux distribution is a collection of (usually
open source) software on top of a Linux
kernel.
•A distribution (or short, distro) can bundle
server software, system management tools,
documentation and many desktop
applications in a central secure software
repository.
Linux distributions
Linux distributions
Red Hat
Red Hat is a commercial Linux company for developing
Linux.
Red Hat Enterprise Linux and Fedora is free.
Red Hat Enterprise Linux (RHEL) is well tested before
release.
Ubuntu
Canonical started free compact discs with Ubuntu Linux in
2004.
Canonical wants Ubuntu to be an easy to use graphical Linux
desktop.
They make a profit by selling support for Ubuntu.
Linux distributions
Debian
No company behind Debian.
Thousands of well organised developers that elect a Debian
Project Leader every two years.
One of the most stable Linux distributions.
Comes in three versions: stable, testing and unstable.
Other
CentOS, Oracle Enterprise Linux and Scientific Linux are
based on Red Hat Enterprise Linux and share many of the
same principles
Linux distributions
Back
Why learn Linux
1. Important skill for IT
Employees always learn new technologies, programs, devices,
operations systems etc. to develop their skills. Linux is one of
these skills that are popular between IT employees.
2. Good Career Opportunities
With Linux skills, these opportunities increase too much. There
are many roles for Linux Admins in IT.
3. Less is Valuable
On PCs, generally people use Windows. Beside windows, Mac is
also popular. Linux usage is also high but if we compare with
Windows, it is less. And less is valuable. If you learn a technology
that is used less, this makes difference.
Why learn Linux
4. Higher Salaries
IT employee who knows Linux, always earn more than others.
5. Open Source
Open source means that you can also develop any Linux
applications and support Linux world. In other words, you can
access the code of Linux Because, it is open to everyone.
6. FREE
we should pay for windows and the fees grows with large
company. No need to pay for Linux.
7. Important for System Administrators & Server Admins
Almost every server uses Linux as Operating System in the
World. Because, Linux offers optimum properties for servers.
Why learn Linux
8. Protect privacy
Different operating systems track user habits. But in linux there is
no such behavior.
9. More Security
Linux is more secure than Windows. There are less viruses on
Linux. Certainly, we can not say that Linux is %100 safe, but we
can say that it is the safest operating system.
10. Higher Stability
Linux is by far most stable. This characteristic makes linux a
better option for servers.
Linux Drawbacks
1. Adaptation
Users find it difficult to adopt to Linux due to the terminals used
where Terminals are command line interface where commands
need to be entered(Windows users).
2. Software Compatibility
Popular applications which are made for Windows and Mac are
not available for Linux(Adobe Photoshop) where developers are
not interested in making softwares for Linux due to its small
market value.
3. Gaming
Games doesn't natively support Linux. Linux is not a platform
which is not widely used, gaming developers are not much
interested in Linux.
Linux Drawbacks
4. Hardware Compatibility
Almost all the hardwares can be connected to a Linux operating
system But the problem comes with the drivers.
5. Technical Support
Since Linux is an open source operating system it lacks on the
side of technical support. The problem cannot be rectified unless
you find a solution yourself. For each problem users need to look
online
Back
Unix/Linux system architecture
• There are various Unix variants available in the market.
Solaris Unix, AIX, HP Unix and BSD are a few examples. Linux
is also a flavor of Unix which is freely available.
• Several people can use a Unix computer at the same time;
hence Unix is called a multiuser system.
• A user can also run multiple programs at the same time;
hence Unix is a multitasking environment.
• Unix is written using a C programming language.
• It provides various advanced security features.
Unix/Linux system architecture
• Unix is made up of 3 main parts: the kernel, the shell, and user
commands and applications.
Unix/Linux system architecture
• The kernel ingests user input via the shell and accesses the
hardware to perform things like memory allocation and file
storage.
• The shell is an interface that interprets the command line
input and calls the necessary programs to do the work.
• The commands that you enter are programs themselves, so
once the work is done, the command line will return to a
prompt and await further input.
• There are several different shells, and syntax and shortcuts
vary between them.
Back
Types of Commands
Built-in commands are internal commands that are built-in the
shell. Built-in commands are called from the shell and
executed directly within the shell itself. You can list all built-in
commands with the help of 'help' and 'compgen -b' command.
Some example of built-in commands are 'pwd', 'help', 'type',
'set', 'unset', etc.
External commands are other than built-in commands. These
commands are programs which have their own binary and
located in the filesystem. These are the commands that your
system offer and are totally shell independent. Mostly these
commands reside in /bin, /sbin, /usr/sbin.
Back