Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
2 views

lecture 1

This document outlines an introductory course on Linux and shell programming, detailing references, course materials, grading criteria, and a weekly calendar of topics. It covers the history, design, and features of Linux, including its kernel and shell, as well as comparisons with Unix and Windows. The document also highlights the structure of shell commands and introduces the Bash shell and its functionalities.
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views

lecture 1

This document outlines an introductory course on Linux and shell programming, detailing references, course materials, grading criteria, and a weekly calendar of topics. It covers the history, design, and features of Linux, including its kernel and shell, as well as comparisons with Unix and Windows. The document also highlights the structure of shell commands and introduces the Bash shell and its functionalities.
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 28

Linux and shell programming

Lecture 1: Introduction to Linux

© spring 2025 – Dr. Dina Awny


References

• William E. Jr. Shotts, The Linux Command Line, 2nd Edition: A Complete Introduction
Paperback – Illustrated, 7 March 2019
• Linux Command Line Books by William Shotts
• Javapoints
• Linux Shell - javatpoint
• Tutorialspoint
• Linux/Unix Tutorial
• Introduction to Linux Shell and Shell Scripting - GeeksforGeeks
• W3school
• https://w3schools.tech/tutorial/unix/index
• Download Ubuntu
• Download Ubuntu Desktop | Ubuntu
• Download VirtualBox
• Downloads – Oracle VirtualBox
LMS

● Course Materials: Lectures and Lab Assignments


● Online Quizzes
● Project Submission
● Lab Assignment Submission
Grades

● Midterm: 15 Degree
● Activities
○ Project: 20 Degree
○ Quizzes (Practical/LMS): 20 Degree (6 quizzes, Inside lab, best 5)
○ Practical Assignments: 20 Degree (LMS + Discussion)
● Final Exam: 25 Degree
Calendar

● Week 1: Introduction to Linux


● Week 2: Linux Directories and Files
● Week 3: Getting help and filters
● Week 4: System accounts and groups
● Week 5: Linux Process and runlevels
● Week 6: Basics for Shell Programming
● Week 7: Midterm
Calendar

● Week 8: Loops and Functions


● Week 9: Shell Functions and arrays
● Week 10: I/O Redirection
● Week 11: File links and Archive
● Week 12: Revision and Case Studies
● Week 13: Revision and Case Studies + Project Discussion
● Week 14: Practical Discussion
Table of Contents

● Introduction to Linux
● Linux history
● Desing of Linux
● Linux Distributions (Distros)
● Linux Kernel and shell
● Linux VS Unix
● Linux VS Windows
Introduction to Linux
• Linux is an open-source operating system-based family on the Linux kernel.
• Open Source: Anyone can view, modify, and distribute the source code
• Multi-user: Supports multiple users simultaneously
• Multitasking: Can run multiple programs at the same time
• Security: Highly secure due to its architecture and active community
• Stability: Known for its robust and crash-resistant nature
• Flexibility: Can be customized for various purposes
History of Linux OS
•Precursors:
o Unix was created in 1969 at AT&T's Bell Labs.
o Initially written in assembly language, Unix was later rewritten in C by
Dennis Ritchie in 1973, making it easier to port to different computer platforms.
•Creation of Linux:
o Linus Torvalds, inspired by a Unix course and MINIX operating system, began
developing the Linux kernel in 1991 due to frustrations with MINIX's restrictive
licensing.
o The Linux kernel initially relied on MINIX software but transitioned to GNU
components due to the GNU Project's free code and the GNU General Public License
(GPL).
History of Linux OS cont.

•Current Development:
o The Linux Kernel is maintained by Greg Kroah-Hartman, with GNU components supported by the
Free Software Foundation led by William John Sullivan.
o Linux distributions combine the Linux kernel, GNU components, third-party software, and package
management tools, developed by the Linux community, corporations, and individuals.
•Popular and Commercial Adoption:
o Linux gained adoption in the mid-1990s, particularly in supercomputing and later in commercial
environments with IBM, Dell, and HP supporting Linux to challenge Microsoft.
o Linux is widely used in embedded systems, supercomputers, servers, enterprise systems, and home
desktops.
Design of Linux OS
• A bootloader, for instance, systemd-boot, SYSLINUX, LILO, and
.
GNU GRUB. It is a program that can load the Linux kernel into the
main memory.
• An init program, like the traditional sysvinit and the newer Upstart,
OpenRC, and systemd. It is the first process announced by the Linux
kernel and the process tree root.
• Software libraries, which include code that can be applied by running
processes.
• User interface
Also, the user interface is called a shell. It is either a GUI (graphical
user interface), a CLI (command-line interface), or controls attached
to the related hardware, which is normal for embedded systems.
Linux distributions
Top Linux distributions
Pros of Linux OS
Cons of Linux OS
Linux kernel and shell

• Kernel is the heart of the Linux operating system. It manages the resources of
Linux such as:
o File management
o Multitasking
o Memory and I/O management
o Process management
o Device management
o Networking support
Linux shell
• The shell is a program that allows the user to type commands, options, and arguments
• Many shell programs exist
• It is a command language interpreter that executes commands read from the standard input device
such as keyboard or from a file.
• Most popular shell is the “Bash” (Bourne Again Shell)
• A user’s shell can be changed by the usermod command by root
• User’s default shell stored in /etc/passwd
In Unix, there are two major types of shells −
❑ Bourne shell − If you are using a Bourne-type shell, the $ character is the default prompt.
❑ C shell − If you are using a C-type shell, the % character is the default prompt.
Linux shell cont.

The Bourne Shell has the following subcategories −


• Bourne shell (sh) : Bourne shell was the first shell to appear on Unix systems.
• It is usually installed as /bin/sh on most versions of Unix.
• Korn shell (ksh)

• Bourne Again shell (bash) : an enhanced version of the original Unix shell program (sh).

• POSIX shell (sh)

The different C-type shells follow −

• C shell (csh): a shell with a syntax close to the C language syntax.

• TENEX/TOPS C shell (tcsh)

➢ To find all of the available shells on your system, print the contents of

the file “/etc/shells” using the “cat” command


The bash Shell
• The Bash is a command language interpreter as well as a programming language.
• It supports variables, functions, and flow control, like other programming languages.
• It can also read and execute the commands from a file, which is called a shell script.
• Bash offers various functional improvements over Bourne Shell (sh) for both interactive and
programming use.
• The Bash contains the following improvements over sh:
o It provides command-line editing
o It contains unlimited size command history
o It provides Job Control
o It facilitates with Shell Functions and Aliases
o It provides the indexed arrays of unlimited size
o It contains integer arithmetic in any base from 2 to 64.
Features of Bash
Some key features of Bash are as follows:
•Shell Syntax: The shell syntax contains shell operations, quoting, and comments.
•Shell commands: Shell commands are the types of commands that you can execute. These commands
can be simple commands, pipelines, lists, compound commands, and more.
•Shell Functions: Shell functions are used to group commands by name.
•Shell parameters: Basically, a parameter is an entity that stores value; it can be a name, number, or
special character.
•Shell Expansions: Shell expansion is a technique that is used by Bash to expand the parameters.
Expansion is performed on the command line after the input has been splitted into tokens.
•Redirections: It is a way to manage and control the input and output.
•Command execution: It decides how the system will react when we execute a command.
•Shell Scripts: It is a text file that has shell commands and executes them when it is used
Shell commands
1. An executable program like all those files we saw in /usr/bin. Within this category,
programs can be compiled binaries such as programs written in C and C++, or programs written
in scripting languages such as the shell, python, etc.
2. A command built into the shell itself (built-in commands) bash supports a number of
commands internally called shell built-ins.
3.A shell function. These are miniature shell scripts incorporated into the environment.
4. An alias. Commands that we can define ourselves, built from other commands.

Syntax: command [options…] [arguments…]

• Commands, options, and arguments are all case sensitive


Identify Shell commands
It is often useful to know exactly which of the four
kinds of commands is
being used.
A. Display a Command’s Type
- The type command is a shell built-in that displays
the kind of command the shell will execute,

B. Display an Executable’s Location


- Sometimes there is more than one version of an
executable program installed on a system.
- To determine the exact location of a given
executable, the which command is used.
Unix Vs Linux
Unix Vs Linux
Linux Vs Windows
Linux Vs Windows
orl

Thank you !

Get ready for our Linux directories next week!

You might also like