A High-Caliber View of the Bullet Cluster through JWST Strong and Weak Lensin...Sérgio Sacani
Pharma Part 1.pdf #pharmacology #pharmacologyhikmatyt01
Ad
Unix / Linux Operating System introduction.
1. Unix / Linux Operating System
Department of Computer Science (UG)
Operating System and Linux
(21BCA2T343)
Dr.Poongothai P
Assistant Professor
Department of Computer Science (UG)
Kristu Jayanti College (Autonomous)
Bengaluru.
2. The Unix operating system is a set of programs that act
as a link between the computer and the user.
The computer programs that allocate the system
resources and coordinate all the details of the
computer's internals is called the operating system or
the kernel.
Users communicate with the kernel through a program
known as the shell.
The shell is a command line interpreter; it translates
commands entered by the user and converts them into a
language that is understood by the kernel.
3. UNIX is a powerful Operating System initially
developed by Ken Thompson, Dennis Ritchie at AT&T
Bell laboratories in 1970.
In UNIX, the file system is a hierarchical structure of
files and directories where users can store and retrieve
information using the files.
Several people can use a Unix computer at the same
time; hence Unix is called a multiuser system.
Unix Operating system
6. Kernel − The kernel is the heart of the operating system. It
interacts with the hardware and most of the tasks like memory
management, task scheduling and file management.
Shell − The shell is the utility that processes your requests.
When you type in a command at your terminal, the shell
interprets the command and calls the program that you want.
Commands and Utilities − There are various commands and
utilities which you can make use of in your day to day
activities. cp, mv, etc. are few examples of commands and
utilities
Files and Directories − All the data of Unix is organized into
files. All files are then organized into directories. These
directories are further organized into a tree-like structure
called the filesystem.
7. When a computer starts running or reboots to get an
instance, it needs an initial program to run. This initial
program is known as the bootstrap program, and it
must initialize all aspects of the system, such as:
First, initializes the CPU registers, device controllers,
main memory, and then starts the operating system.
The bootstrap program finds the operating system
kernel on disk to do its job and then loads that kernel
into memory.
And last jumps to the initial address to begin the
operating-system execution.
Boot Block
8. The superblock is essentially file system metadata and
defines the file system type, size, status, and
information about other metadata structures (metadata
of metadata).
Superblocks also stores configuration of the file
system.
Some higher level details that is stored in superblock is
mentioned below.
Blocks in the file system, No of free blocks in the file
system, Inodes per block group, Blocks per block
group, Mount time, Write time and File System State
Super block
9. An inode is a data structure in UNIX operating
systems that contains important information
pertaining to files within a file system.
When a file system is created in UNIX, a set
amount of inodes is created, as well.
Whenever a user or a program needs access to a
file, the operating system first searches for the exact
and unique inode (inode number), in a table called
as an inode table.
In fact the program or the user who needs access to
a file, reaches the file with the help of the inode
number found from the inode table.
Inode table
10. An inode can directly or indirectly reference
three kinds of data blocks.
All referenced blocks must be of the same
kind.
The three types of data blocks are:
Plain data blocks
Symbolic-link data blocks
Directory data blocks
Data block
11. Plain data blocks contain the information stored in a
file.
Symbolic-link data blocks contain the path name
stored in a symbolic link.
Directory data blocks contain directory
entries. fsck can check the validity only of directory
data blocks.
(The fsck command checks the general connectivity
of the file system)
12. All Unix disk files are stored in one directory
tree.
This includes both system files and user files.
The files are grouped in directories, which are
simply collections of files and/or more
directories.
Storing and accessing file
13. File ownership is an important component of Unix that
provides a secure method for storing files. Every file in
Unix has the following attributes −
Owner permissions − The owner's permissions
determine what actions the owner of the file can
perform on the file.
Group permissions − The group's permissions
determine what actions a user, who is a member of the
group that a file belongs to, can perform on the file.
Other (world) permissions − The permissions for
others indicate what action all other users can perform
on the file.
14. The permissions of a file are the first line of defense
in the security of a Unix system.
The basic building blocks of Unix permissions are
the read, write, and execute permissions, which have
been described below −
Read: Grants the capability to read, i.e., view the
contents of the file.
Write: Grants the capability to modify, or remove the
content of the file.
Execute: User with execute permissions can run a file
as a program.
File Access Modes
15. Directory access modes are listed and organized in the
same manner as any other file.
There are a few differences that need to be mentioned
Read: Access to a directory means that the user can read
the contents. The user can look at the filenames inside
the directory.
Write: Access means that the user can add or delete files
from the directory.
Execute: Executing a directory doesn't really make sense,
so think of this as a traverse permission (passthrough).
Directory Access Modes
16. pwd Command
The pwd command is used to display the location of
the current working directory.
Syntax:
pwd
Output:
Directory commands
17. mkdir Command
The mkdir command is used to create a new directory
under any directory.
Syntax: mkdir <directory name>
Output:
18. rmdir Command
The rmdir command is used to delete a directory.
Syntax: rmdir <directory name>
Output:
19. ls Command
The ls command is used to display a list of content of a
directory.
Syntax:
ls
Output:
20. cd Command
The cd command is used to change the current
directory.
Syntax:
cd <directory name>
Output:
21. S.No Command & Description
1 cat filename - Displays a filename
2 cd dirname - Moves you to the identified directory
3 cp file1 file2 - Copies one file/directory to the specified location
4 file filename - Identifies the file type (binary, text, etc)
5 find filename dir - Finds a file/directory
6 head filename - Shows the beginning of a file
7 less filename - Browses through a file from the end or the beginning
8 ls dirname -Shows the contents of the directory specified
9 mkdir dirname - Creates the specified directory
File commands
22. 10 more filename
Browses through a file from the beginning to the end
11 mv file1 file2
Moves the location of, or renames a file/directory
12 pwd
Shows the current directory the user is in
13 rm filename
Removes a file
23. The ‘pipe’ command is used in both UNIX and Linux
operating systems.
Pipes help combine two or more commands and are
used as input/output concepts in a command.
In the Linux operating system, we use more than one
pipe in command so that the output of one command
before a pipe acts as input for the other command after
the pipe.
Syntax
Command 1 | command 2 | command 3 | ……
Pipe and pipeline
24. Suppose we have a file named file1.txt having
the names of the students.
We have used the cat command to fetch the
record of that file.
$ Cat file1.txt
25. The data present in this file is unordered.
So, to sort the data, we need to follow a piece
of code here.
$ Cat file1.txt | sort
26. Now we will use the command to remove all
the words that are duplicated in the file.
$ Cat file2.txt | sort | uniq
27. we will use the below-cited command to save
them.
$ cat file2.txt | sort | uniq > list4.txt
The output will be saved in another file with the
same extension.
in this example, we have declared the range up
to 4.
So the data will be from the first 4 lines of the
file.
Consider the same file file2.txt as we have
taken an example above.
$ Cat file2.txt | head -4
28. Process control commands are the system calls
for creating, managing, and coordinating
processes.
Process control commands in Unix are:
bg - put suspended process into background
fg - bring process into foreground
jobs - list processes
Process control
29. The fork() function is used to create a new process by
duplicating the existing process from which it is
called.
The existing process from which this function is
called becomes the parent process and the newly
created process becomes the child process.
FORK
30. exit-Issuing the exit command at the shell prompt
will cause the shell to exit.
EXAMPLE-1:
To exit from shell:
$ exit
output:
# su ubuntu
EXIT
31. In order to wait for a child process to
terminate, a parent process will just execute
a wait() system call.
Wait for a child process to end
The wait() system call suspends execution of
the current process until one of its children
terminates.
WAIT
32. The exec() system call is used to make the
processes.
When the exec() function is used, the currently
running process is terminated and replaced
with the newly formed process.
In other words, only the new process persists
after calling exec(). The parent process is shut
down.
Exec
33. The functions which change the execution mode of
the program from user mode to kernel mode are
known as system calls.
System calls in Unix are used for file system
control, process control, interprocess
communication etc.
Access to the Unix kernel is only available through
these system calls.
Unix system calls
34. System Call Description
access() This checks if a calling process has access to
the required file
chdir() The chdir command changes the current
directory of the system
chmod() The mode of a file can be changed using this
command
chown() This changes the ownership of a particular
file
kill() This system call sends kill signal to one or
more processes
link() A new file name is linked to an existing file
using link system call.
open() This opens a file for the reading or writing
process
pause() The pause call suspends a file until a
particular signal occurs.
35. stime() This system call sets the correct time.
times() Gets the parent and child process
times
alarm() The alarm system call sets the alarm
clock of a process
fork() A new process is created using this
command
chroot() This changes the root directory of a
file.
exit() The exit system call is used to exit a
process.
36. Library functions typically provide a richer set of
features.
For example, the fread() library function reads a
number of elements of data of specified size from a
file.
While presenting this formatted data to the user,
internally it will call the read() system call to actually
read data from the file.
Library Functions