Linux Notice App

Linux File System

 

One of the biggest drawbacks of end users passing from Linux to another operating system, such as Microsoft Windows, is the differences between file systems. If you ask a little experienced about Windows, you can give information about the Program Files, Windows, System32, Documents and Settings folders. However, the Unix world is different, and users who are migrating cannot at first see what folder works and what is relevant. The bad thing is that for different distributions, the file system hierarchy may change. In this article, based on the Linux File System Hierarchy published by the Linux Documentation Project, we will give you information about the Linux file system. If you would like more information, I would recommend you to visit The Linux Documentation Project.

What is File System?

The file system is a set of methods and data structures that are created so that the operating system can follow files on a disk or partition. The file system is also used for different meanings. For example, you have heard a user with two disks saying, "I have two filesystems." Let's not enter this for now. The file structure in Linux that interests us ...

Linux is a Unix clone. So he adopted the "Single Hierarchical Folder Structure". It all starts from the root folder expressed by the / slash icon and goes down. In Windows, there are no so-called drivers like C: D:. In a Windows environment, you can put your files anywhere, such as drive C, drive D, or E. Such file systems are called "Hierarchical Structure".

Starting from the / (root) folder, Linux compiles the folders in order of importance in the boot process. You may wonder why / (slash) is used instead of \ (reverse slash) sign as in Windows; this is because Linux follows the Unix tradition. In addition, small capitalization is an important issue in accordance with this tradition. For example, in Windows, KLASOR_ADI and folder_dir are the same thing; it does not matter. But we're talking about two separate folders in Linux.

When you install a program in Windows, the majority of the files for the program are installed in their own folder. For example, when you install Matlab in C: \ Program Files \ Matlab, its help files are located in this folder. But Linux works differently; When putting program documents under / usr / share / doc / programname, the man (ual) files are placed under / usr / share / man / man [1-9]. If available, the info files are also discarded under / usr / share / info. In short, there is a structure embedded in the system hierarchy. Any installed program is located in various locations of the operating system.

[File Hierarchy]

In the mid-90s when Linux began to become popular, distribution developers worked the way they saw fit to place files; there was no specific standard. This caused many problems. In order to stop this anarchy, the Linux File System Hierarchy (FSSTND for short) was determined. The structure we will describe is also within this standard ...

There is a lot to say about Linux and the file system; but it is better to pass the summary and respond to the needs of the end user: "What folder does Linux use in Linux?"

/ (root):

As mentioned above, / (root) is the starting point of the operating system. All other folders, files, are root's children. When the computer is started, the system will not start if it is first viewed and not found. / (root) and / root (the root user's folder) are separate from each other. In the next section we will explain the difference.

According to FSSTND, root folders under root are:

/ bin: Requires scripts to be

/ boot: Keep files required for startup

/ dev: Hardware files are

/ etc: Contains system settings

/ lib: Library files and kernel modules

/ media: Removable devices (CD-Rom, Flash memory etc ...)

is the folder to which it is added to the system.

/ mnt: Used to temporarily add a file system.

/ opt: For installation of extra programs

/ sbin: The system keeps files that the administrator can run about.

/ srv: Related to the services offered by the system

/ tmp: To keep temporary files

/ usr: A secondary hierarchy

/ var: Stores variable data

Günümüzde Linux dağıtımlarının büyük çoğunluğu, zaman zaman FSSTND tarafından belirlenmiş klasörlerin dışına çıkabiliyor. Bu tanıma bazen bir iki klasör eklendiğini ya da nadiren bu yapıdan bir klasörün çıkarıldığını görüyoruz. Biz gerek güncel dağıtımları, gerekse FSSTND'yi baz alarak incelememizi yapacağız. Ancak yazımızda FSSTND tarafından belirlenen bütün klasörler olmayacak. Linux dosya sistemi oldukça derin bir konu ve her şeyi anlatmaya kalkarsak, ayrı bir kitapçık yayımlamamız gerekir. Bunun yerine, son kullanıcının daha çok ilgisini çekecek ve genellikle haşır neşir olabileceği klasörleri ele alacağız.

/bin :

İşletim sisteminizi kullanmak için gereken birçok yararlı komut /bin klasörü altındadır. cat, mkdir, cp, ls, mv, rm vb. temel komutların hepsini burada bulabilirsiniz. Sistem boot ettiğinde, ilk olarak /bin klasörü çalışır hâle getirilir. Network bağlantınız olmasa ya da önemli klasörlere bir nedenden dolayı erişemeseniz bile, /bin klasöründeki komutlar n'olursa olsun çalışır. Bir sorun çıktığında, /bin klasörü altındaki komutları kullanarak sistemi onarırız.

/boot :

Boot, işletim sisteminin yüklenme evresidir. /boot klasörü, boot işlemi için gereken her şeyi içerir. Bilgisayarın başlangıç (boot) aşamasında gerekmeyen ayar ve yapılandırma dosyaları burada bulunmaz; başka klasörlerden gerektiği zamanlarda yüklenir.

/dev :

In Linux, everything is a file; hardware devices such as ... USB ports, serial and parallel ports, disks, cd-roms, etc ... all devices / dev folder consists of files held under. For example, the hda1 file under / dev represents your hard disk. Or / dev / dsp is your audio device. We use them through programs but direct intervention is possible. For example, you can hear the Kernel by typing "cat / boot / vmlinuz> / dev / dsp".

Some Important Device Files:

/ dev / ttyS0: Serial port to connect devices such as mouse, modem. (COM 1)

/ dev / psaux: PS / 2 input; for mouse and keyboards.

/ dev / lp0: Parallel port (LPT 1); printer, scanner etc ...

/ dev / dsp: Primary audio device

/ dev / usb: USB devices

/ dev / sda: SCSI devices, Flash Memory, external CD-ROMs etc ...

/ dev / scd: SCSI CD-ROMs

/ dev / js0: Joystick (Microsoft Turkish Fun Bar)

/ etc:

If we compare the operating system to a body, we can see the / etc folder as central to the nervous system. The entire configuration of the system is located in this folder or its subfolders. A configuration file is a local file used to control the operations of a program; it is stable and is not to be run.

It is not possible to examine all the folder and configuration files in the / etc folder one by one. But we can give a clue to the end user.

Those who have persistent DNS problems can open the /etc/resolv.conf file as root and add new DNS addresses. If you are experiencing these problems, open this file as root and add the following lines at the top of the file:

nameserver 208.67.222.222

nameserver 208.67.220.220

The given addresses belong to a company called OpenDNS. If you use them instead of Telekom's addresses; your address resolution problems will be left behind. Moreover, you can also access the blocked sites.

/ home:

I had a nice description of the home folder in a timely manner; / home folder as the castle of users explained. That's a pretty good explanation. Within the / home folder, each user has a subfolder in its name. For example, if your username is "ali", / home / ali belongs to you and you can do whatever you want; but what you can do is limited to this folder. The / home folder is similar to Documents and Settings in Windows. But it is a safer building. Because you cannot interfere in someone else's home folder on Linux, you can do whatever you want without much difficulty in Windows.

[Filelight]

Filelight: Software that shows the size of the folders.

/ initrd:

initrd is the abbreviation of initial ramdisk. Up and down means the Startup Memory Disk. In the boot phase, the kernel is installed first. A Memory Disk is then created in your computer's memory. The created Memory Disk opens on / (root) mirror and is mounted as root directory. / initrd is required to do this and install Linux.

/ lib:

Kernel modules and shared library files are located in this folder. You can find the existing kernel modules in / lib / modules / [version_number]. If the library files are mentioned, it is necessary to start the system and execute commands in / bin and / sbin. We can share the shared library files with the DLL (Dynamically Linked Library) in Windows. On Linux, the end of the library files ends with ".so".

/ lost + found:

Lost and Found is an English term. Considering the work done by the / lost + found folder, it could not have been a proper name.

Sometimes there is a problem in our system; we shut down incorrectly, the power goes on, the computer restarts when it stops, and so on. fsck can be compared to the Scandisk program in Windows. If there is a problem that cannot be corrected, if the lost files have been lost, they will be discarded under / lost + find. I don't want to go into issues such as disconnection or inode; It's a little complicated. Briefly summarize; After a bad system shutdown, if you can't find some files that should be, you should look at the lost property office.

/ media:

Removable devices such as CD-Rom, floppy drive, flash memory are connected here. The simplest definition, removable devices, you can think of as a port (mount point).

/ mnt:

Similar to the / media folder. Basic difference; it is being used for removable devices rather than for file systems or hardware devices. The mount operation allows any operating system to use the file system. Your choice is where you link. In other words, it does not matter if you connect a disc to a / media or / mnt folder or to another location. There are only some generally accepted ports; / mnt folder is one of them.

/ opt:

The / opt folder is used for extra-loaded packages that are independent of deployment. For example, when you want to download and install Google Earth, the default point is '/ opt / google-earth'.

Of course you can change it and upload it to another location that suits you. But as we said before, some things are generally accepted. An example is the assignment of extra-installed software to the / opt address. Let's remember C: \ Program Files in Windows; It is not mandatory to install programs here; but almost all of them are being built here. The same logic applies here.

/ proc:

/ proc is a very special virtual file system. We do not have physical files in our sense; There are virtual files containing information about the system state. For example, by typing "cat / proc / swaps", you can get information about the swap files on your system or you can see the properties of your processor with the "cat / proc / cpuinfo" command.

The files in the / proc folder are not used to display only the system state; can also be used to adjust when necessary. But because it doesn't appeal to end users, let's cut it off here.

/ root:

In the first versions of Unix, root did not have its own home folder. It works directly under / (root folder). But over time it was understood that this was not a good method and it was decided that the root user should have a separate folder. Because it is different from other users, root's home folder is not kept under / home; The root folder is under / for separation.

/ sbin:

In Linux, the commands that can be used by the system user are reserved by the commands that the normal user can use. Important programs used for maintenance and management to be used by root are kept under / sbin. The less important management commands are in the / usr / sbin folder. If you have local commands (root), you can find them under / usr / local / sbin.

/ usr:

/ root similar to the root user / usr is also in question. When Unix first came out, users' home folders were kept under / usr. For example, the home folder of a user named cagatay was / usr / cagatay. This method has changed over time and the / home folder has been born. The / usr folder is still a very important build and has a relationship with everything you use on your operating system.

The importance of the / usr folder is because the programs you have loaded are dumped here. The / opt address is for 3rd party programs that are outside the operating system. But everything you load using the operating system or by using package management systems is transferred under / usr. At the same time, the library files that the programs you install will need to work are under / usr / lib.

Another thing to say about / usr is the local folder. Linux is an operating system that can serve as a server to many clients. If you install a Linux server, there can be hundreds of clients connected to it. For each client computer, programs under / usr do not need to be installed separately; you can run these commands from another location. However, the local folder under / usr is only specific to the machine you are using. For example, all the commands in the / usr / local / bin folder are installed on the machine you are using directly. The / usr / bin commands are global and can be accessed from all machines on a network. When you see local, you know that this is only specific to your machine.

/there is :

Log files contain variable system information such as e-mail and printer queues. Here you can see the log of your system; You can check the security status here.

/ tmp:

For temporary files. Many programs use this as temporary storage. The contents of the / tmp folder usually remain in the KB order, and are usually deleted when the operating system restarts. If you're not sure what you're doing, you should definitely not delete the files located under the / tmp folder! Even if the system is not in general, problems may arise on a program basis. For example, when you delete an open socket file, you can troubleshoot the program that uses it and yourself.

The Linux (or Unix) file system is a fairly special build. At first glance, I intimidate people, I accept it. But when you face your phobia and learn the basic principles, you realize that you are in a systematic structure. That's why I suggest you confront your phobia.

No comments

Powered by Blogger.