Module 3 - part 1 - Notes
Module 3 - part 1 - Notes
Tech 2024, S2 EC
Module 3
Module 3
★ Computer System Software - Operating Systems, Basic commands in Linux / Windows, Shell
scripting (bash).
★ Basics of IP addresses, DHCP, NAT, Network Security (Desktop & Perimeter), DNS, VPN,
Routers, Client-Server, Internet, WWW, Web servers.
System software presents the user with a set of services and resources across the interface
labeled A in Figure 6.1. These resources may actually exist, or they may be simulated by the
software to give the user the illusion that they exist. The set of services and resources created
by the software and seen by the user is called a virtual machine or a virtual environment.
The system software, not the user, interacts with the actual hardware (that is, the naked
machine) across the interface labeled B in Figure 6.1.
The system software has the following responsibilities, analogous to those of the automobile
dashboard:
● Hides the complex and unimportant (to the user) details of the internal structure of the
Von Neumann architecture
● Presents important information to the user in a way that is easy to understand
● Allows the user to access machine resources in a simple and efficient way
● Provides a secure and safe environment in which to operate
For example, to add two numbers, it is much easier to use simple notation such as a = b + ¢
than to worry about
(1) loading ALU registers from memory cells b and ¢,
(2) activating the ALU,
(3) selecting the output of the addition circuit, and
(4) sending the result to memory cell a.
The programmer should not have to know about registers, addition circuits, and memory
addresses but instead should see a virtual machine that “understands” the mathematical
symbols + and =.
After the program has been written, it should automatically be loaded into memory without the
programmer having to specify where it should be placed or having to set the program counter.
Instead, he or she should be able to issue one simple command (or one set of mouse clicks) to
the virtual machine that says, “Run my program.” Finally, when the program is running and
generating results, the programmer should be able to instruct the virtual machine to send the
program’s output to the printer in Room 105, without reference to the details related to I/O
controllers, interrupt signals, and code sets.All the useful services just described are provided
by the system software available on any modern computer system.
1. Operating Systems (OS): The most essential software that manages computer
hardware and software resources.(Examples: Windows, Linux, macOS, Android.)
2. Utility Programs: Software designed to help in system maintenance and optimization
(e.g., antivirus, disk cleanup tools).
3. Device Drivers: Programs that allow the operating system to communicate with
hardware components (e.g., printer drivers, graphics card drivers).
4. Firmware: Low-level software embedded in hardware components, providing essential
control functions.(Examples: BIOS, UEFI, Embedded System Firmware.)
5. Language Translators:Converts programming code into machine language.
Example:assemblers(masm), Compilers (GCC, Java Compiler), Interpreters (Python,
JavaScript).
6. Middleware:Acts as a bridge between applications and the OS. Examples: API Libraries,
Database Middleware.
An Operating System (OS) is the primary system software that manages all the hardware and
software on a computer. It provides an interface for users to interact with the machine and
facilitates the execution of programs.
An operating system may be defined as a collection of computer programs that integrate the
hardware resources of the computer and make those resources available to a user and the
user’s programs, in a way that allows the user access to the computer in a productive, timely,
and efficient manner.
In other words, the operating system acts as an intermediary between the user and the user’s
programs and the hardware of the computer. It makes the resources available to the user and
the user’s programs in a convenient way, on the one hand, and controls and manages the
hardware, on the other.
In serving as an intermediary between the users of computer services and the computer’s
resources, the operating system provides three basic types of services:
1) It accepts and processes commands and requests from the user and the user’s
programs and presents appropriate output results.
2) It manages, loads, and executes programs.
3) It manages the hardware resources of the computer, including the interfaces to
networks and other external parts of the system.
There are ten major blocks to be considered, not all of which will necessarily be found in any
particular operating system:
1) ■ The command processor, application program interface, and user interface
2) ■ The file management system
3) ■ The input/output control system
4) ■ Process control management and interprocess communication
5) ■ Memory management
6) ■ Scheduling and dispatching
7) ■ Secondary storage management
8) ■ Network management, communication support, and communication interfaces
9) ■ System protection management and security
10)■ Support for system administration
Some systems also provide a program known as a system manager, commonly known as a
monitor or supervisor, which handles competing requests or conflicts, and which acts as a
general controller and arbiter for the entire system. There are other system functions, such as
accounting and error handling, that are sometimes handled as separate blocks but frequently
appear within the blocks already listed.
In different types of operating systems, some of these components may be combined, or even
absent. An embedded system may not require a file system or memory manager if all its
programs are permanently resident in ROM, for example, but the listed components represent a
collection of the most general operating system requirements.
Figure 15.2 is a simplified diagram showing the relationships between the different
components of an operating system. The diagram focuses on the interactions among the most
user-visible services. Specific multitasking and bootstrapping components are not shown.
These are part of the core services, which also include process and thread management,
resource allocation, scheduling, memory management, security, and interprocess
communication.
1. Process Management: Handles the execution of multiple processes, ensuring efficient
CPU usage.
2. Memory Management: Allocates and manages the computer's RAM, ensuring
processes get the required memory.
3. File System Management: Manages the storage, retrieval, and organization of data in
files and directories.
4. Device Management: Controls hardware devices by using drivers, ensuring smooth
communication between the OS and peripherals.
5. User Interface: Provides a Graphical User Interface (GUI) or Command Line Interface
(CLI) for user interaction.
6. Security and Access Control: Protects data and resources from unauthorized access
through user authentication and permissions.
1. Batch Operating System: Executes batches of jobs without user interaction.
2. Time-Sharing Operating System: Allows multiple users to access the system
simultaneously.
3. Distributed Operating System: Manages a group of networked computers, enabling
them to function as a single system.
4. Real-Time Operating System (RTOS): Processes data in real-time, commonly used in
embedded systems.
5. Mobile Operating System: Designed for mobile devices (e.g., Android, iOS).
6. Conclusion: System software, especially operating systems, plays a vital role in the
functioning of a computer. Understanding their purpose and operation is fundamental for
anyone learning about computers, as they form the backbone of modern technology.
Types of Linux OS
The ls command in Linux is one of the most frequently used commands. It is used to list
the contents of a directory. It shows files, directories, and symbolic links. Here’s a detailed
explanation of the command, including its syntax, common options, and examples.
Syntax
ls [OPTION]... [FILE]...
Default Behavior
● Without any options, ls lists the contents of the current directory in a simple format.
● It does not show hidden files (files starting with a dot .) by default.
Common Options
Option Description
-l Displays contents in a detailed (long) format, including file permissions,
size, and more.
-a Lists all files, including hidden files (starting with .).
-h Shows file sizes in a human-readable format (e.g., 1K, 5M, 3G).
-R Lists contents of directories recursively.
-t Sorts files by modification time (newest first).
-r Reverses the order of the listing.
-S Sorts files by size (largest first).
--colo Adds colors to distinguish file types (e.g., directories in blue, files in white).
r
-d Lists directories themselves, not their contents.
-i Displays the inode number of each file.
--help Displays a help message with usage information.
When you use the ls -l command, it provides detailed information about each file/directory.
For example:
ls -l
Sample Output:
-rw-r--r-- 1 user group 1234 Nov 30 14:00 file.txt
drwxr-xr-x 2 user group 4096 Nov 30 14:00 mydir
Explanation:
Examples
1. List Files in Current Directory
ls
2. List All Files, Including Hidden Files
ls-a
3. Detailed(long) Listing
ls -l
4.Human-Readable File Sizes
ls -lh
5.Sort by File Size
ls -lS
6.Recursive Listing
ls-R
7.Combine Multiple Options
ls -lah
This will list all files (including hidden ones) in a detailed format with human-readable sizes.
Tips
● Use ls --color or configure your terminal to enable colored output for better
visualization.
● Combine options for more tailored outputs, like ls -ltr to list files sorted by time
in reverse order.
● To explore all available options, use: man ls
Summary
The ls command is an essential tool for navigating and managing files in Linux. With its
wide range of options, it offers flexibility and customization for displaying directory
contents. It is highly recommended to practice using different combinations of options to
get familiar with its usage.
The mkdir command in Linux is used to create directories. It is one of the fundamental
commands for managing the file system. Here's a detailed explanation of the mkdir
command, including its syntax, options, and examples.
Syntax
Basic Functionality
Without any options, mkdir creates a new directory with the specified name in the current
working directory.
Common Options
Option Description
-p Creates parent directories as needed. Prevents errors if the directory already exists.
● If you try to create a nested directory (e.g., parent/child) without -p, it will fail if
parent does not exist.
● Using -p, mkdir will create all necessary parent directories.
mkdir -p parent/child
2. -v (Verbose Mode)
mkdir -v mydir
# Output: mkdir: created directory 'mydir'
3. -m (Set Permissions)
Examples
mkdir -p projects/python/scripts
5. Verbose Output
mkdir -v newdir
mkdir -p existing_dir
8.Combine Options:
ls -ld newdir
● If the -m option is not used, the directory permissions are determined by the user’s
umask.
Summary
The mkdir command is a simple yet powerful tool for directory management. By using
options like -p for nested directories or -m for permissions, it provides flexibility to suit
various needs. Practicing with this command helps you manage directories efficiently in the
Linux file system.
Syntax
-p:Removes the specified directory and any parent directories if they are empty.
rm -r Command
If you need to remove non-empty directories or directories containing files, you use the rm
command with the -r (recursive) option.
Examples
rmdir emptydir
rmdir -p parent/child
rm -r dir
rm -rf dir
rm -r dir1 dir2
tree dir
Summary
Basic Functionality
Common Options
Option Description
-f Force deletion without prompting or showing error messages for
non-existent files.
-i Prompts for confirmation before each file or directory is removed.
-I Prompts once before removing more than three files or recursively
deleting.
-r or -R Removes directories and their contents recursively.
-d Removes empty directories.
--preserve-r Prevents recursive deletion of the root directory / (default
oot behavior).
--help Displays help information about the command.
Examples
7. Interactive Deletion
rm -i file1.txt
Summary
The rm command is a versatile tool for file and directory management. With options like -r
for recursive deletion, -f for forced deletion, and -i for interactive mode, it offers flexibility
for various scenarios. However, its power comes with responsibility — always double-check
paths and options before executing potentially destructive commands.
cat command
The cat command in Linux is a fundamental tool used to concatenate and display file
contents. It is frequently utilized to read, create, and combine files, making it a versatile and
essential command in Linux and Unix-like systems.
Syntax
cat [OPTION]... [FILE]...
Common Options
Option Description
-n Numbers all lines in the output.
-b Numbers only non-empty lines in the output.
-s Suppresses repeated empty lines in the output.
-T Displays tab characters as ^I.
-v Shows non-printable characters (except for tabs and line endings).
-A Combines -vET to show all non-printable characters, end-of-lines, and
tabs.
-e Equivalent to -vE; shows non-printable characters and end-of-line markers.
-E Displays $ at the end of each line.
Examples
6.Create a File
You can use cat to create a file and input text directly from the terminal.Type the content,
and press CTRL+D to save and exit:
7.Append to a File
cat >> existingfile.txt
8.Concatenate Files
cat file1.txt file2.txt > combined.txt
Summary
The cat command is an indispensable utility in Linux for managing and viewing files. Its
simplicity and flexibility make it a favorite for both basic and advanced text operations.
With options like -n, -b, and -s, it provides detailed control over file output and
manipulation. Always use it carefully, especially when overwriting or appending data.
cp - copy command
The cp command in Linux is used to copy files and directories from one location to
another. It is one of the fundamental file management commands and supports a variety of
options to handle permissions, symbolic links, and directory structures effectively.
Syntax
cp [OPTION]... SOURCE... DESTINATION
Common Options
Option Description
-a Archive mode: Preserves file attributes (e.g., ownership,
permissions, timestamps). Equivalent to -dR
--preserve=all.
-f Force overwriting existing files without prompting.
-i Interactive mode: Prompts before overwriting files.
-n No clobber: Prevents overwriting existing files.
-r or -R Recursive: Copies directories and their contents recursively.
-v Verbose: Displays detailed information about the copying
process.
-u Updates files only if the source file is newer than the destination
file or if the destination file does not exist.
--preserve Specifies which attributes to preserve (e.g., mode, ownership,
timestamps).
--no-preserve Specifies attributes not to preserve.
7. Verbose Mode
cp -v file1.txt file2.txt /home/user/documents/
Displays the files being copied:
Summary
The cp command is a versatile and powerful tool for copying files and directories in Linux.
With options like -r for recursive copying, -a for preserving attributes, and -i for
interactive mode, it provides flexibility and control over the copying process. Always
double-check source and destination paths to prevent accidental overwrites or data loss.
mv - move command
he mv command in Linux is used to move or rename files and directories. It is a versatile
command for organizing and renaming files and directories in the filesystem.
Syntax
mv [OPTIONS] SOURCE DESTINATION
Common Options
Option Description
-i Interactive: Prompts for confirmation before overwriting existing files.
-f Force: Moves files without prompting, even if overwriting.
-n No-clobber: Prevents overwriting existing files.
-u Updates: Only moves files if the source is newer than the destination or
missing.
-v Verbose: Displays the details of the move process.
Usage
1. Move a File
mv file1.txt /home/user/documents/
2. Rename a File
mv file1.txt renamed_file.txt
4.Move a Directory
mv /source_directory /destination_directory/
5.Interactive Mode
mv -i file1.txt /home/user/documents/
6. No Overwrite
mv -n file1.txt /home/user/documents/
7. Verbose Mode
mv -v file1.txt /home/user/documents/
Permissions Requires write permissions at both locations. Requires read permissions at source and
write at destination.
Summary
The mv command is a straightforward yet powerful utility for file and directory
management. Its ability to rename and move files or directories, coupled with options for
interactive mode, verbose output, and safe handling, makes it essential for organizing and
maintaining a Linux filesystem. Always use caution when moving files, especially across
different directories, to avoid unintended data loss.
Syntax
Each file or directory has three types of permissions for three categories of users:
Permission Types
Permission Symbol Description
Read r Allows reading the file or listing the directory.
Write w Allows modifying the file or creating/deleting files in a
directory.
Execute x Allows executing a file or accessing a directory.
User Categories
User Symb Description
ol
Owner u The file's creator or owner.
Group g Users in the file's group.
Others o All other users.
All a Represents u, g, and o combined.
output:
-rw-r--r-- 1 user group 1234 date file.txt
Here:
Setting Permissions
Symbolic mode modifies permissions by adding (+), removing (-), or setting explicitly (=)
for specific categories.
Numeric mode uses a three-digit octal number to set permissions. Each digit represents
the permissions for owner, group, and others:
Example 1: Set rwx for Owner, r-- for Group, and --- for Others
chmod 740 file.txt
Options
Option Description
-R Recursive: Changes permissions for files and
subdirectories.
--verbose Displays a message for each file processed.
--help Displays help for the command.
Examples
Best Practices
Summary
The chmod command is a fundamental tool for managing file and directory security in
Linux. By understanding symbolic and numeric modes and their appropriate use cases, you
can control access effectively and maintain system security.
Windows Command Prompt (CMD) is a powerful tool that allows users to interact with the
operating system directly. Learning basic commands can enhance troubleshooting skills and
improve productivity.
● Command: cmd
● Explanation: Opens the Command Prompt.
● Example:
1. Press Windows + R.
2. Type cmd and press Enter.
● Command: cd
● Explanation: Displays or changes the current directory.
● Example:
cd Documents
Changes to the Documents directory.
● Command: dir
● Explanation: Lists files and directories in the current directory.
● Example:
dir
Shows all files and folders in the current location.
● Command: mkdir
● Explanation: Creates a new directory.
● Example:
mkdir NewFolder
Creates a folder named NewFolder.
5. Deleting a Folder
● Command: rmdir
● Explanation: Removes a directory (must be empty).
● Example:
rmdir OldFolder
Deletes the OldFolder directory.
6. Deleting Files
● Command: del
● Explanation: Deletes files.
● Example:
del file.txt
Deletes the file named file.txt.
● Command: rename
● Explanation: Renames a file or folder.
● Example:
rename oldfile.txt newfile.txt
Renames oldfile.txt to newfile.txt.
8. Copying Files
● Command: copy
● Explanation: Copies files from one location to another.
● Example:
copy file.txt D:\Backup
Copies file.txt to the Backup folder in drive D.
9. Moving Files
● Command: move
● Explanation: Moves files to a new location.
● Example:
move file.txt D:\Documents
Moves file.txt to the Documents folder in drive D.
● Command: cls
● Explanation: Clears the Command Prompt screen.
● Example:
cls
Clears the current screen
● Command: ipconfig
● Explanation: Displays IP address and network details.
● Example:
ipconfig
Shows network configuration and IP address.
● Command: ping
● Explanation: Tests connectivity to a website or IP address.
● Example:
ping google.com
Checks if Google is reachable.
● Command: shutdown
● Explanation: Shuts down or restarts the computer.
● Example:
shutdown /s /t 60
Shuts down the computer in 60 seconds.
● Command: exit
● Explanation: Closes the Command Prompt.
● Example:
exit
Exits the terminal.
To close or exit the Windows command line window, also called command or cmd mode or
DOS mode, type exit and press Enter .
Learning basic Windows commands helps students gain confidence in navigating and
managing files efficiently. These commands form the foundation for more advanced
system management tasks.
Computer Communications
LAN , WAN and MAN
1. Local Area Network (LAN)
A LAN connects devices within a limited area, like an office building, school, or campus.
The goal of a LAN is to share resources (e.g., files, printers, software) among devices in
close proximity.
Technical Details:
● Hardware: LANs commonly use Ethernet cables, switches, and routers. Wireless
LANs (Wi-Fi) use access points (APs).
● Topology: Common topologies (arrangements of devices) in LANs include star, bus,
and ring.
● Protocols: LANs use standard protocols such as Ethernet (IEEE 802.3) or Wi-Fi
(IEEE 802.11).
● Ethernet is a set of technologies and protocols that are used primarily in LANs. It
was first standardized in the 1980s by IEEE 802.3 standard.
Example: Imagine an office building where all employees' computers are connected to a
central server. They can share files, access applications, and use a common printer. This
setup is efficient because it limits data flow to a small area, optimizing speed and reducing
data transfer costs.
Advantages:
● High Data Transfer Speeds: Up to 10 Gbps or more in some cases.
● Low Cost: Less costly to set up and maintain compared to MANs and WANs.
● Security: Easier to control access and secure devices within a small area.
Limitations:
● Limited Range: Only suitable for small geographic areas.
● Scaling: Expanding a LAN to cover larger areas can be challenging and requires
careful design.
Technical Details:
● Hardware: MANs often use fiber-optic cables or microwave links to maintain higher
speeds across distances.
● Protocols: MANs may use protocols like Fiber Distributed Data Interface (FDDI) and
Synchronous Optical Network (SONET).
● Transmission Media: Fiber optics and microwave systems are popular due to their
efficiency in medium-range distances.
Example: Consider a university with multiple campuses across a city. A MAN can connect
each campus’s LAN to enable seamless data exchange, centralized resource access, and
secure communications between campuses.
Advantages:
● Extended Range: Covers a large area (up to a city or town) while still maintaining
moderate speeds.
● Efficient Resource Sharing: Allows organizations to share data and applications
efficiently across multiple sites.
● Cost-Effective for City Networks: MANs are more affordable than WANs for city-level
networking.
Limitations:
● Moderate Cost: More expensive than LANs because of the larger geographic area
and the need for specialized hardware.
● Complex Management: Requires advanced network management due to multiple
locations and devices.
Technical Details:
● Hardware: WANs utilize a combination of leased lines, satellites, fiber optics, and
cellular networks.
Example: Large corporations like Amazon or Google have offices worldwide that need to
communicate and share data constantly. A WAN allows these offices to operate as part of
the same network, despite being in different countries.
Advantages:
● Global Reach: Enables global operations and remote work by connecting locations
across vast distances.
● Redundancy: WANs often include redundant paths to ensure reliability.
● Flexibility: Supports various types of data, including voice, video, and text.
Limitations:
● High Cost: Setting up and maintaining a WAN is expensive due to the infrastructure
required.
● Lower Speed: Data speeds are generally lower than LANs and MANs because of
the extensive distances and multiple network hops involved.
● Security Concerns: Managing security across such a large network is complex,
with more exposure to potential threats.