Linux Basics for Hackers


The Device Directory /dev



Download 1,43 Mb.
bet6/18
Sana22.08.2022
Hajmi1,43 Mb.
#847523
1   2   3   4   5   6   7   8   9   ...   18
Bog'liq
(2)Linux Basics For Aspiring Hackers 2018

The Device Directory /dev


Linux has a special directory that contains files representing each attached device: the appropriately named /dev directory. As your first introduction, navigate to the /dev directory and then perform a long listing on it. You should see something like Listing 10-1.

kali >cd /dev kali >ls -l total 0
crw------- 1 root root 10,175 May 16 12:44 agpgart crw------- 1 root root 10,235 May 16 12:44 autofs drwxr-xr-x 1 root root 160 May 16 12:44 block
--snip--
lrwxrwxrwx 1 root root 3 May 16 12:44 cdrom -> sr0
--snip--
drwxr-xr-x 2 root root 60 May 16 12:44 cpu --snip--

Listing 10-1: A long listing of the /dev directory
The devices are displayed in alphabetical order by default. You may recognize some of the devices, such a cdrom and cpu, but others have rather cryptic names. Each device on your system is represented by a file in the /dev directory, including devices you’ve probably never used or even realized existed. On the off chance you do, there is a device file waiting to be used for it.
If you scroll down this screen a bit, you should see more listings of devices. Of particular interest are the devices sda1, sda2, sda3, sdb, and sdb1, which are the hard drive and its partitions and a USB flash drive and its partitions.

--snip--
brw-rw---- 1 root root 8, 0 May 16 12:44 sda brw-rw---- 1 root root 8, 1 May 16 12:44 sda1 brw-rw---- 1 root root 8, 2 May 16 12:44 sda2 brw-rw---- 1 root root 8, 5 May 16 12:44 sda5 brw-rw---- 1 root root 8, 16 May 16 12:44 sdb brw-rw---- 1 root root 8, 17 May 16 12:44 sdb1 --snip--

Let’s take a closer look at these.

How Linux Represents Storage Devices


Linux uses logical labels for drives that are then mounted on the filesystem. These logical labels will vary depending on where the drives are mounted, meaning the same hard drive might have different labels at different times, depending on where and when it’s mounted.
Originally, Linux represented floppy drives (remember those?) as fd0 and hard drives as hda. You will still occasionally see these drive representations on legacy Linux systems, but today most floppy drives are gone (thank goodness). Even so, old legacy hard drives that used an IDE or E-IDE interface are still represented in the form hda. Newer Serial ATA (SATA) interface drives and Small Computer System Interface (SCSI) hard drives are represented as sda. Drives are sometimes split up into sections known as partitions, which are represented in the labeling system with numbers, as you’ll see next.
When systems have more than one hard drive, Linux simply names them serially by incrementing the last letter in alphabetical order, so the first drive is sda, and the second drive is sdb, the third drive is sdc, and so on (see Table 10-1). The serial letter after sd is often referred to as the major number.
Table 10-1: Device-Naming System

Device fileDescription sda First SATA hard drive sdb Second SATA hard drive sdc Third SATA hard drive sdd Fourth SATA hard drive


Download 1,43 Mb.

Do'stlaringiz bilan baham:
1   2   3   4   5   6   7   8   9   ...   18




Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©hozir.org 2024
ma'muriyatiga murojaat qiling

kiriting | ro'yxatdan o'tish
    Bosh sahifa
юртда тантана
Боғда битган
Бугун юртда
Эшитганлар жилманглар
Эшитмадим деманглар
битган бодомлар
Yangiariq tumani
qitish marakazi
Raqamli texnologiyalar
ilishida muhokamadan
tasdiqqa tavsiya
tavsiya etilgan
iqtisodiyot kafedrasi
steiermarkischen landesregierung
asarlaringizni yuboring
o'zingizning asarlaringizni
Iltimos faqat
faqat o'zingizning
steierm rkischen
landesregierung fachabteilung
rkischen landesregierung
hamshira loyihasi
loyihasi mavsum
faolyatining oqibatlari
asosiy adabiyotlar
fakulteti ahborot
ahborot havfsizligi
havfsizligi kafedrasi
fanidan bo’yicha
fakulteti iqtisodiyot
boshqaruv fakulteti
chiqarishda boshqaruv
ishlab chiqarishda
iqtisodiyot fakultet
multiservis tarmoqlari
fanidan asosiy
Uzbek fanidan
mavzulari potok
asosidagi multiservis
'aliyyil a'ziym
billahil 'aliyyil
illaa billahil
quvvata illaa
falah' deganida
Kompyuter savodxonligi
bo’yicha mustaqil
'alal falah'
Hayya 'alal
'alas soloh
Hayya 'alas
mavsum boyicha


yuklab olish