Unit 3 Cse111 1

Download as pptx, pdf, or txt
Download as pptx, pdf, or txt
You are on page 1of 70

Orientation to Computing-I

L T P :2 0 0

www.lpu.in Lovely Professional University


1
2
LINUX

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.

•Every operating system, from MS-DOS to Windows 95, Windows XP and


Linux, has its own file system.

www.lpu.in Lovely Professional University


15
16
Popular File System

www.lpu.in Lovely Professional University


17
FAT File System
• FAT32
– Full form is file allocation table
– One of the oldest file systems available on the windows machine.
– Introduced on ms-dos 7.1 / windows 95 in 1996
– Developed for floppy disks but later used on hard drive, USB flash
drives, and SSD cards.
– Until windows xp, it was default file system .
– The FAT32 file system cannot store individual files larger than 4 GB
– FAT8, FAT12, and FAT16, FAT32 are its variations.
– Less security, no encryption, less compression.

Structure of FAT32 File


www.lpu.in Lovely Professional University
18
NTFS (New Technology File
System)
• (NTFS) is a process that the Windows NT operating system uses for storing,
organizing, and finding files on a hard disk efficiently.
• NTFS can support volumes as large as 8 petabytes

• 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.

www.lpu.in Lovely Professional University


19
20
GFS File System
– A global file system (GFS),is cluster of files that are shared between a
number of computers and end systems from which data or
services are accessed, stored and fetched. The computer systems may
be physically distant or may be a part of same network.

– GFS is especially useful when the physical location of two or more


computers are located in distant locations and they cannot directly
share a file or group of files.
– A GFS reads and writes to the remote device, similarly to a local file
system, and also permits the computers to organize their I/O to
preserve file system uniformity.

www.lpu.in Lovely Professional University


21
HFS File System

• 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).

www.lpu.in Lovely Professional University


22
APFS(APPLE FILE SYSTEM)
• APFS, short for Apple File System, was introduced with the
launch of macOS 10.13 (High Sierra) in 2017.

• 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.

www.lpu.in Lovely Professional University


24
Concept of Pipes and Redirection
• The pipe is used to combine two or more commands.

• The output of one command acts as input to another


command, and this command’s output may act as input
to the next command, and so on.

• It permits data to be transferred between them


continuously rather than having to pass it through
temporary text files or through the display screen.

• In other words, A pipe is a connection between two
processes, such that the standard output from one
process becomes the standard input of the other
process. 25
• Pipes are unidirectional i.e., data flows from
left to right through the pipeline.
• Linux systems allow the stdout of a command
to be connected to the stdin of another
command. You can make it do so by using the
pipe character ‘|’ above the enter button.
• Example: cat file1.txt|sort|rm
• Cat:open file

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.

For example, cat file1, file2 > file3


Concatenates file 1 and file into file3.

www.lpu.in Lovely Professional University


30
Searching the File System
• Use command- find
– It search for files in a directory hierarchy under Linux and
all other UNIX like operating systems.
– Examples:
• find . - name this folder.txt. ...

• find /home -name *.jpg.

www.lpu.in Lovely Professional University


31
Use of grep

www.lpu.in Lovely Professional University


32
Use of grep contd..

www.lpu.in Lovely Professional University


33
Common Linux Directory Structure and File System Hierarchy
op Level Directories

34
Linux Directory Structure and File System Hierarchy
Dir Description

The directory called "root." It is the


/ starting point for the file system
hierarchy. Note that this is not related
to the root, or superuser, account.

/bin Binaries and other executable


programs.
/etc System configuration files.
/home Home directories.
/opt Optional or third party software.

/tmp Temporary space, typically cleared on


reboot.
/usr User related programs.
/var Variable data, most notably log files.

www.lpu.in Lovely Professional University


35
Process Signals
• A signal is an event generated by the UNIX system in response to some
condition, upon which a process may in turn take some action.
• Signals, to be short, are various notifications sent to a process in order to
notify it of various "important" events
• A signal can be sent by the kernel to a process, by a process to another
process, or a process to itself.
• Signals are one of the ways process communicate among themselves and
with the kernel.
• The list of the most commonly used signals follow:
• SIGTERM: Surprisingly, the default signal sent by kill command.
• Asks the process to terminate voluntarily.
• SIGKILL: unlike SIGTERM, forces the process to terminate.
• Can't be blocked or handled.
• SIGSTOP: suspend the process execution.
www.lpu.in Lovely Professional University
36
Description of Signals

www.lpu.in Lovely Professional University


37
Sending signals to process
Sending Signals Using The Keyboard

• 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

www.lpu.in Lovely Professional University


40
Path variable

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.

www.lpu.in Lovely Professional University


42
Man command
• The man command is built-in manual for using Linux commands.
• Displays the user manual of any command that we can run on the terminal.
» Man< command>
• It provides a detailed view of the command which includes NAME, SYNOPSIS,
DESCRIPTION, OPTIONS, EXIT STATUS, RETURN VALUES, ERRORS, FILES,
VERSIONS, EXAMPLES, AUTHORS.
• Basic Symbol

• option – the search result output.


• section number – the section in which to look for the man page.
• command name – the name of the command which man page you want to
see.
www.lpu.in Lovely Professional University
43
Shell Commands
Comman syntax function
d

list ls used to list files or directories in Linux and other Unix-based operating
systems.

CAT cat >filename For creating file

CAT Cat filename To view the content of file

CAT cat "filename1" "filename2" > Merging the content of file


“filename3"
Touch touch file_name displaying the file creation time

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

Mkdir Mkdir filename To make directory

rmdir Rmdir filename To remove empty directory rm -R for contents diectory

rm Rm filename Remove one file at a time


www.lpu.in Lovely Professional University
44
45
Commands Contd….
Ps
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
Linux 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.

www.lpu.in Lovely Professional University


46
LS Command
• The ls command is used to list files or directories in Linux and other Unix-
based operating systems.
• Use of ls command as below:

www.lpu.in Lovely Professional University


47
CAT command
• To create file
cat > filename

• To view the contents of a file named myfile, enter:


• cat filename
• You can use it to read brief files or to concatenate files together.
• To append file1 onto the end of file2, enter:
• cat file1, file 2 >> file2

www.lpu.in Lovely Professional University


48
CD (Change directory) command

• It changes your current directory location.


• By default, your Unix login session begins in your home directory.
• To switch to a subdirectory (of the current directory) named myfiles, enter:
• cd myfiles
• For example, you regularly work with multiple directories within the
Documents directory, which is in the home directory. I would like to be
able to cd to folders in the Documents directory without having to type cd
Documents first (or providing the full file path).
• CD Folder name/
• Output: CD/ documents
• Documents $ CD subfolder name
• Output: Documents/documents/ project.

www.lpu.in Lovely Professional University


49
Touch command

The touch command's primary function is to modify a timestamp.


• displaying the file creation time: ls-l
• modifying time: touch filename.txt

www.lpu.in Lovely Professional University


50
cp
• This command copies a file, preserving the original and creating an
identical copy.
– Cp file1.txt file2.txt dir1
mv
mv stands for move.
mv is used to move one or more files or directories from one place to
another in a file system like UNIX.
Use it as:
mv [filename] source destination
mv f1 f2
chmod
• This command changes the permission information associated with a
file.
www.lpu.in Lovely Professional University
51
Mkdir
• The mkdir command is used to create (or make) a directory.
• Example:
• # mkdir LPUCSE

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

www.lpu.in Lovely Professional University


52
Rm
Use the rm command to remove files you no longer need.
Example
Removing one file at a time
$ rm CSEA.txt

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.

www.lpu.in Lovely Professional University


55
56
More about Linux Kernel

www.lpu.in Lovely Professional University


57
Basic types of kernels

www.lpu.in Lovely Professional University


58
Basic types of kernels
• 3 basic types of kernels as below:

• Monolithic
• Microkernel
• Hybrid

• A monolithic kernel is a type of kernel in which the complete OS runs in


the kernel space.
• A microkernel is a kernel type that implements an operating system by
providing methods, including low-level address space management, IPC,
and thread management.
• A hybrid kernel is an operating system kernel architecture that attempts to
combine aspects and benefits of microkernel and monolithic kernel
architectures used in computer operating systems.

www.lpu.in Lovely Professional University


59
Virtualization

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

You might also like