Unit 3 Cse111 1
Unit 3 Cse111 1
Unit 3 Cse111 1
L T P :2 0 0
3
4
5
6
7
8
9
10
11
12
13
What is file system
14
Understanding File System
•File system is a structure used to organize data and programs on computer
storage devices.
•It keeps track of the physical locations of all data elements on disk and
allows users to quickly and reliably retrieve files when needed.
• NTFS was first introduced in 1993, as apart of the Windows NT 3.1 release.
• The benefits of NTFS are that, compared to other similar file systems
– Performance: NTFS allows file compression so your organization can
enjoy increased storage space on a disk.
– Security access control: NTFS will enable you to place permissions
on files and folders so you can restrict access to mission-critical data.
– Reliability: NTFS focuses on the consistency of the file system so that
in the event of a disaster (such as a power loss or system failure), you
can quickly restore your data.
• HFS is known as Hierarchical File System is the file system used for
organizing files on a Macintosh hard disk.
• A file with the HFS file extension is an HFS disk image file.
• Used to store the files on floppy disks, CD-ROM discs, and hard drives of
older Apple Macintosh computers.
• HFS was not originally designed to handle large hard disks, such as the
100GB+ hard disks that are common today, Apple introduced a updated
file system called HFS+, or HFS Extended, 8 exabyte ( one Exabyte (EB) is
equal to 1,000 Petabytes).
• Features of APFS:
APFS has a 64-bit architecture that can handle more files and
data than HFS+, and enables faster operations such as
copying, moving, and deleting files,
HFS+ only allows file or folder encryption while APFS
supports full disk encryption.
23
Btrfs (Better file system)
• Btrfs — "better file system" — is a newer, Linux file system.
• It is a copy-on-write (CoW) filesystem.
• It supports snapshot(make a backup of complete data)
• RAID fearures are in-built supported by btrfs.
• It supports self healing(data lose oh hdd due to demagnetisated, it can
repair data)
• Btrfs is a modern copy-on-write file system for Linux with advanced
features for fault tolerance, repair and easy administration.
• Btrfs uses copy-on-write for all files, which means if a file is
modified/written to the storage, the file is not replaced but a copy of the
file is created.
• Btrfs also supports data compression, reducing the file size so you can
store more data in less space.
26
Pipes
• It reads data from the file and gives their
content as output.
27
Redirection
• Standard Input and Output
– All applications have three unique file descriptors
that connect them to the outside world. These
are referred to as Standard Input, or stdin;
Standard Output, or stdout; and Standard Error,
or stderr.
28
• Standard input is the default mechanism for
getting input into an interactive program. This
is typically a direct link to the keyboard.
• Standard output is the default mechanism for
writing output from a program. This is
typically a link to the output terminal .
• Standard error is an alternative mechanism
for writing output from a program. This
is typically a different link to the same
output terminal .
29
Concept of Redirection
Redirection is for files (you redirect streams to/from files).
One common need when we run applications is to direct the output
into a file instead of the terminal. A redirect sends a channel of
output to a file.
For example: suppose we want to run a command called “date” if we run it will
print the output to the current terminal screen. But our requirement is different, we
don't want the output to be displayed on the terminal. We want the output to be saved
in a file. This could be done very easily with output redirection.
This is typically done with the > operator between the application to
run and the file to write the output into.
34
Linux Directory Structure and File System Hierarchy
Dir Description
• Ctrl-C Pressing this key causes the system to send an INT signal
(SIGINT) to the running process. By default, this signal causes the
process to immediately terminate.
• Ctrl-Z Pressing this key causes the system to send a signal (SIGTSTP) to
the running process. By default, this signal causes the process to suspend
execution.
38
Methods of sending signal
39
Sending Signals From The Command Line
– Kill command
– The kill command accepts two parameters: a signal name (or number),
kill -<signal> <PID>
– kill -INT 5342
– Kill-l is used to list available signals in table format.
The killall sends a signal to all processes running any of the specified commands.
If no signal name is specified, SIGTERM is sent. It kills processes by names.
– Examples:
• killall {Process-Name-Here}
• killall -9 {Process-Name-Here} SIGKILL
• killall -15 {Process-Name-Here}SIGTERM
• kill the process using a PID (Process ID)
– # kill 3486
PID can be searched using pgrep command
41
Path Variable
• It displays or set a search path for executable files at the command line.
• Syntax PATH pathname [;pathname] [;pathname] [;pathname]... PATH
PATH ; Key pathname : drive letter and/or folder ; : the command 'PATH ;'
will clear the path PATH without parameters will display the current path.
• The %PATH% environment variable contains a list of folders.
list ls used to list files or directories in Linux and other Unix-based operating
systems.
CP Cp file1.txt file2.txt copies a file, preserving the original and creating an identical copy.
mv mv [filename] source destination mv is used to move one or more files or directories from one place to
another in a file system
kill
kill command in Linux (located in /bin/kill), is a built-in command which is
used to terminate processes manually.
Chmod
This command changes the permission information associated with a file.
Pwd
Simply type pwd into your terminal, and the command will output the absolute path of
your print working directory.
rmdir
• The rmdir directory is used to remove directories, but only those that are
empty (i.e., contain no files or subdirectories). In order to delete a directory
with actual contents, you must use the rm -R command.
• Example
• To remove an empty directory:
• # rmdir /mike
Pwd
Simply type pwd into your terminal, and the command will output the
absolute path of your print working directory.
The pwd command writes to standard output the full path name of your
current directory (from the root directory). All directories are separated by
a / (slash). The root directory is represented by the first /, and the last
directory named is your current directory.
The ps command, short for Process Status, is a command line utility that is
used to display or view information related to the processes running in a
www.lpu.in
Linux system. Lovely Professional University
53
54
Kernel functions
• Functions of a Kernel
A Kernel in an operating system performs the following functions:
• Device Management: Processes require various peripheral devices such as
a mouse and keyboard connected to the computer to perform various tasks.
The Kernel manages the allocation of the peripheral devices.
• Resource Management: Kernel shares the resources between different
processes while ensuring that every process has uniform access to the
resources.
• Memory Management: Every process requires some memory to execute.
The Kernel allows the processes to access the memory safely.
• Access Computer Resource: A kernel can access different computer
resources such as RAM, CPU, I/O devices, and other resources. The
Kernel decides which memory each process will use, and the action is
taken if memory is unavailable.
• Monolithic
• Microkernel
• Hybrid
60
61
62
63
Virtual Machine abstracts the hardware of our personal
computer such as CPU, disk drives, memory, NIC (Network
Interface Card) etc, into many different execution
environments as per our requirements, hence giving us a feel
that each execution environment is a single computer. For
example, VirtualBox.
Virtualization is the use of software to allow a piece of
hardware to run multiple operating system images at the
same time.
64
HYPERVISOR
• A hypervisor is a technology
that allow multiple
computers on a physical host
computer.
• Popular hypervisor is virtual
box from oracle. it is open
source and work on all os.
65
66
67
68
69
70