Net
Net
• The shell can be defined as a command interpreter within an operating system like Linux/GNU or
Unix. It is a program that runs other programs. The shell facilitates every user of the computer as
an interface to the Unix/GNU Linux system. Hence, the user can execute different tools/utilities or
commands with a few input data .The shell sends the result to the user over the screen when it has
completed running a program which is the common output device. That's why it is known as
"command interpreter”. The shell is not just a command interpreter. Also, the shell is a
programming language with complete constructs of a programming language such as functions,
variables, loops, conditional execution, and many others
1. Shell is responsible to read command provided by user
2. Shell will check whether the command is valid or not.
3. Shell will check whether the command is properly used or not
4. If every thing is proper then shell interprets (convert) that command into command
understandable form and handover that converted command to kernel.
5. Shell acts as interface between user and kernel .shell +kernel is nothing but operating
system.
6. Kernel is responsible to execute that command with the help of hardware .
Bourne shell:
It is developed by Stephen Bourne. It is a first shell which is developed for UNIX. By using sh
command we can access this shell.
[Link] full-path name is /bin/sh and /sbin/sh,
[Link]-root user default prompt is $,
3. Root user default prompt is #.
Bash shell(Bourne Again Shell)
It is advanced version of Bourne shell. This is default shell for most of Linux Flavors.
By using bash command we can access this shell.
Korn Shell:
1. It is developed by David Korn.
2. Mostly this shell used in IBM AIX operating system.
3. By using ksh command, we can access this shell.
4. Command full-path name is /bin/ksh .
Tshell
1.T means Terminal
[Link] is advanced version of Cshell
[Link] is most commonly used in Hp UNIX systems
[Link] using tcsh command we can access Tshell.
[Link] full-path name is /bin/tcsh.
Zshell
1. ZShell was created by Paul Falstad in 1990 while he was a student at Princeton University. Z Shell is
an extended version of the Bourne-Again Shell (bash), with additional features and capabilities.
2. By using zsh command we can acess Zshell
3. Command full-path name is /bin/zsh,
Note:
• Usually owner or root user can change permission of shell
• The most commonly used shell in Linux environment is Bash
• How to check default shell in our system
• echo $0 or echo $SHELL
• We can check default shell information inside /etc/passwd file also.
• How to check all available shell in our system
• cat /etc/shells
What is shell Script?
• A sequence of command saved to a file and this file is nothing but shell script. It
can contains programming features like control statements, loops, functions,
array ,if-else, switch /case etc. Shell Scripting is a way of writing scripts of
programs that are executed in a terminal or shell. Basically, it is a program or
script which is written with the help of variables mentioned in it. It is powerful
because it can automate tasks, and in this one can use programming constructs
that are available in shell, such as loops, conditionals and functions.
Shell Variable is used in shell scripts for many functionalities like storing data
and information, taking input from users, printing values that are stored. They are
also used for storing data temporarily and storing output of commands.
Shell Variables are used to store data and information within a shell (terminal), and they are also
used for controlling the behavior of program and scripts. Some of the common uses are:
1. Setting environment variables.
2. Storing configuration data.
3. Storing temporary data.
4. Passing arguments to scripts.
Rules for variable definition
A variable name could contain any alphabet (a-z, A-Z), any digits (0-9), and an underscore ( _ ).
However, a variable name must start with an alphabet or underscore. It can never start with a
number. Following are some examples of valid and invalid variable names:
Valid variable:
ABC, _AV_3, AV232
Invalid variable:
2_AN, !ABD, $ABC, &QAID
Accessing variable echo $var1 $var2
Variable data could be accessed by appending Note: The unset command could not
the variable name with ‘$’ as follows: be used to unset read-only variables.
#!/bin/bash
VAR_1="Devil"
By using sha-bang, we can specify the
VAR_2="OWL" interpreter(command) which is responsible to
echo "$VAR_1$VAR_2“ execute the script.
Unsetting Variables
The unset command directs a shell to delete a
variable and its stored data from list of
variables. It can be used as follows:
#!/bin/bash
var1="Devil"
var2=23
echo $var1 $var2
unset var1
Variable Types:
1. Local Variables:
Variables declared inside a function or a script block using local keyword are local to that scope and are
not accessible outside.
function my_function() {
local localVar="Hello"
echo $localVar
}
2. Global Variables:
Variables declared outside any function or block are global and can be accessed throughout the script
globalVar="World“
echo $globalVar
3. Environment Variable:
These variables are commonly used to configure the behavior script and programs that are run
by shell. Environment variables are only created once, after which they can be used by any user.
For example:
`export PATH=/usr/local/bin:$PATH` would add `/usr/local/bin` to the beginning of the shell’s
search path for executable programs.
4. Shell Variables:/System Variables:
4. These are predefined variables by the shell or the system, and their values are set by the shell or the
operating system.
For example:
$HOME: Home directory of the user.
$USER: Current username.
$PWD: Present working directory.
$SHELL : Stores the path to the shell program that is being used.
5. Special Variables:
These are variables with special meanings in the shell.
Examples:
$?: Exit status of the last executed command.
$$: Process ID of the current script.
$!: Process ID of the last background command.
6. Array Variables: var1=23
Arrays are used to store multiple values under a echo $var1 $var2
single variable name.
fruits=("apple" "banana" "orange")
echo ${fruits[0]}
Calculate area of rectangle
#!/bin/bash
7. Read only Variables. echo "Enter the length of the
These variables are read only i.e. rectangle"
their values could not be modified later in the read length
script. Following is an example: echo "Enter the width of the
#!/bin/bash rectangle"
var1="Devil" read width
area=$((length * width))
var2=23
echo "The are of the rectangle is:
readonly var1
$area"
echo $var1 $var2
Working with files and directories :
One of the most important features of the Unix file system is its support for symbolic links, which are pointers to other files or
directories. This allows for flexible organization of files and directories without having to physically move them around.
1. /: The slash / character alone denotes the root of the filesystem tree.
2. /bin: Stands for “binaries” and contains certain fundamental utilities, such as ls or cp, which are generally needed by
all users.
3. /boot : Contains all the files that are required for successful booting process.
4. /dev :Stands for “devices”. Contains file representations of peripheral devices and pseudo-devices.
5. /etc : Contains system-wide configuration files and system databases. Originally also contained “dangerous
maintenance utilities” such as init, but these have typically been moved to /sbin or elsewhere.
6. /home: Contains the home directories for the users.
7. /lib: Contains system libraries, and some critical files such as kernel modules or device drivers.
8. /media: Default mount point for removable devices, such as USB sticks, media players, etc.
9. /mnt : Stands for “mount”. Contains filesystem mount points. These are used, for example, if the system uses multiple
hard disks or hard disk partitions. It is also often used for remote (network) filesystems, CD-ROM/DVD drives, and
so on.
10. /proc: procfs virtual filesystem showing information about processes as files.
11. /root: The home directory for the superuser “root” – that is, the system administrator.
This account’s home directory is usually on the initial filesystem, and hence not in
/home (which may be a mount point for another filesystem) in case specific
maintenance needs to be performed, during which other filesystems are not available.
Such a case could occur, for example, if a hard disk drive suffers physical failures and
cannot be properly mounted.
12. /tmp: A place for temporary files. Many systems clear this directory upon startup; it
might have tmpfs mounted atop it, in which case its contents do not survive a reboot, or
it might be explicitly cleared by a startup script at boot time.
13. /usr: Originally the directory holding user home directories,its use has changed. It now
holds executables, libraries, and shared resources that are not system critical, like the X
Window System, KDE, Perl, etc. However, on some Unix systems, some user accounts
may still have a home directory that is a direct subdirectory of /usr, such as the default
as in Minix. (on modern systems, these user accounts are often related to server or
system use, and not directly used by a person).
10. /usr/bin: This directory stores all binary programs distributed with the operating system not
residing in /bin, /sbin or (rarely) /etc.
11. /usr/include: Stores the development headers used throughout the system. Header files are
mostly used by the #include directive in C/C++ programming language.
16. /usr/lib: Stores the required libraries and data files for programs stored within /usr or
elsewhere.
17. /var: A short for “variable.” A place for files that may change often – especially in size, for
example e-mail sent to users on the system, or process-ID lock files.
18. /var/log: Contains system log files.
19. /var/mail: The place where all the incoming mails are stored. Users (other than root) can
access their own mail only. Often, this directory is a symbolic link to /var/spool/mail.
20. /var/spool: Spool directory. Contains print jobs, mail spools and other queued tasks.
21. /var/tmp: A place for temporary files which should be preserved between system reboots.
Proxy Server:
A proxy server is a type of internet intermediate server that operates as a bridge between a client,
like a computer or smartphone, and the destination server. A resource request is made by a client,
which the proxy server intercepts, passes to the target server, and then relays back to the client the
response from the destination server.
[Link] Addressing
• IPv4 & IPv6 Addressing: Assigning IP addresses to devices is fundamental. IPv4 uses a 32-bit address space, while IPv6
uses 128-bit.
• Subnetting: Dividing an IP network into subnets helps manage network traffic and improve performance. This includes
understanding subnet masks, CIDR notation, and calculating subnets.
• DHCP (Dynamic Host Configuration Protocol): Automates the assignment of IP addresses and other network
configuration details to devices.
• NAT (Network Address Translation): Translates private IP addresses to a public IP address to enable internet access for
devices within a network.
2. Routing and Switching
• Routing Protocols: TCP/IP networks rely on routing protocols like OSPF (Open Shortest Path First), BGP (Border
Gateway Protocol), and RIP (Routing Information Protocol) to direct traffic between networks.
• Switching: At Layer 2 of the OSI model, switches help in efficiently forwarding data frames within a local area network
(LAN). VLANs (Virtual Local Area Networks) can be configured to segment network traffic.
• Default Gateways: Devices use the default gateway to route traffic outside of the local network. The default gateway is
often the router's IP address.
3. TCP/IP Protocols and Services
• TCP vs. UDP: TCP provides reliable, connection-oriented communication, while UDP is a faster, connectionless
protocol used for streaming and DNS.
• DNS (Domain Name System): Translates domain names to IP addresses.
• FTP, HTTP, HTTPS, SMTP: Common application layer protocols used for transferring files, web browsing, and
sending emails, respectively.
• ICMP (Internet Control Message Protocol): Used for diagnostics and error reporting, e.g., "ping" commands to
check network connectivity.
4. Security
• Firewalls: Filter incoming and outgoing traffic based on predefined security rules.
• VPN (Virtual Private Networks): Securely connects remote users to the network over the internet.
• Encryption: Securing data with SSL/TLS (for HTTPS) or IPSec for VPNs.
• Access Control Lists (ACLs): Used on routers and firewalls to control which traffic is allowed into or out of the
network.
5. Monitoring and Management Tools
• SNMP (Simple Network Management Protocol): Used to monitor and manage network devices like routers and
switches.
• Syslog: Centralized logging for network devices.
• Network Monitoring Tools: Applications like Nagios, SolarWinds, or Wireshark are used to monitor network
performance, detect anomalies, and troubleshoot issues
[Link] TCP/IP Networks
• Ping and Traceroute: Basic tools for checking connectivity and tracing the path of packets through the
network.
• Packet Capture: Using tools like Wireshark to analyze network traffic at a granular level.
• Network Diagnostics: Testing cable connections, checking routing tables, verifying IP configurations,
and using command-line tools like ipconfig ,ifconfig , netstat
[Link] of Service (QoS)
• Traffic Prioritization: QoS settings help ensure that critical services like VoIP or video conferencing
have the required bandwidth and low latency.
8. Network Redundancy and High Availability
• Load Balancing: Distributes network traffic across multiple servers to prevent overload.
• Redundant Links: Ensuring multiple paths are available for critical network segments.
• Failover Systems: Standby systems that take over if primary systems fail.
9. IPv6 Considerations
• Migration from IPv4 to IPv6: As IPv4 addresses are exhausted, IPv6 adoption is growing. Admins need
to handle dual-stack configurations and ensure compatibility.
• IPv6 Addressing and Stateless Address Auto-configuration (SLAAC): New addressing schemes and
auto-configuration options available in IPv6.
Switch :
• A network switch connects devices in a network to each other, enabling them to talk by
exchanging data packets. Switches can be hardware devices that manage physical networks or
software-based virtual devices.
• A network switch operates on the data-link layer, or Layer 2, of the Open Systems
Interconnection (OSI) model. In a local area network (LAN) using Ethernet, a network switch
determines where to send each incoming message frame by looking at the media access
control (MAC) address. Switches maintain tables that match each MAC address to the port
receiving the MAC address.
Types of Switch
1. Unmanaged switches: These switches have a simple plug-and-play design and do not offer
advanced configuration options. They are suitable for small networks or for use as an expansion to a
larger network.
2. Managed switches: These switches offer advanced configuration options such as VLANs, QoS, and
link aggregation. They are suitable for larger, more complex networks and allow for centralized
management.
5. PoE switches: These switches have Power over Ethernet capabilities, which allows
them to supply power to network devices over the same cable that carries data.
6. Gigabit switches: These switches support Gigabit Ethernet speeds, which are faster
than traditional Ethernet speeds.
7. Rack-mounted switches: These switches are designed to be mounted in a server rack
and are suitable for use in data centers or other large networks.
8. LAN Switch − Local Area Network (LAN) switches connects devices in the internal
LAN of an organization. They are also referred as Ethernet switches or data switches.
These switches are particularly helpful in reducing network congestion or bottlenecks.
They allocate bandwidth in a manner so that there is no overlapping of data packets in a
network.
Routing and its necessity:
• Routing is a process which is performed by layer 3 (or network layer) devices in order to
deliver the packet by choosing an optimal path from one network to another.
• A Routing is a process of selecting path along which the data can be transferred from source
to the destination. Routing is performed by a special device known as a router.
• Routing is process of establishing the routes that data packets must follow to reach the
destination. In this process, a routing table is created which contains information regarding
routes which data packets follow.
• A Router works at the network layer in the OSI model and internet layer in TCP/IP model. A
router is a networking device that forwards the packet based on the information available in
the packet header and forwarding table.
• In internetworking, the process of moving a packet of data from source to destination.
Routing is usually performed by a dedicated device called a router.
• Routing is a key feature of the Internet because it enables messages to pass from one
computer to another and eventually reach the target machine.
Types of Routing:
1. Static Routing: In static routing, network administrators manually configure
the routing tables of routers. The paths that data will take are predetermined and
do not change automatically, even if the network topology changes. While
simple and easy to implement, static routing is not suitable for large, complex
networks that undergo frequent changes.
2. Dynamic Routing: Dynamic routing protocols allow routers to exchange
information about the network's current state, enabling them to dynamically
update their routing tables based on real-time information. This adaptive nature
allows dynamic routing to respond to changes in network topology, link
failures, and traffic conditions. Common dynamic routing protocols include
OSPF (Open Shortest Path First) and RIP (Routing Information Protocol).
• Dynamic Routing Vs Static Routing:
• The complete graph is formed when a maximum number of lines connects all the points,
whereas the spanning tree is formed when a minimum number of lines connects all the
points.
1. A is directly connected to B and C, while B and C are indirectly connected through A. In this spanning
tree, A is a central point and all the points are connected without any formation of loops.
2. B is directly connected to A and C, while A and C are connected through B. B is a bridge between A and
C, or we can say that B is a central point. In this case, also, all the points are connected without any
formation of loops.
3. C is directly connected to both A and B, while A and B are connected through C. Therefore, C is a bridge
between A and B, and C is a central point. In this case, all the points are connected without any formation
of loops.
How spanning tree protocol works?
1. This protocol selects one switch as a root bridge where the root bridge
is a central point as when the message is sent; then it always passes
through the bridge.
2. It selects the shortest path from a switch to the root bridge.
3. It blocks the links that cause the looping on a network, and all the
blocked links are maintained as backups. It can also activate the blocked
links whenever the active link fails. Therefore, we can say that it also
provides fault tolerance on a network.
Why use Linux?
• This is the one question that most people ask. Why bother learning a completely different computing
environment, when the operating system that ships with most desktops, laptops, and servers works just fine?
• To answer that question, I would pose another question. Does that operating system you’re currently
using really work “just fine”? Or, do you find yourself battling obstacles like viruses, malware, slow downs,
crashes, costly repairs, and licensing fees?
If you struggle with the above, Linux might be the perfect platform for you. Linux has evolved into one of
the most reliable computer ecosystems on the planet. Combine that reliability with zero cost of entry and you
have the perfect solution for a desktop platform.
• That’s right, zero cost of entry… as in free. You can install Linux on as many computers as you like without
paying a cent for software or server licensing.
• Let’s take a look at the cost of a Linux server in comparison to Windows Server 2016. The price of the
Windows Server 2016 Standard edition is $882.00 USD (purchased directly from Microsoft). That doesn’t
include Client Access License (CALs) and licenses for other software you may need to run (such as a
database, a web server, mail server, etc.). For example, a single user CAL, for Windows Server 2016, costs
$38.00. If you need to add 10 users, for example, that’s $388.00 more dollars for server software
licensing. With the Linux server, it’s all free and easy to install.
Linux (as both a desktop and server platform) does not have any issues with ransomware,
malware, or viruses. Linux is generally far less vulnerable to such attacks. As for server
reboots, they’re only necessary if the kernel is updated. It is not out of the ordinary for a
Linux server to go years without being rebooted. If you follow the regular recommended
updates, stability and dependability are practically assured.
Open source
Linux is also distributed under an open source license. Open source follows these key tenets:
1. The freedom to run the program, for any purpose.
2. The freedom to study how the program works, and change it to make it do what you
wish.
3. The freedom to redistribute copies so you can help your neighbor.
4. The freedom to distribute copies of your modified versions to others.
Basic Linux commands:
1. pwd :The pwd command is used to display the location of the current working directory.
Syntax: pwd.
2. . mkdir :The mkdir command is used to create a new directory under any directory.
Syntax: mkdir <directory name>
3. rmdir: The rmdir command is used to delete a empty directory.
Syntax: rmdir <directory name>
rmdir -r <directory name> :To delete non empty directory
4. ls : The ls command is used to display a list of content of a directory.
Syntax: ls
5. cd :The cd command is used to change the current directory.
Syntax: cd <directory name>
6. touch: The touch command is used to create empty files. We can create multiple empty files by
executing it once.
Syntax: touch <file name>
touch <file1> <file2> ....
7. cat : The cat command is a multi-purpose utility in the Linux system. It can be used to create a file, display
content of the file, copy the content of one file to another file, and more.
Syntax: cat [OPTION]... [FILE]..
To create a file, execute it as follows:
cat > <file name>
// Enter file content Press "CTRL+ D" keys to save the file.
To display the content of the file, execute it as follows: cat <file name>
8. rm : The rm command is used to remove a file.
Syntax: rm <file name>
9. cp : The cp command is used to copy a file or directory.
Syntax: To copy in the same directory: cp <existing file name> <new file name>
10. mv : The mv command is used to move a file or a directory form one location to another
location.
Syntax: mv <file name> <directory path>
11. head : The head command is used to display the content of a file. It displays the first 10 lines of a
file.
Syntax: head <file name>
12. tail Command : The tail command is similar to the head command. The difference between both
commands is that it displays the last ten lines of the file content. It is useful for reading the
error message.
Syntax: tail <file name>
13. tac Command: The tac command is the reverse of cat command, as its name specified. It
displays the file content in reverse order (from the last line).
Syntax: tac <file name>
14. more command : The more command is quite similar to the cat command, as it is used to display
the file content in the same way that the cat command does. The only difference between
both commands is that, in case of larger files, the more command displays screenful output
at a time.
In more command, the following keys are used to scroll the page:
ENTER key: To scroll down page by line.
Space bar: To move to the next page.
b key: To move to the previous page.
/ key: To search the string.
Syntax: more <file name>
15. less Command: The less command is similar to the more command. It also includes some extra
features such as 'adjustment in width and height of the terminal.' Comparatively, the
more command cuts the output in the width of the terminal.
Syntax: less <file name>
16. id Command: The id command is used to display the user ID (UID) and group ID (GID).
Syntax:id
17. wc Command: The wc command is used to count the lines, words, and characters in a file.
Syntax: wc <file name>
18. od Command: The od command is used to display the content of a file in different s, such as
hexadecimal, octal, and ASCII characters.
Syntax: od -b <fileName> // Octal format
od -t x1 <fileName> // Hexa decimal format
od -c <fileName> // ASCII character format
19. sort Command: The sort command is used to sort files in alphabetical order.
Syntax: sort <file name>
20. gzip Command :The gzip command is used to truncate the file size. It is a compressing tool. It
replaces the original file by the compressed file having '.gz' extension.
Syntax: gzip <file1> <file2> <file3>...
21. gunzip Command: The gunzip command is used to decompress a file. It is a reverse operation of
gzip command.
Syntax: gunzip <file1> <file2> <file3>
22. date Command :The date command is used to display date, time, time zone, and more.
Syntax: date
23. cal Command: The cal command is used to display the current month's calendar with the current
date highlighted.
Syntax: cal
24. sleep Command: The sleep command is used to hold the terminal by the specified amount of
time. By default, it takes time in seconds.
Syntax: sleep <time>
25. time Command: The time command is used to display the time to execute a command.
Syntax: time
26. zcat Command: The zcat command is used to display the compressed files.
Syntax: zcat <file name>
27. df Command: The df command is used to display the disk space used in the file system. It displays the
output as in the number of used blocks, available blocks, and the mounted directory.
Syntax: df
28. mount Command: The mount command is used to connect an external device file system to the system’s
file system.
Syntax: mount -t type <device> <directory>
29. exit Command: Linux exit command is used to exit from the current shell. It takes a parameter as a
number and exits the shell with a return of status number.
Syntax: exit
30. clear Command: Linux clear command is used to clear the terminal screen.
Syntax: clear
31. man command : The man command displays a user manual for any commands or utilities available in
the Terminal, including their name, description, and options. Command to view the full manual:
Syntax: man <command name>
32. ping Command: The ping command is used to check the connectivity between two nodes, that is whether
the server is connected. It is a short form of "Packet Internet Groper."
Syntax: ping <destination>
33. host Command :The host command is used to display the IP address for a given domain name and vice
versa. It performs the DNS lookups for the DNS Query.
Syntax: host <domain name> or <ip address>
34. history command: The history command is used to review all the commands which you have entered.
syntax : history
35. echo command : The echo command in Linux is specially used to print something in the
terminal,
Syntax: echo “string to be printed”
36. wget command :The wget command in the Linux command line allows you to download files from the
internet.
Syntax: wget <url>
vi : a program text editor , it can be used to edit all kind of plain text
. It is specially useful for editing program.
Note:
1. : w -> to save
2. :wq→ to save and quit
3. :q→ to quit
4. :q!→ forcefully quit without saving.
Useful Linux commands for user management
• Linux user management commands are straightforward and allow administrators to perform basic and
advanced operations such as creating, modifying, and deleting user accounts and groups and managing
account properties. Some useful Linux commands that administrators use regularly include:
Command Description
useradd Create new Linux user accounts and customize them by specifying various options such as
username, home directory, and user ID.
passwd Set or change the password for a user account.
usermod Modify the attributes of a user account, such as the username, home directory, user ID or group
ID associated with a particular user.
userdel Delete a user account that is no longer needed from the system, ensuring that the user no longer
has access to the system resources.
groupadd Add a new group in Linux and specify group options.
groupmod Modify or change an existing group.
groupdel Delete an existing group and all the files associated with that group.
chown Transfer the ownership of a file or directory to a different user or group.
chmod Change the permissions of a file or directory.
chgrp Change the group ownership of a file or directory with this command.
• /etc/passwd
• /etc/shadow
• /etc/group
• /etc/gshadow
• Useradd [option]
• -d :home directory
• -u: userid
• -g:groupid
• -m : without home directory
• -e : expiry date
• -c : with comment
• -s : login shell
File System Hierarchy
1. /home: home directory for other user.
2. /root: it is home directory for root user. You can say administrator user in linux.
3. /boot: it contains bootable file for linux
4. /etc: it contains all configuration file. Eg web server, Database server, DNS server etc.
5. /user: by default software are installed in this directory.
6. /bin: it contains commands used by all user including root user.
7. /sbin: it contains commands used by only root user.
8. /opt: optional application software package.
9. /dev : essential device file. This include terminal devices, used or any device attached to
the system.
10. /proc: Stores System and process related files.
11. /var: stores files which changes dynamically. For example Web server Data, Database
related files , log files.
12. /tmp: Stores all temporary files. All files will be deleted when system reboots.
Linux Kernel:
• The Linux kernel is the core component of the Linux operating system. It serves as the bridge between the
hardware of a computer system and the user-level applications and processes. The kernel is responsible for
managing system resources, such as the CPU, memory, devices, and input/output (I/O) operations.
Here are some key aspects and functions of the Linux kernel:
• Hardware Abstraction: The kernel abstracts the underlying hardware, providing a uniform interface for
applications to interact with different types of hardware components. This abstraction allows Linux to run on
a wide range of hardware architectures.
• Process Management: The kernel is responsible for managing processes, which are the running instances of
programs. It allocates resources, schedules tasks, and facilitates communication between processes.
• Memory Management: The kernel manages the system's memory, allocating and deallocating memory as
needed by processes. It also implements virtual memory, allowing multiple processes to run
simultaneously without interfering with each other's memory space.
• Device Drivers: The kernel includes device drivers that allow the operating system to communicate with
hardware devices such as hard drives, network interfaces, graphics cards, and more. These drivers enable
the kernel to control and interact with various hardware components.
• File System Management: The kernel manages file systems, providing an interface for reading, writing,
and organizing files on storage devices. It abstracts the details of different file systems, allowing users to
work with various storage media seamlessly.
• System Calls: The kernel exposes a set of system calls that applications can use to request services from
the kernel, such as file operations, process control, and communication between processes.
• Security: The kernel plays a crucial role in ensuring the security of the system. It enforces access control
policies, manages user permissions, and protects the system from unauthorized access.
• Networking: The kernel handles networking tasks, including protocol implementation, network stack
management, and communication between devices over a network.
Process management:
Process management in Linux is an essential skill for Linux administrators and developers.
It involves controlling and monitoring the processes running on a Linux system, including
managing process resources, scheduling processes to run on the CPU, and terminating
processes when necessary. Understanding the different types of processes, their states, and
the available commands for process management, such as ps, top, kill, nice, and renice,
are important for managing processes effectively.
Introduction to Process
A process is an instance of a program currently running on a computer system. In Linux,
processes are managed by the operating system's kernel, which allocates system resources
and schedules processes to run on the CPU. Understanding and managing processes is a
critical skill for Linux administrators and developers.
Types of Processes
• In Linux, processes can be categorized into two types:
Foreground Processes
• Foreground processes are the kinds of processes that require input from the user and are
characterized by their interactivity. For instance, a foreground process would be like you
are running an Office application on the Linux system.
Background Processes
• On the other hand, background processes are non-interactive operations carried out in
the background and do not call for any participation from the user. Antivirus software is
an example of a Background Process.
• Additionally, processes can be system processes or user processes. System
processes are initiated by the kernel, while users initiate User processes
• Process States in Linux:
In Linux, a process can be in one of five states:
• Running: The process is currently executing on the CPU.
• Sleeping: The process is waiting for a resource to become available.
• Stopped: The process has been terminated by a user
• Zombie: The process has completed execution but has not yet been cleaned by the
system.
• Orphan: The parent process of the current process has been terminated.
• Linux provides several commands for managing processes, which include:
Commands Description
ps Displays information about the processes running currently.
top Provides real-time information about system processes and their resource usage.
• =========================
• Echo $SHLVL: to check level
• Exec bash
• Ps fx : to display process detail in system
• Ps fx | grep bash: to display bash shell details
• Ps –ef:
• Pgrep: to search process eg. Pgrep bash , pgerp sshd
• Pstree : to display tree of process and child process
• to show process id with tree pstree –P
• Pstree –p –u moon: to display process associated with particular user.
• Strace –p <pid>: to check system call details and process state details.
• Pkill : to kill process with name.
• Killall process1 process 2 : kill all process.
• Sudo apt update
• Sudo apt install mysql-server
• Sudo systemctl status [Link] : to check status
• if not active and running (Sudo systemctl start [Link] : use this
command if and only active and running not found)
• Sudo mysql : to run nysql.
• Sudo mysql_secure_installation
• open new terminal then
• Sudo mysql
• Mysql> ALTER USER ‘root’@’localhost’ IDENTIFIED WITH
mysql_native_password BY’root’;
• Exit
• Sudo mysql_secure_installation
Mail server:
• A mail server (sometimes also referred to an e-mail server) is a server that handles and delivers
e-mail over a network, usually over the Internet. Email servers, or mail servers, are computer
programs that are in charge of sending, receiving, and storing emails. They are essential to the
operation of email communication. A mail server can receive e-mails from client computers and
deliver them to other mail servers. A mail server can also deliver e-mails to client computers. A
client computer is normally the computer where you read your e-mails, for example your
computer at home or in your office.
File Transfer Protocol(FTP): The process involving sending and receiving files between devices over a
network is called File Transfer Protocol(FTP).It is a standard communication protocol. It is built on a
client-server model architecture means clients can execute information from the remote file system
directly.
Web server:
Web servers are software applications or hardware devices that serve content to users over the
internet. They handle requests from client devices (such as web browsers) and deliver web pages,
images, videos, or other resources in response to those requests.
On the hardware side a web server is a computer that stores web server software and a
website’s components files( for example ,HTML documents, images, CSS stylesheet and
JavaScript files). A web server connects to the internet and supports physical data
interchange with other devices connected to the web.
On the software side a web server includes several parts that control how web users hosted files. At
minimum , this is an HTTP server. A HTTP server is a software that understands URLs(web
addresses) and HTTP (the protocol your browser uses to view webpages). An HTTP server can be
accessed through the domain names of the website it stores and it delivers the content of these
hosted websites to the end user’s device.
Here are some key aspects of web servers:
1. When client sends request for a web page, the web server search for the requested page if requested page
is found then it will send it to client with an HTTP response.
2. If the requested web page is not found, web server will the send an HTTP response: Error 404 Not
found.
3. If client has requested for some other resources then the web server will contact to the application server
and data store to construct the HTTP response.
There are several popular web servers, including:
Apache HTTP Server: This is the most popular web server in the world developed by the
Apache Software Foundation. Apache web server is an open source software and can
be installed on almost all operating systems including Linux, UNIX, Windows,
FreeBSD, Mac OS X and more. About 60%
Internet Information Services (IIS): The Internet Information Server (IIS) is a high
performance Web Server from Microsoft. This web server runs on Windows NT/2000
and 2003 platforms (and may be on upcoming new Windows version also). IIS comes
bundled with Windows NT/2000 and 2003; Because IIS is tightly integrated with the
operating system so it is relatively easy to administer it. the web server machines run the
Apache Web Server.
Sun Java System Web Server: This web server from Sun Microsystems is suited for medium and
large web sites. Though the server is free it is not open source. It however, runs on
Windows, Linux and UNIX platforms. The Sun Java System web server supports
various languages, scripts and technologies required for Web 2.0 such as JSP, Java
Servlets, PHP, Perl, Python, and Ruby on Rails, ASP and ColdFusion etc.
Jigsaw Server: Jigsaw (W3C's Server) comes from the World Wide Web Consortium. It is
open source and free and can run on various platforms like Linux, UNIX, Windows,
and Mac OS X Free BSD etc. Jigsaw has been written in Java and can run CGI scripts and
PHP programs.
Webmin : Webmin is a powerful web-based interface designed to manage Unix-like systems, such as Linux,
FreeBSD, Solaris, and so forth. It eliminates the need for system administrators to physically alter configuration
files in order to configure and administer a server.
Features:
• User and Group Management: Add, remove, and modify users and groups.
• Service Management: Manage services like Apache, MySQL, SSH, FTP, and more.
• Network Configuration: Configure networking, DNS settings, routing, and more.
• Package Management: Install, remove, and update software packages.
• Disk and Filesystem Management: Partition management, mount points, and filesystem checks.
• Security: SSL management, firewall configuration, and user permissions.
• Automation: Webmin offers scheduling and cron job configuration.
• Modular Design: Webmin is modular, meaning additional features can be added through modules.
Usermin
Purpose: Usermin is more user-focused and is designed to give regular users control over personal account
settings. It does not provide administrative functionality but focuses on tasks a non-admin user would need,
such as:
Managing emails (reading, sending, filtering)
Changing passwords
Managing files and file permissions
Viewing logs related to their own account
Configuring their own SSH keys
Setting up cron jobs for personal tasks
Key Differences
Audience:
Webmin: For system administrators managing the entire server.
Usermin: For individual users managing their personal settings.
Scope:
Webmin: Full system administration and server management.
Usermin: Limited to user-specific tasks like email,password management, etc.
• TELNET:
• TELNET stands for Teletype Network. It is a client/server application protocol that provides access to virtual
terminals of remote systems on local area networks or the Internet. The local computer uses a telnet client
program and the remote computers use a telnet server program.
• TELNET is a type of protocol that enables one computer to connect to the local computer. It is used as a
standard TCP/IP protocol for virtual terminal service which is provided by ISO. The computer which starts
the connection is known as the local computer. The computer which is being connected to i.e. which accepts
the connection known as the remote computer. During telnet operation, whatever is being performed on the
remote computer will be displayed by the local computer. Telnet operates on a client/server principle.
• SSH:
• The SSH (Secure Shell) is an access credential that is used in the SSH Protocol. In other words, it is a
cryptographic network protocol that is used for transferring encrypted data over the network. The port
number of SSH is [Link] Shell or SSH, is a protocol that allows you to connect securely to another
computer over an unsecured network. It developed in 1995. SSH was designed to replace older methods like
Telnet, which transmitted data in plain text.
• Features of SSH
• Encryption: Encrypted data is exchanged between the server and client, which ensures confidentiality
and prevents unauthorized attacks on the system.
• Authentication: For authentication, SSH uses public and private key pairs which provide more security
than traditional password authentication.
• Data Integrity: SSH provides Data Integrity of the message exchanged during the communication.
• Tunneling: Through SSH we can create secure tunnels for forwarding network connections over
encrypted channels.
• Telnet vs SSH
Feature Telnet SSH
Full Form Teletype Network Secure Shell
No encryption; data is transmitted in plain
Security Encrypted; provides secure data transmission
text
Uses public key cryptography or encrypted
Authentication Username and password sent in plain text
passwords
Encryption None Strong encryption (e.g., RSA, AES)
Port Number Default port 23 Default port 22
Secure remote management of network
Usage Legacy and less secure remote management
devices/servers
A protocol that allows users to access files over a network as if A file system where files are stored across multiple servers and
Definition
they were on a local drive. locations, appearing as one unified system.
Centralized: usually involves a single server providing files to Decentralized: typically involves multiple servers storing and
Architecture
multiple clients. managing files collaboratively.
Highly scalable, as more servers can be added to handle larger
Scalability Limited scalability due to reliance on a single server.
datasets and traffic.
Fault Tolerance Limited fault tolerance; server failure affects file access for clients. High fault tolerance, as files are replicated across multiple nodes.
Can be slower due to the single-server bottleneck, especially under Generally faster, as load is distributed across multiple servers,
Performance
high loads. reducing bottlenecks.
Data replication is typically not inherent; relies on external Built-in data replication, where files are often copied across
Data Replication
backups. multiple nodes for redundancy.
Maintains strong consistency; changes on the server are Consistency can vary (e.g., eventual consistency), depending on
Data Consistency
immediately visible to clients. the DFS design.
Suitable for small to medium-sized networks, such as local Ideal for large-scale applications, like cloud storage, big data
Use Cases
networks and enterprise file sharing. processing, and content delivery networks.
• Cloud computing uses the internet as a bridge for digital services. It allows computers to send and receive
data to run processes without relying on the local computer. Cloud computing offers faster innovation ,
flexible resources, and economies of scale. It’s also easier to maintain cloud computing applications because
they don’t need to be installed on each user’s computer
Software-as-a-Service (SaaS):
• Software-as-a-Service (SaaS) is a way of delivering services and applications over the Internet. Instead of
installing and maintaining software, we simply access it via the Internet, SaaS provides a complete software
solution that you purchase on a pay-as-you-go basis from a cloud service provider. Most SaaS applications
can be run directly from a web browser without any downloads or installations required. The SaaS
applications are sometimes called Web-based software, on-demand software, or hosted software.
Platform as a Service:
• PaaS is a category of cloud computing that provides a platform and environment to allow developers to build
applications and services over the internet. The consumer does not manage or control the underlying cloud
infrastructure including network, servers, operating systems, or storage, but has control over the deployed
applications and possibly configuration settings for the application-hosting environment.
Infrastructure as a Service:
• Infrastructure as a service (IaaS) is a service model that delivers computer infrastructure on an outsourced
basis to support various operations. Typically IaaS is a service where infrastructure is provided as
outsourcing to enterprises such as networking equipment, devices, database, and web servers.
It is also known as Hardware as a Service (HaaS).