Linux OS

Transkript

Linux OS
Linux
YRD. DOÇ. DR. C. HARMANŞAH
Linux OS
Unix History
1960 yılların sonlarında AT&T Bell Laboratuvarları' nda kullanılmaya
başlamış multi user ve multi-tasking bir işletim sistemidir. Dennis
Ritchie, Ken Thompson and Brian Kernighan tarafından (C
programlama dili ile) geliştirilmiştir. UNIX işletim sisteminin
gelişimi bilgisayar yazılım dünyası açısından oldukça önemlidir.
Berkeley' deki (University of California, ) öğrenciler UNIX işletim
sistemine eklentiler geliştirilerek Berkeley Software Distribution
(BSD) adı ile dağıtım yapmışlardır. Bu dağıtımın hızlı gelişimi AT&T
UNIX sürümündeki mevcut birçok sınırlamanın kalmasını sağlamıştır.
BSD 4.2 dağıtımı ile birlikte AT&T UNIX' te olmayan network
bağlantı desteği işletim sistemine eklenmiştir.
XENIX, SunOS ve AIX
Xenix Microsoft firmasının geliştirdiği Unix tipi bir işletim sistemidir.
Başka bir deyişle Microsoft’ un Unix’ i olarak adlandırılabilir. AT&T
ve Microsoft XENIX ve UNIX sistemini bir araya getirerek System
V/386 OS olarak sunmuşlardır.
Sun Microsystem UNIX marketine SunOS adı bir işletim sistemini ve
bunların çalıştığı workstation’ larını sunmuştur. IBM firması
tarafından UNIX dünyasına katılan diğer bir işletim sistemi ise AIX
(Advanced Interactive Executive) dir.
Linux History
Linux OS
Linux tarihçesi Unix İşletim Sisteminin gelişimi ile ilişkilidir.
Tannebaum tarafından geliştirilen Minix işletim sisteminin PC
platformlarında uygulanması bu kapsamda yeni yaklaşımların ortaya
çıkmasına neden olmuştur.
1
Linus Trovaldis (Finli bir öğrenci) tarafından tasarlanan bu işletim
sistemi Unix tabanlıdır. Trovaldis, Minix kullanıcıları için Unix’ in
daha güçlü ve esnek bir uygulaması olacak bir işletim sistemi
geliştirmeyi hedefleyerek yaptığı çalışmalardan doğmuştur. Daha
sonra bu işletim sistemi Intel i386 uyumlu PC makinelerde çalışacak
geliştirilmiştir. Trovaldis oluşturduğu ilk taslak çalışmaları için 1991
yılında çeşitli haber grupları ile paylaşarak işletim sistemin
geliştirilmesi destek istemiştir. Çalışma gruplarının destekleri üzerine
bu projeye LINUX adı verilmiştir. LINUX projesinin başarısının en
büyük nedenlerinden birisi Özgür Yazılım Vakfı (Free Software
Foundation - FSF) tarafından desteklenen GNU projesi olmasıdır.
GNU projesi kapsamında birçok geliştirme ve uygulama yazılımı açık
kaynak kodu ile birlikte özgürce dağıtılmaktadır. Bu bağlamda,
LINUX işletim sisteminin yalnızca çekirdeğini oluşturmaktadır.
Sistemin tüm diğer bileşenleri GNU vb. kaynaklardan sağlanan özgür
yazılım ürünlerinden oluşmaktadır.
LINUX 
gerçek çok görevlilik
sanal bellek kullanımı
TCP/IP ve ağ desteği
bellek yönetimi
gibi yüksek performanslı özellikler sağlamaktadır. Kaynak kodunun
açık olması ve yazılımın özgürce dağıtılması bu işletim sisteminin
yaygınlaşması ve güvenirliğini artırmaktadır.
Linux, i386 işlemcili PC ler için geliştirilmiş kısıtlı sürücü desteği
olan ilk versiyonu Mayıs 1991 yılında kullanılmaya başlamıştır.
Linux 1.0 (Mart 1994)

TCP/IP desteği

Device – driver support for network ( IP )

Enhanced file system

Support for a range of SCSI controllers

Extra hardware support
Linux OS
Linux 1.2 (Mart 1995) was the final PC only Linux kernel
2
Linux 2.0 (Haziran 1996)

Support for multiple architectures, including a fully 64-bit native
Alpha port

Support for multşprocessor architecture

memory management code

improved TCP/IP performance

Standartized configuration interface
 support for Motorola processors, Sun sparc systems and
PowerMac

2.4 and 2.6 increased SMP support, added journailng file system

preemptive kernel, 64-bit memory support
Günümüzde Linux

BSD operating system

MIT X Window System

FSF
gibi gruplar tarafından geliştirilmiş birçok yazılım araçlarını ve
bileşenleri kullanmaktadır. Gelişim sürecinde temel Linux sistemi,
kurulum, yönetim destek bileşenleri ve ortak UNIX araçlarının
eklendiği standart olarak derlenmiş paketler (Distributions)
üretilmiştir. Çeşitli gruplar tarafından desteklene bu dağıtımlar
günümüzde büyük bir Linux ailesinin oluşmasını sağlamıştır. Linux
kernel GNU General Public Licence (GPL) altında dağıtılmaktadır.
Linux Dağıtımları
Debian GNU/Linux (http://www.debian.org)
Fedora (http://www.fedoraproject.org)
OpenSusE (http://www.opensuse.org)
Linux OS
Red Hat Enterprise Linux (RHEL) (http://www.redhat.com)
3
Ubuntu Linux (http://www.ubuntulinux.org)
Linux İşletim Sistemi
Fig. 1 (Kaynak: Operating System Concepts, Silberschatz, Galvin and
Gagne 2009)
Fig. 2
Kernel
İşletim sisteminin donanım ve diğer yapılardan soyutlanmasını
sağlayan en önemli bileşenidir.
Kernel Mode
System Libraries
 Kernel ile etkileşimli uygulamaların kullanacağı standart fonksiyon
setlerini tanımlamaktadır.
Linux OS
 Kernel kodlar bu mode ile yürütülmektedir. Böylece bilgisayarın
tüm fiziksel kaynaklarına tam yetkili olarak erişim sağlanmaktadır.
4
Kernel module
 Linux sisteminin standart olarak yerleşik cihaz sürücüleri ile
çalışabilmesini sağlayacaktır.
Three components to Linux module support:

module management
Supports loading modules into memory and letting them
talk to the rest of the kernel
Module loading is split into two separate sections:
Managing sections of module code in kernel memory
Handling symbols that modules are allowed to reference

driver registration
Allows modules to tell the rest of the kernel that a new driver
has become available
The kernel maintains dynamic tables of all known drivers, and
provides a set of routines to allow drivers to be added to or
removed from these tables at any time
Registration tables include the following items:
 Device drivers
 File systems
 Network protocols
 Binary format

conflict resolution
Linux OS
A mechanism that allows different device drivers to reserve
hardware resources and to protect those resources from
accidental use by
another driver.
5
The conflict resolution module aims to:
 Prevent modules from clashing over access to hardware
resources
 Prevent autoprobes from interfering with existing device
drivers
 Resolve conflicts with multiple drivers trying to access the
same
hardware
Disk Partitions
In the early versions of UNIX, the disk was configured as a single
partition with a single file system. As disks grew in size it became
advantageous in operating system design to partition them into
multiple logical devices that were actually distinct physical portions of
the same disk.
Partitioning a disk allowed for
 more control of security diffrent user groups could be placed into
different partitions, and different mounting options could be used on
separate partitions, so that some might be read only, and others might
have different security options
 more efficient use of the disk different partitions could use different
block sizes and file size limits
 more efficient operation shorter seek distances would improve disk
access times
 improved back-up procedures backups could be done on partitions,
not disks, thereby making it
possible to back-up different le
systems at different intervals
 improved reliability damage could be restricted to a single partition
rather han the entire disk, and redundancy could be built in
Partitions in Linux are somewhat different from partitions in
Microsoft Windows. There are no C: D: or E: drives in Linux. You
can assign a specific directory to a Linux partition. In contrast, the
only real “Linux drives” are physical hard drives. In Linux, directories
are directly installed (or “mounted”) on partitions.
Linux OS
Drives, Partitions, and Volumes
6
Partitions
After the CMOS identifies a hard drive, your computer looks for the
Master Boot Record (MBR) on that drive. The MBR identifies the
partitions on your drive, including the “active partition” that contains
the boot files for your operating system.
Linux allows for three different types of partitions:
Primary partition
You can create up to four different primary partitions on a hard drive.
The primary partition that you set as active can include a boot loader
such as Partition Magic, System Commander, the Windows NT/ 2000
boot loader, or the Linux Loader (LILO).
Extended partition
If you need more partitions, one primary partition can be converted
into an extended partition. The extended partition then can be further
subdivided into logical partitions.
Linux OS
Logical partition
An extended partition can be subdivided into as many logical
partitions as you need. In the Microsoft world, these are known as
logical drives.
Volumes
A volume is a fixed amount of space on one or more hard drives. It
can include one or more partitions. When you mount a Linux
directory, you can assign it to a specific partition or set it up in a
volume that takes in more than one partition.
7
There are a number of different examples of a volume. If you mount
the Linux root directory on a primary partition, that is a volume. If
you then mount your home directory on a logical partition, that is a
separate volume. Any swap space that you set up on a partition is also
a volume. Volumes can be contained in one or more partitions even if
this requires two or more separate hard drives. Thus, if you have a
large Linux directory that takes up more space than any individual
hard drive, you can still mount it on a volume.
Hard Disk Names
You are now ready to examine the Linux names for different
partitions. The rules in this section also apply to CD drives that are
attached to the same ATAPI and SCSI interfaces.
The naming convention is fairly straightforward. The first two letters
of the name depend on the drive attachment interface. For example, if
you have a drive attached to an ATAPI interface, the letters are hd
(short for hard drive).
If you have a drive attached to a SCSI interface, the letters are sd
(short for SCSI drive). The third letter depends on the relative position
of the drive. If the drive is attached at the master on the ATAPI
primary controller, that letter is a. A drive attached as the slave on the
primary controller is b. Similar criteria govern drives on the ATAPI
secondary controller (c and d), as well as drives attached to SCSI
interfaces.
Typical partition names.
Name
Description
hda2
The second primary partition of a master hard disk on the
primary ATAPI controller.
sdc5
The first logical partition on the third SCSI hard disk.
hdd7
The third logical partition on the slave hard disk on
the secondary ATAPI controller.
sda3
The third primary partition on the first SCSI hard disk.
hdc
Since there is no number, this name refers to a CD drive
attached as the master on the secondary ATAPI controller.
sdb
Since there is no number, this name refers to a CD
drive attached to the second position on a SCSI interface.
Linux OS
If the drive is a hard drive, there is a fourth character. The four
primary partitions are designated as numbers 1, 2, 3, and 4. If you use
an extended partition, it is a substitute for a primary partition and is
designated as number The first logical partition is designated as
number 5, even if you use only one primary partition.
8
Device Management
Devices are represented by files in the /dev directory
Device files are the way the kernel provides access to devices for
applications and services.
The /dev directory is populated by a kernel service. When a device is
detected, a representation of that device (a device file) is created in the
/dev directory
Types of Device Files
Character devices
Talks to devices in a character by character (1 byte at a time) way
Examples: mouse, keyboard, terminal, serial modem, etc.
Block devices
This category covers hard disks, tape drives, CD and DVD drives, and
even floppy drives.
Disk Device and Partition Naming
All types of hard disks (ATA, Serial ATA, SCSI) are represented by
device files whose names start with "sd" (SCSI disk), as all these
different types of drives are accessed as if they were SCSI drives.
Linux OS
On older systems, IDE disk files starts with "hd"
9
Fig. 3
Only 4 physical partitions allowed on a single disk.
Extended and logical partitions
One of the four available physical partitions is marked as an extended
partition, which then functions as a container for up to 15 additional
logical partitions.
UNIX FILE SYSTEM
Each file system in UNIX has at least one table that identifies the files
in it. The entries in this table are called i-nodes (pronounced “eyenodes”), and the indices of the i-nodes in this i-node table are called inumbers. The i-nodes contain the file attributes and a map indicating
where the blocks of the le are located on the disk. Attributes include
properties such as
Linux OS
Every file system has (at least) one superblock located at the
beginning of its allocated storage. The superblock contains all of the
information about how the file system is configured, such as block
size, block address range, and mount status. Copies of the superblock
are almost always stored in several other places within a partition.
10
The superblock actually contains
the block size
a pointer to the i-node table
free i-node list,
pointer to a structure specifying the type of file system,
a device identier for the block device, a structure with the allowed
operations, the mount status, and other information as well.
Originally there was a single superblock. In later versions of UNIX, a
copy of the superblock was placed in every cylinder group in case of a
disk crash.










the owner
the group,
the permissions allowed on the file and the file type,
the number of links to the file
the time of last modification,
the time of last access,
the time the attributes were last changed,
the size in bytes of the file,
the number of blocks used by the file, and
the id of the device on which the file resides.
I-nodes and the tables that use them are important components of the
UNIX file system. Modern file systems usually have multiple i-node
tables.
Linux OS
Every file system separates the i-node tables from the data blocks. The
data blocks are where file contents are stored.
11
Figure 4 depicts the structure and layout of a modern UNIX disk
device with several file systems on it. As disks grew in size, files
whose blocks were on the outer edge of the disk became further away
from the i-nodes that contained the block addresses and file status.
By making several smaller tables, each in its own cylinder group, no
file became too far away from the i-node table. The figure 4 shows
that the i-node in position 2 of the table usually points to the entry for
the root directory file in the file system.
Fig. 4
The different UNIX-like operating systems provide different file
systems, each of which may be implemented in its own way. The
implementation of the file system is not part of any UNIX standard:
there is no single implementation prescribed or proscribed in any
standards document.
A directory in UNIX is a file that consists of a list of directory entries,
each of which contains the name of a file and its i-number, which
serves as a pointer to the file’ s i-node.
Linux OS
The legacy UNIX file system is not used in many modern systems;
modern implementations are more complex because they incorporate
many enhancements to the original design. One reason for this is the
fact that modern machines must be able to mount file systems of
different types. For example, many UNIX systems allow users to
mount FAT2 and NTFS disk-based file systems, which do not follow
the UNIX model.
12
In a FAT system (persisting since early Windows operating systems),
directories do not have this structure. UNIX kernels, if they are
designed to mount such systems, must create a kernel object in
memory to simulate the UNIX directory.
Still more importantly, the UNIX kernel cannot hard-code system
calls such as read() because the implementation of read() will depend
on the file system. As a result, the actual machine code that is
executed when these calls are invoked cannot be bound to the function
name when the kernel is compiled.
UNIX/Linux sistemlerinde bir dosyanın parçası olabilecek en küçük
ayrılmış birim blok olarak adlandırılır. Blok kavramı FAT tipi dosya
sistemlerindeki cluster kavramıyla aynı anlama gelmektedir.
DOS ve Win32 için
FAT ve VFAT sistemlerinde bir cluster'ın kaç sektörden oluştuğu boot
sektör içerisindeki BPB alanında yer almaktadır. Bir bloğun ne kadar
sektör olduğu UNIX sistemlerinde sistemin kurulumu ya da dosya
sisteminin oluşturulması sırasında belirlenebilmektedir.
Bazı
sistemlerde bu belirleme yapılmaz.
UNIX sistemlerinde 1 blok = 2 sektör = 1024 byte'tır.
UNIX/Linux sistemlerinde de bütün disk sıfırdan başlayarak bloklara
ayrılmaktadır. Ayrıca, her bloğun bir numarası bulunmaktadır.
Modern UNIX file systems are virtual file systems, designed to handle
many different types of underlying physical file systems.
Linux OS
In fact, in Sun's variants of UNIX, from SunOS through Solaris, and
in BSD (and FreeBSD), the concepts of i-node and inumber have been
replaced by those of v-node and v-number, with the "v" standing for
"virtual".
13
The original Linux Virtual File System was developed by Chris
Provenzano, and later rewritten by Linus Torvalds. The Linux Ext2
file system was developed in the mid 1990's by Rémy Card, Theodore
Ts'o, and Stephen Tweedie.
The next Linux file system was Ext3, which was developed by
Stephen Tweedie and which differs from Ext2 only in that it contains
journaling.
Journaling is a way to maintain file system consistency in the event of
hardware failures. A special journal file is used to record all of the
actions that are supposed to be taken on the file system, such as
creating and deleting files, changing their contents or attributes, and so
on. In a journaling file system, this record can be used to recover the
state of the file system without the lengthy task of examining every
block and i-node. Ext2 and Ext3 are interchangeable one can be
converted to the other while the file system is mounted because the
difference is the journaling.
The Fourth Extended File System, Ext4, was released in 2008, mostly
to improve performance. While Linux supports many types of file
systems, the Ext2, Ext3, and Ext4 file systems are native to it and
found on almost all Although there are many different UNIX file
systems, most current implementations are built upon ideas from
Dennis Ritchie's original implementation.
Defining and Creating File Systems
Partitioning a disk divides the disk into logically distinct regions,
often named with letters from the beginning of the alphabet, i.e., a, b,
c, and so on. In UNIX, partitions are not necessarily disjoint.
Linux OS
If a disk has a 100 GB storage capacity, you might make the first 1
GB partition a, the next 10 GB, b, the next 50GB d, the remainder, e,
and the whole disk, c.
14
Linux OS
In order to create files in a partition, a file system must be created in
that partition. Creating a file system includes doing the following:
15
 Dividing the partition into equal size logical blocks, typically
anywhere from 1024 to 4096 bytes each, depending upon expected
file size.
The block size is fixed at file system creation time; it cannot be
changed after that without rebuilding the file system.
Larger blocks are appropriate for file systems expecting large files. In
the file systems on my personal Linux host, the root file system uses
1024-byte blocks and the second partition, used for user data, uses
4096-byte blocks.
 Deciding how many alternate blocks are needed in each cylinder.
(A cylinder is the set of all tracks that are accessible from one position
of the disk head assembly. In other words, a cylinder is the set of
tracks that are vertically aligned one on top of the other.) When a
block becomes bad, it has to be removed from the le system. Alternate
blocks are reserved to replace bad blocks.
Dividing the cylinder group or partition, depending on the system, into
three physical regions:
The superblock
This stores the map of how the disk is used as well as the file system
parameters. In the Linux file system, the superblock contains
information such as the block size in bits and bytes, the identifier of
the physical device on which the superblock resides, various flags
indicating whether it is read-only or locked, or how it is mounted, and
queues of mounts waiting to be performed.
The i-node area
This is where used and free i-nodes are stored. The used and free
inodes were traditionally arranged into two lists, the i-list and the free-
Linux OS
In Linux Ext2, block groups take the place of cylinder groups.
Whereas a cylinder group is a physical concept, tied to the geometry
of the disk, a block group is a logical concept, independent of the disk
geometry, because modern hard disk drives hide the geometry from
the operating system.
16
list, with the start of each list stored in the superblock. That method of
storage management is obsolete.
The data area
This is where the data blocks are stored. Later versions of UNIX used
a more efficient method, in which, when the file system is created, a
fixed number of i-nodes was allocated within each cylinder group.
This puts i-nodes closer to their data blocks, reducing the overall
number of seeks
Şekil Unix File System (Allen, H.)
Linux OS
Filesystem Hierarchy Standard
When you install Linux, you can mount all of the Linux directories on
a single partition. You can also set up just about any Linux directory
as a volume by mounting it on a separate partition.
Includes the commands and files required for Linux to boot on your
computer, such as LILO and the Linux kernel. If you have a larger
drive (over 8GB), it is generally a good idea to mount /boot on a
separate partition. This helps to ensure that your Linux boot files
remain accessible when you start your computer.
17
Separate partitions limit risks to your system.
Web servers such as Apache can accumulate log files that are
hundreds of megabytes in size. This could easily crowd out all free
space on your hard drive. Your users could no longer save files, there
would be no room for Linux to prepare print jobs, and the result could
be chaos. Alternatively, if you mounted the right directory on a
separate partition, your users could still work and save files even if the
partition with the log files was full.
Before you can select partitions for your Linux system, you first need
to know about the options in Linux directories. Most distributions
divide their files into directories according to the Filesystem
Hierarchy Standard (FHS).
Be sure to know these Linux volumes, especially those that normally
contain commands. Be able to associate a directory with a specific
type of command.
For example, most system administration commands are in the /sbin
directory, and most basic command-line utilities are in the /bin
directory.
UNIX/Linux sistemlerinin dizin yapısı MS-DOS yapısına
benzemektedir. Path sisteminin oluşturulması aynıdır. Ancak
UNIX/Linux sistemlerinde sürücü kavramı yoktur. Bu sistem başka
dosya sistemlerini kullanabilmektedir. Başka dosya sistemleri mount
işleminden
sonra
dizin
ağacında
bir
dizin
biçiminde
yerleştirilmektedir.
Örneğin içerisinde Windows yüklü olan bir makineye ayrıca Linux
kurulursa; Linux içerisinde Windows’taki C, D ve E sürücülerine
erişmek isteyelim. Bu sürücüler Linux dizin ağacının istenilen bir
yerine bir dizin gibi monte edilirler.
Tipik bir UNIX/Linux sistemi kurulduğunda bir dizin ağacı
oluşturulur ve dizinlere uygun programlar yerleştirilir. Tabii bu dizin
ağaçları sistemden sisteme değişebilmektedir ve standart değildir.
Ancak pek çok sistemde benzerlikler bulunmaktadır. Aşağıda tipik bir
dizin yerleşimi görülmektedir.
Linux OS
Sonra biz bu dizinlere geçildiğinde Windows’taki sürücülerin kök
dizinlerine geçilecektir. Başka bir dosya sistemini UNIX/Linux
sistemlerine monte etme işlemlerine mount işlemi denir.
18
Directory
/ root
/bin
/var
directory holds files that tend to change in size
over time. Typically, various system log files
are located below this directory. The /var/spool
directory and its subdirectories are used to hold
data that’s of a transitory nature, such as mail
and news that’s recently received from or
queued for transmission to another site.
/dev
Lists available device drivers. For example, if
you mount a floppy drive, you might mount
/dev/ fd0 onto a directory such as /mnt/ floppy.
Linux OS
/home
19
Fig. 5
Description
All other directories are below the root directory
in the filesystem hierarchy. In other words, they
are “subdirectories.”
Any other directory not mounted on a separate
partition is automatically part of the root
directory volume.
Contains basic command-line utilities. You
should not configure this directory in a separate
partition. If you do, you wouldn’t be able to
access these utilities with a recovery disk.
Includes home directories for all but the root user. If
you mount this directory on a separate partition, leave
enough room for each of your users to add files.
Lists program libraries needed by a number of different applications
as well as the Linux kernel. You should not mount this directory in a
separate partition.
Contains the mount point of removable media, such as floppy (/mnt/
floppy) and CD-ROM (/mnt/ cdrom) drives. It is not used by all Linux
distributions; for example, on S. u. S. E. Linux, floppy and CD-ROM
drives are normally mounted on preconfigured /floppy and /cdrom
directories.
Standard location for applications such as Sun StarOffice, Corel
WordPerfect, or VistaSource Anyware Office.
/proc
Includes all kernel-related processes that are currently
running. Some of the files in this directory list current
resource allocations; for example, /proc/ interrupts
lists currently allocated interrupt request (IRQ) ports.
This directory is is actually a virtual file system. It’s
used to read process information from memory.
The home directory for the root user. The /root directory is a
subdirectory of the root (/) directory. Do not mount this directory
separately.
directory is used to store temporary files that
programs create when running. If you have a program
that creates a lot of large temporary files, you may
want to mount the /tmp directory as a separate file
system rather than just have it as a director y on the
root file system.
If /tmp is left as a directory on the root file system
and has lots of large files written to it, the root file
system can fill up.
Linux OS
/tmp
20
/sbin
Contains many system administration commands. Do
not mount this directory separately. /tmp dedicated
storage location for temporary files. Also a good
place to download files. Some Linux installations are
configured to empty this directory periodically.
/usr
Includes small programs and data available to all
users. Contains many subdirectories.
/var
Contains variable data, including log files and print
spools. On Linux servers, this directory is frequently
mounted on a separate partition.
/usr/bin
This directory holds many of the executable programs
found on your Linux system.
/usr/etc
This directory contains many miscellaneous system
configuration files.
/usr/include
Here and in the subdirectories of /usr/include is
where you find all the include files for the C
compiler. These header files define constants and
functions and are critical for C programming.
Linux OS
/usr/g++-include
C++
21
This directory contains the include files for the
compiler.
/usr/lib
This directory contains various libraries for programs
to use during linking.
/usr/man
This directory contains the various manual pages for
programs on your Linux system. Below /usr/man are
several directories that correspond to the different
sections of the man pages.
/usr/src
This directory contains directories that hold the
source code for different programs on your system. If
you get a package that you want to install,
/usr/src/packagename is a good place to put the
source before you install it.
/usr/local
This directory is designed for local customizations to
your system. In general, much of your local software
is installed in this directory’s subdirectories. The
format of this directory varies on almost every UNIX
system you look at.
One way to set it up is to have
a /usr/local/bin for binaries,
a /usr/local/etc for configuration files,
a /usr/local/lib for libraries
a /usr/local/src for source code.
The entire /usr/local directory tree can be mounted as a separate file
system if you need a lot of room for it.
First, the minimum number of partitions that you need for Linux is
one.
If you set up a primary partition, you can mount the root directory (/)
on it. You do not even need a swap partition; it is possible to set up a
swap file, similar to most Microsoft Windows operating systems. This
is generally not a recommended configuration for Linux, however.
Device File Description
The system console, which is the computer monitor
physically connected to your Linux system.
Linux OS
/dev/console
22
/dev/hd
The device driver interface to IDE hard drives. The
/dev/hda1 device refers to the first partition on hard
drive hda. The device /dev/hda refers to the entire
hard disk hda.
/dev/sd
The device driver interface for SCSI disks. The same
conventions for SCSI disks and partitions apply as
they do to the IDE /dev/hd devices.
/dev/fd
Device drivers that provide support for floppy drives.
/dev/fd0 is the first floppy drive and /dev/fd1 is the
second floppy drive.
/dev/st
The device driver for SCSI tape drives.
/dev/tty
Device drivers that provide dif ferent consoles for
user input. The name comes from when terminals
known as teletypes were physically hooked
Linux OS
Note:
Swap files or swap partitions act as overflow space from your RAM.
If you don’t have enough RAM for the programs you’re using, lessused data is temporarily transferred to this overflow space.
A more typical configuration involves two partitions: one for the root
directory, the other as a swap partition. This is a common
configuration for computers with smaller hard drives.
A common configuration for larger hard drives includes three
partitions. The root (/) and /boot directories, as well as swap, are
mounted on separate partitions. [This is the default setup for several
Linux distributions, including Red Hat Linux 7.1.]
The /boot directory is commonly mounted on its own partition
because many Linux installations cannot start if the files in the /boot
directory are stored above hard drive cylinder 1024.
23
Users
Linux multi-user bir işletim sistemi olduğu için çok sayıda kullanıcı eş
zamanlı olarak çalışabilmektedir.
Standard Users
Kurulum sırasında Standard Users olarak aşağıda tabloda verilen
kullanıcı tipleri oluşturulmaktadır.
User
UID
root
0
bin
1
daemon
2
adm
3
lp
4
mail
8
ftp
14
Standard Groups
GID
Home Directory
Shell
0
1
2
4
7
12
50
/root
/bin
/sbin
/var/adm
/var/spool/lpd
/var/spool/mail
/var/ftp
/bin/bash
Kurulum sırasında Standard Groups olarak aşağıda tabloda verilen
gruplar oluşturulmaktadır.
User
GID
Home Directory
Login Name 
Kullanıcının sistem ile ilişkilerinde kullandığı
giriş adıdır.
Password  Kullanıcının sisteme giriş için kullandığı şifre.
Linux OS
root
0
root
bin
1
root, bin, daemon
daemon
2
root, bin, daemon
sys
3
root, bin, daemon
tty
5
root, bin, daemon
ftp
50
users
100
Bazı Linux dağıtımlarında User Private Group (UPG) yapısı
bulunmaktadır. Bu tür yapılar UNIX içindeki gruplara herhangi bir
şey eklemez ve değişiklik yapmaz. Bir kullanıcı ile birlikte Linux
otomatik olarak şu bileşenleri oluşturur.
24
User ID 
değerler.
Group ID
Kullanıcının
giriş türünü
gösteren
sayısal
Kullanıcının dahil olduğu gruptur.
Home Directory  Kullanıcının sisteme giriş yaptığında çalışmaya
başlayacağı ve kullanıcıya özgü dizin.
Shell
Kullanıcının sisteme giriş yaptığında çalıştırılacak ilk kodlar
(program) ve kullanıcının sistem ile ilişkileri buradan yönetilir. UNIX
de sistem yöneticisi başka bir deyişle root kullanıcısının UID ve GID
değeri 0 dır.
Root
Sistem üzerindeki en yetkili kullanıcıdır ve diğer kullanıcılar için
geçerli olan yetki denetimleri root için sistem tarafından disable
edilmiştir.
Kullanıcı sisteme girişi terminal üzerinden
login:
ekranından username ve password ile yapmaktadır.
Username ve password girişi yapıldıktan sonra
Linux OS
Sistemden çıkışi için logout komutu kullanılmaktadır.
25
Device
UNIX, programlama arabirimini olabildiğince kolaylaştırmak üzere
tüm aygıt erişimlerini bir dosya sistemine benzer yöntemle
gerçekleştirmektedir. Böylece programcı, aygıt ile ilişkilendirilmiş
dosyayı açar ve bu üzerinde okuma ve yazma işlemlerini
gerçekleştirir. İşlemler sırasında programcı eriştiği aygıtın denetim
detaylarını bilmek zorunluluğu yoktur. Aygıt dosyaları /dev dizini
altında yer alır.
Fileand Directory
Üç tip dosya bulunmaktadır. Bunlar; File, Directory ve Special File.
Special File
Bu tip dosyalar dosya sisteminde tutulmamaktadır. Bu dosyalar bir I/O
device temsil etmektedir.
Dosya ve Dizin Erişim Denetimleri
Linux OS
UNIX dosya sistemi yan belleklerde yer alan dosyalara erişimi kontrol
etmektedir. Hangi kullanıcıların hangi dosyalara ve dizinlere nasıl
ulaşabileceğinin kontrolü UNIX dosya sistemi tarafından yapılır. Bu
nedenle dosya sistemi, UNIX üzerinde güvenliği sağlamak için
denetlenmesi gereken en önemli noktalardan birisidir.
26
Bir ls çıktısında, çıktının ilk sütunu dosya ve dizin erişim haklarını
gösterir. Örnek bir ls çıktısı aşağıda verilmiştir:
$ ls -l
-rw-r--r-- 1 bdd staff 20911 Jan 22 01:21 bsd.c
Erişim haklarının ilk karakteri, dosya ya da dizinin tipini belirler. Bu
tip aşağıdakilerden birisi olabilir:
-:
Sıradan dosya
d: Dizin
c: Karakter Aygıtı (character device)
b: blok Aygıtı (block device)
l: Sembolik Bağ (symbolic link)
s: Soket (socket)
p: FIFO
Erişim haklarından sonraki dokuz karakter, üçerli gruplar halinde
sistem üzerinde kimin neyi yapabileceğini belirler.
Üçlü gruplar okuma (read), yazma (write) ve çalıştırma (execute).
Buna paralel olarak üç farklı sınıf vardır;
dosyanın sahibi (owner),
dosyanın sahibi ile aynı kullanıcı grubundakiler (group)
bunların dışındaki tüm kullanıcılar (other)
Örneğin, dosya erişimi
Linux OS
rwxr-xr-- olan bir dosya,
27
owner tarafından okunabilir, yazılabilir ve çalıştırılabilir. (rwx)
Dosyanın sahibi ile aynı kullanıcı grubundakiler dosyayı okuyabilir ve
çalıştırabilir (r-x)
Diğer kullanıcılar bu dosyayı sadece okuyabilecektir (r--).
Dosya ve dizinlere ilişkin erişim haklarını değiştirmek için chmod
komutu kullanılır. Dosyanın erişim haklarını yalnızca owner ya da
root değiştirebilir; diğer kullanıcılar erişim denetim mekanizmasını
herhangi bir biçimde geçersiz kılamaz.
chmod komutunun kullanımına ilişkin bir örnek aşağıda verilmiştir:
$ ls -l bsd.c
-rw-r--r-- 1 bdd staff 20911 Jan 22 01:21 bsd.c
$ chmod go-r bsd.c
-rw------- 1 bdd staff 20911 Jan 22 01:21 bsd.c
chmod komutunda ilk parametre, hangi sınıfa hangi yetkinin
verileceğini belirler.
grup (g) ve diğerlerinden (o) okuma (r) yetkisi geri alınmaktadır (-).
Sonuç olarak, owner tarafından okunabilen ve değiştirilebilen, başka
herhangi bir biçimde herhangi birisi tarafından erişilemeyen bir dosya
olacaktır.
chmod komutu ile bir dizin altında yer alan tüm dosya ve dizinlerin
erişim hakları değiştirilebilir. Bunun için -R parametresi
kullanılmalıdır.
# ls -l bsd.c
Linux OS
Bir dosyanın haklarını (sahipliğini) değiştirmek üzere chown komutu
kullanılmaktadır.
28
-rw-r--r-- 1 bdd staff 20911 Jan 22 01:21 bsd.c
# chown bilprog bsd.c
-rw-r--r-- 1 bilprog staff 20911 Jan 22 01:21 bsd.c
Bir dosyanın bağlı bulunduğu grubu değiştirmek üzere chgrp komutu
kullanılmaktadır.
# ls -l bsd.c
-rw-r--r-- 1 bdd staff 20911 Jan 22 01:21 bsd.c
# chgrp users bsd.c
-rw-r--r-- 1 bdd users 20911 Jan 22 01:21 bsd.c
Parola değişikliği için tüm kullanıcılar tarafından passwd komutu
kullanılmaktadır
/etc/passwd dosyası üzerinde değişiklik yapmak zorunda olduğu için
/etc/passwd  root kontrolündedir.
Tüm kullanıcıların passwd komutunu çalıştırması için kullanıcılara
yetki verilmesi gerekir. Bu gibi durumlar için set user-id (SUID)
isimli erişim hakkından faydalanılır.
$ ls -l /bin/passwd
-r-s--x--x 1 root root 13536 Jul 12 2000 /usr/bin/passwd
Bir komuta veya kullanıcıya SUID hakkı vermek üzere chmod
komutu ile u+s kullanılır.
Linux OS
# chmod u+s /bin/bash
29
-rwsr-xr-x 1 root root 512540 Aug 22 19:46 /bin/bash
Bu komutun çalıştırılmasından sonra sisteme giriş yapan her kullanıcı
root yetkileri ile donatılmış olacaktır. Bu sistem açısından çok büyük
risk taşımaktadır.
SUID ile benzer biçimde, bazı programların çalışmaları süresince belli
bir kullanıcı grubunun üyesi olarak çalışması gerekebilir. Örneğin
yazıcı hizmetleri ile ilgili yazılımlar bu türden haklara ihtiyaç
duyarlar.
Bir programa SGID hakkı vermek üzere chmod komutu ile g+s
parametresi kullanılır.
# chmod g+s /bin/bash
-rwxr-sr-x 1 root root 512540 Aug 22 19:46 /bin/bash
Tüm kullanıcıların yaz-boz alanı olarak kullanabileceği dizin /tmp' dir.
Kullanıcılar tarafından işletilen tüm programlar geçici dosyalarını bu
dizinde yaratır ve işlem bittiğinde silinmektedir. Ancak bu dizine tüm
kullanıcıların okuma ve yazma hakkı ile erişmesi durumunda
kullanıcıların bu dizini silebilecektir.
Kullanıcıların yalnızca kendilerine ait dizinleri ve dosyaları
silebilmesini için /tmp dizini Sticky erişim hakkı ile donatılır:
$ ls -ld /tmp
drwxrwxrwt 11 root root 4096 Jan 29 11:48 /tmp
Bir dizine sticky erişim hakkı vermek üzere chmod u+t parametresi
kullanılır.
UNIX dosya sistemi tek köklü bir ağaç yapısı biçimindedir; MSWindows türevi işletim sistemleri bunun aksine çok köklü ağaç
yapısında dosya sistemlerine sahiptir (c:, d:, e: ayrı birer köktür).
Linux OS
Dizin Yapısı
30
UNIX'te tek bir kök bulunmaktadır ve “ / “sembolü ile gösterilir.
Tüm dosyalar ve dizinler kök dizin referans alınarak işaretlenir.
Tüm ağaç tek bir dosya sistemi üzerinde olabileceği gibi, ağacın bazı
dalları farklı dosya sistemleri üzerinde depolanabilir.
Dizin hiyerarşisi içerisinde yer alan dizinlerden bazıları Linux
dağıtımları için özel anlamlar ifade etmektedir.
Device Files
Linux, programlama arabirimini kolaylaştırmak için tüm cihaz
erişimlerini
dosya
erişim
yöntemine
benzer
şekilde
gerçekleştirmektedir. Bu yaklaşım sayesinde, programcı cihaz ile
ilişkilendirilmiş dosyayı açar ve üzerinde okuma ve yazma işlemlerini
gerçekleştirebilir.
İşlemler sırasında programcı eriştiği cihazın denetim detaylarını
bilmek zorunda değildir.
Cihaz dosyaları /dev dizini altında yer alır. Bu dizin altında yer alan
dosyalar bilinen anlamı ile birer dosya olarak kabul edilmemelidir;
yalnızca erişimlerin cihaza yönlendirilmesini sağlamak üzere bulunan
birer link noktasıdır Aşağıdaki örnekte bir grup aygıta ilişkin ls çıktısı
görülmektedir:
$ ls -l /dev/hda*
brw-rw---- 1 root disk 3, 0 Sep 27 13:31 hda
brw-rw---- 1 root disk 3, 1 Sep 27 13:31 hda1
brw-rw---- 1 root disk 3, 2 Sep 27 13:31 hda2
Linux OS
Device dosyaları blok ve karakter olmak üzere iki gruba ayrılır.
31
Blok device, Input/Output işlemleri için tampon bellek kullanan
birimlere erişim için kullanılır. Bu şekilde çalışan cihazlar
Input/Output yapılan verileri bir blok tamamen doluncaya kadar
tampon bellekte tutar ve daha sonra bu bloğu transfer ederler. Bu
türden cihazlara diskler örnek gösterilebilir.
Karakter device, karakter (harf/sembol) bazında iletişim kurulan
aygıtlar için kullanılırlar. Seri bağlantı noktasından bağlı yazıcılar
veya klavyeler örnek olarak verilebilir.
User and User Groups
Tanımlanan her user için
Kullanıcı (Login Name):
kendisini
Kullanıcının
sistem
ile
ilişkilerinde
tanıtacağı kısa adı
Şifre(Password):
Kullanıcının sisteme giriş sırasında
kullanabileceği ve yalnızca ilgili kullanıcı
tarafından bilinmesi gereken harf-rakamsembol karışımı
Kullanıcı Kimliği (User ID):
Kimlik kartı sıra numarası gibi
düşünülebilecek bir sayı
Ana Grup Kimliği (Group ID): Kullanıcının üyesi olduğu gruplardan
öncelikli olanı
Ev Dizini (Home Directory):
Kullanıcının sisteme giriş yaptığında
çalışmaya başlayacağı, kendisine
özel dizin
Kabuk (Shell):
Kullanıcının
sisteme
girişi
sonrasında çalıştırılacak ilk program;
kullanıcının sistem ile ilişkileri bu
arayüz üzerinden gerçekleştirilir.
Sistemin yetkili kullanıcı root grup id’ si sıfır (0) olarak seçilmiştir.
Sisteme kullanıcı eklemek üzere useradd komutu ile gerçekleştirilir.
# adduser -d /home/bdd bdd
Linux OS
man useradd  komut kullanımı ile ilgili bilgi alabilirsiniz.
32
Kullanıcı ekleme işlemi sırasında, /etc/skel dizini altında yer alan
dosyaların tümü kullanıcının home dizinine kopyalanır. Açtığınız her
kullanıcı hesabı ile birlikte, kullanıcılarınızın home dizininde
düzenlemeleri /etc/skel dizini altında yaparsanız işlemler otomatik
hale gelecektir.
Kullanıcı silmek için userdel kullanılmaktadır.
# userdel coskun (coskun kullanıcısı sistemden silinir, home korunur)
# userdel -r coskun (coskun kullanıcısı sistemden home ile birlikte
silinir)
Silme işleminden ÖNCE, kullanıcıya ait ve kullanıcının home dizini
dışında kalan diğer dosyaların silinmesi için "find ve remove"
işlemleri aşağıdaki komut satırı işletilebilir:
# find -user burak -exec rm {} \
Dosya ve dizin erişim denetimlerini grup bazında gerçekleştirilir.
Aynı dizine ya da dosyaya erişmesi gereken kullanıcı sayısı birden
fazla ise bu kullanıcıların bir "grup oluşturduğu" düşünülür ve bu
kullanıcılar için uygun bir grup tanımının yapılabilir. Dosya ve
dizinlerin grup bazında erişim denetiminin sağlanması kullandığınız
sisteme esneklik getirmektedir.
Ege MYO daki farklı programların birlikte kullandığı bir Linux
sistemi oluşturmak istenilsin. Program hocalarının ve çalışanların
programlarla ilgili dosyalara erişmek isterken aynı dosyalara başka
kimselerin (programda olmayan) erişmesine izin verilmeyecektir.
Linux OS
Grup mekanizması, daha karmaşık yetkilerin ve süreçlerin
gerçekleştirilmesinde önemli bir çözüm aracıdır. Bilgisayar ve
Elektronik
33
Programlarının ortak bir projesi olduğunu ve bu projenin her
programdan sadec iki öğretim elemanı tarafından yürütüldüğünü
düşünelim. Bu durumda ortak projede görevli çalışanların iki grubun
birden üyesi olması gerekmektedir. Projede görevli Elektronik
programı personeli hem “Elektronik” hem de “Ortak Proje”,
Bilgisayar Programı öğretim elemanı hem “Bilgisayar” hem de “Ortak
Proje” gruplarına üye edilecektir.
# groupadd elektronik
Kullanıcı tanımı yapılırken bir kullanıcıyı birden fazla gruba dahil
edilebilir. useradd ile ilgili örnekler arasında bu türden bir örneği
bulabilirsiniz. Bir kullanıcının hangi gruplara dahil edileceğini
sorgulamak için groups komutu kullanılır.
$ groups coskun
users, staff
Sistem üzerinde çalışan kullanıcı, herhangi bir anda yalnızca bir
grubun üyesi olabilir. Sisteme giriş anında, kullanıcının ana grubu
olarak belirlenen grup üyesi olarak çalışmaya başladığı varsayılır.
Kullanıcı, dilediği an newgrp ile aktif grubunu değiştirebilir.
$ newgrp staff
Kullanıcılar, hali hazırda bağlı bulunduğu grubu sorgulamak üzere id
komutunu kullanır; bu komut kullanıcının kimliği ile ilgili bilgileri
görüntüler:
$ id
Linux OS
uid=500(burak) gid=550 groups=500,550
34
UNIX sistemlerinde
kullanıcı tanımlarına ilişkin bilgiler /etc/passwd
grup tanımlarına ilişkin bilgiler ise /etc/group
dosyasında yer alır.
Linux dağıtımlarında /etc/passwd dosyası güvenlik açısından önemli
kısımları /etc/shadow dosyasında saklar.
/etc/passwd dosyasından bir satır aşağıdaki gibidir:
coskun:J2HS4ks$wer9s:500:500:Coskun
HARMANŞAH:/home/coskun:/bin/bash
Bu satırdaki kolonlar
kullanıcı adı
şifrelenmiş biçimde kullanıcı parolasını,
kullanıcı kimliği,
grup kimliğini,
home dizinini
Shell path
# passwd coskun
Linux OS
Shell
35
Shell, işletim sistemlerinde kullanıcı
arasındaki iletişimi sağlamak üzere
Örneğin, MS-DOS temelli işletim
işletim sisteminin shell’ idir. Kullanıcı
komutları çalıştırmaktadır.
ile işletim sistemi çekirdeği
hazırlanmış bir arabirimdir.
sistemlerinde command.com
sistemde bu arayüz üzerinden
Kullanıcı sisteme girişi ile birlikte kullanıcı için atanmış Shell
başlatılır ve kullanıcı sistemde çalıştığı sürece bu kabuk üzerinden
işlem yapmaktadır. Shell istediğiniz programları çalıştıran, komutları
yürüten ve yönlendiren arabirim olarak tanımlanabilir.
Linux altında kullanabileceğiniz çok sayıda ve farklı Shell
bulunmaktadır. Bunlardan en yaygın kullanılanı Bourne Again Shell
(bash),
Sistemdeki her kullanıcının kullandığı shell farklı olabilir bu Linux’ ın
esneklik sağlayan önemli bir özelliğidir.
Birçok Linux dağıtımı ön tanımlı shell olarak bash'i kullanmaktadır.
Bunun dışında Bourne Shell (sh), C Shell (csh) ve Korn Shell (ksh)
gibi farklı shell ler bulunmaktadır.
Bir kullanıcının shell’ i genel amaçlı yazılmış bir shell olabileceği
gibi, Linux üzerinde çalışabilir herhangi bir program da olabilir.
Örneğin kolaylıkla /usr/bin/pico yoluna sahip PINE editörü bir
kullanıcı için shell olarak tanımlayabilirsiniz. Bu durumda kullanıcı
sisteme girdiğinde yalnızca PICO programını kullanabilecektir.
Kullanıcılar diledikleri anda herhangi shell’ başlatabilir ve
çalışmalarını bu Shell üzerinde sürdürebilirler. Örneğin bash
kabuğunu kullanan bir kullanıcının, daha sonra csh geçmesi için
$ /bin/csh
Geçici süre ile csh geçen kullanıcı geri dönmek istediğinde
% exit
Dosya yollarının parçası olarak görünen “ ~ “ simgesi kullanıcı home
dizinlerini simgelemektedir. Bu anlamda coskun kullanıcısının home
dizinine geçmek için
Linux OS
komutunu girmesi yeterlidir.
36
$ cd ~coskun
yeterli olacaktır. Başlatma scripti dosyaları içerisinde bash'in
anlayabileceği biçimde yapılmış tanımlar ve komutlar yer almaktadır.
Örnek bir ~/.bashrc dosyası içeriği aşağıdaki gibidir:
PATH=$PATH:/home/coskun/bin
echo "Selam Coskun!"
alias eweb lynx http://www.ege.edu.tr
İlk satırda PATH çevre değişkeni ile belirlenen yol arama listesine
/home/coskun/bin dizini eklenmektedir. Böylece /home/coskun/bin
dizininde yer alan programlar tam yol verilmeden çalıştırılabilecektir.
İkinci satırda ise echo komutu ile kısa bir karşılama mesajı
görüntülenmektedir.
Üçüncü satırda ise lynx programı ile ege web sitesinin görüntülenmesi
için bir kısa yol verilmektedir; eweb yazıldıktan sonra bağlantı
gerçekleştirilecektir.
Link File
Sistem tarafından depolanan ve işlenen her dosya bir dosya adı ile
ilişkilendirilir. Yeni bir dosya tanımlandığında bu dosya için bir de
isim atanır. Kullanıcılar, bir dosyaya farklı konumlardan daha rahat
erişebilmek için kısayollar tanımlamak ihtiyacı duyabilirler. UNIX
bağlamında kısayol belirtmek içinkullanılan dosyalar link dosyaları
olarak anılırlar.
Linux OS
İki tür link dosyası mevcuttur; hard-link ve soft-link.
37
Hard-link türü link dosyaları sistem üzerinde yalnızca sistem
yöneticisi tarafından yaratılabilirler. Mevcut bir dosyaya bir hard-link
ile ikinci bir isim atandığı andan itibaren dosyaya iki farklı isim ile
erişmek mümkün olacaktır. Bu aşamadan sonra isimlerden birisi ile
gelecek bir dosya silme talebinde sadece dosyaya erişim için
kullanılan iki isimden birisi silinmiş olur, dosyanın saklanması
sürdürülür ancak artık yalnızca bir isim ile erişmek mümkün olacaktır.
Bu durumda dosya yalnızca ve yalnızca kendisi ile ilişkilendirilen tüm
isimleri için birer dosya silme işlemi gerçekleştikten sonra silinmiş ve
hiçbir biçimde ulaşılamaz olacaktır.
UNIX Shell
Kabuk, işletim sistemlerinde kullanıcı ile işletim sistemi çekirdeği
arasındaki iletişimi sağlamak üzere hazırlanmış bir arabirimdir.
Örneğin, MS-DOS temelli işletim sistemlerinde command.com
sistemin kabuğudur; sisteme hemen her türlü komut command.com
programının sağladığı arabirim ile verilir.
UNIX sistemlerinde herhangi bir kullanıcının sisteme girişi ile birlikte
kullanıcı için atanmış shell in işletimi başlatılır ve kullanıcı sistemde
çalıştığı sürece bu kabuk programı vasıtası ile sistem ile haberleşir.
Shell, istediğiniz programları çalıştıran, istemlerini uygun biçimde
yönlendiren bir arabirim olarak ifade edilebilir.
UNIX altında kullanabileceğiniz çok sayıda ve farklı shell olmasına
rağmen
Bourne Again Shell (bash), Linux sistemlerde son derece popülerdir.
Sistemdeki her kullanıcının kullandığı shell farklı olabilmekte ve
kullanabilmektedir. UNIX'in bu özelliği kullanıcılara önemli bir
esneklik sağlamaktadır.
Birçok Linux dağıtımı ön tanımlı shell olarak bash'i kullanmaktadır.
Bu shell dışında Bourne Shell (sh), C Shell (csh) ve Korn Shell (ksh)
gibi farklı shell bulunmaktadır.
Link Files
Linux OS
Sistem tarafından depolanan ve işlenen her dosya bir dosya adı ile
ilişkilendirilir. Yeni bir dosya tanımlandığında bu dosya için bir de
isim atanır. Kullanıcılar, bir dosyaya farklı konumlardan daha rahat
erişebilmek için kısayollar tanımlamak ihtiyacı duyabilirler. Linux’ te
kısayol belirtmek için kullanılan dosyalar link file olarak anılırlar.
38
Hard-link
Sistem üzerinde yalnızca sistem yöneticisi tarafından yaratılabilirler.
Mevcut olan bir dosyaya bir hard-link ile ikincil bir isim atandığı
andan itibaren dosyaya iki farklı isim ile erişmek mümkün olacaktır.
Bu aşamadan sonra isimlerden birisi ile gelecek bir dosya silme
talebinde sadece dosyaya erişim için kullanılan iki isimden birisi
silinmiş olur, dosyanın saklanması sürdürülür bundan sonra dosyaya
bir isim ile erişmek mümkündür. Bu durumda dosya yalnızca kendisi
ile ilişkilendirilen tüm isimleri için birer dosya silme işlemi
gerçekleştikten sonra silinmiş ve hiçbir biçimde ulaşılamaz olacaktır.
Link dosyaları ln programı yardımı ile tanımlanır:
# ln /raporlar/ocak-satis.txt /cok-satanlar/2001-ocak.txt
Yukarıdaki örnekte, /raporlar/ocak-satis.txt yolu ile erişilen dosyaya
erişmek için ikincil bir yol olarak /cok-satanlar/2001-ocak.txt tanımı
yapılmaktadır. Bu noktadan sonra dosya isimlerinden birisi silinse de
diğeri de silinene kadar dosya var olacaktır.
Aşağıdaki örnekte php.pl adı ile verilen dosyaya bir hard-link
oluşturulmaktadır:
# ls -l
total 239
-rw-r--r-- 1 root root 242783 Dec 13 10:50 php.pl
Linux OS
# ln php.pl php-dokuman.pl
39
# ls -l
total 478
-rw-r--r-- 2 root root 242783 Dec 13 10:50 php-dokuman.pl
-rw-r--r-- 2 root root 242783 Dec 13 10:50 php.pl
Hard-link (php-dokuman.ps) oluşturulmasından sonra ls çıktısının
ikinci kolonunda yer alan referans sayısı ikiye çıkmıştır. Dosyanın
farklı adları için silme talebi geldikçe referans sayısı azalır ve sıfır
olduğunda dosya sistemden silinir.
Sistem üzerindeki tüm kullanıcılar tarafından tanımlanabilen ve daha
kolayca anlaşılıp idare edilebilen bağ dosyası türü soft-link'lerdir.
Soft-link
Mevcut bir dosyaya farklı yollardan da ulaşılabilmesini sağlar. Ancak
hard-link'lerden farklı olarak, kendisine ikincil isimler tanımlanan
dosya için ilk ismine gelen bir silme talebi dosyanın tümü ile
silinmesine yol açacaktır. Soft-link türü ln komutuna -s parametresi
verilerek gerçekleştirilir.
Aşağıdaki örnek soft-link'lerin kullanımını göstermektedir:
$ ln -s /raporlar/ocak-satis.txt /cok-satanlar/2001-ocak.txt
$ rm /raporlar/ocak-satis.txt
$ cat /cok-satanlar/2001-ocak.txt
No Such File or Directory
İkinci satırdaki dosyanın silinmesi komutundan sonra /coksatanlar/2001-ocak.txt biçiminde verilen ikincil dosya adı ile dosyaya
erişmek mümkün olmayacaktır.
Linux OS
Örnekte, ilk satırda /raporlar/ocak-satis.txt yolu ile erişilen dosyaya
erişmek için ikincil bir yol olarak /cok-satanlar/2001-ocak.txt tanımı
yapılmaktadır.
40
Referanslar
1. Dayıoğlu, B., Demir, B., Temel Linux sistem Yönetimi Kurs
Notları, Akademik Bilişim Konferansı, Samsun, 2001.
2. Silberschatz, Galvin and Gagne, Operating System Concepts, 2009.
3. Stutz, M., The Linux Cookbook: Tips and Techniques for Everyday
Use, No Starch Press, 2001.
4. Yaghmour, K., Masters, J., Ben-Yossef, G., Gerum, P., Building
Embedded Linux Systems, O’Reilly Network Safari Bookshelf, 2008.
5. Tackett, J., Burnett, S., Special Edition Using Linux 4th Edition,
Que Corp.
6. Frampton, S., Linux Administration Made Easy, Linux
Documentation Project.
Linux OS
7. Allen, H., Network Startup Resource Center, PacNOG-6
41

Benzer belgeler

Partition Manager 8.5 Help -

Partition Manager 8.5 Help - anywhere from 1024 to 4096 bytes each, depending upon expected file size. The block size is fixed at file system creation time; it cannot be changed after that without rebuilding the file system. L...

Detaylı