Introduction to Linux systems, the system partition and directory structure Comments

A, Linux Introduction

1, basic knowledge of Linux system

Linux system is a free to use and free dissemination of Unix-like operating systems (mainly used on the server), is a POSIX and UNIX-based multi-user, multi-tasking, multi-threading and multi-CPU support for the operating system. It can run major UNIX software tools, applications, and network protocols. It supports 32-bit and 64-bit hardware. Linux has inherited a network design Unix as the core, stable performance of a multi-user network operating system.

Strictly speaking, Linux is not an operating system, Linux is only the word itself represents the Linux kernel.

Core: Core to establish a platform for communication between computer software and hardware, the kernel provide system services, such as file management, virtual memory, device I / O, process management.

2, a basic understanding of Shell

Shell layer is located between the application layer and the core layer, corresponding to an outer shell enclosing a core layer, the protection system can not be tampered software kernel;
Shell is an interpreter, the command may be interpreted external to the system kernel;

Here Insert Picture Description

3, Linux basic idea

First, all documents, detailed in terms of the system is that all comes down to a file, including commands, hardware and software equipment, operating systems, processes, and so on. For the operating system kernel, the file is considered to have their own characteristics or type.
Second, each software has identified uses.

Two, Linux system partition

In the Linux system, you first need to partition the hard drive, then format (written to the file system), to give each partition from the device name, the last drive letter assigned to the partition (mount point) - mount, you can write data.

1, disk partition - the large disk divided into smaller logical partitions

Partition using the partition compiler, several logical parts divided on the disk, once the disk is divided into several partitions, different classes of directories and files can be stored in different partitions;

Partition type as follows:

  1. Primary partition: You can only have up to four;
  2. Extended partitions: must have at most one primary partition extended partition plus up to 4, a data can not be written, not formatted, comprises only logical partitions;
  3. Logical partition: normal formatting, and data can be written;

2, format - into the file system

Format (Advanced Format) refers to the user based on the selected file system, write specific data in a specific area of ​​the disk, to draw a storage file allocation table, table of contents, etc. for file management disk space in the partition.

3, partition device file name

Windows are: Partition -> Format -> assign a drive letter;
Linux is: Partition -> Format -> Create device file name -> assign a drive letter;

IDE hard disk interface: / dev / hda1
the SCSI interface to the hard disk, SATA hard disk interface: / dev / sda1

Hard disk device file name:
Here Insert Picture Description

Mount - mount point for each partition (empty directory)

Linux equivalent of Mount assign a drive letter in Windows, complete drive letter assignment is called the mount point

That is, assign a drive letter <-> Mount mount point <-> letter

Linux partition must:

  1. Root partition;
  2. :( virtual memory swap partition, double the memory size should be, but then again larger than 2G capacity increase will not bring any help to the system, the same speed and hard drive speed);
  3. :( system boot partition boot partition, 200M, any operating system you want to start airspace requires some space, if not the boot partition, all data will be placed in the root partition, root partition if finished, then Linux can not start properly);

important point:

  1. In fact, not recommended hard disk is divided into four primary partitions, this is because, if a 20GB hard drive, if four primary partitions occupy the space of 15GB, the remaining 5GB space totally unusable because there was no excess partition table (partition table 4) of these spaces can be recorded;
  2. Theoretically allows a disk only one primary partition, the remaining space is allocated to the extended partition.

3, Linux directory structure

Linux is positioning itself to do the server, it is more rigorous, and each directory has its own role, but this is not mandated. Linux is generally not for personal use, usually maintained by a team to manage, so the best rules to put some kind of directory file, so you can easily exchange work; before learning Linux, you first need to be Linux directory structure simple to understand.

Linux uses a directory tree structure (all expressed as a file). The top node is the root (/), i.e. during installation, it is required that the user must enter the mount point. Below the root is generated many branches. Because Linux uses a standardized hierarchy, these branches are pre-defined meaning, and what it should contain.

Here Insert Picture Description

(1) Linux directory roles:
Directory name Directory Structure
/bin/ Storage system command directory, an ordinary user and a super user can execute, placed under the command / bin, can be performed in single-user mode
/sbin/ Save commands and system settings related to the environment, only the super user can use these commands to the system environment settings, but some command allows ordinary users to view;
/usr/bin/ Storage system command directory, an ordinary user and a super user can execute these commands and system start-independent, can not be performed in single-user mode;
/urs/sbin/ Root file system to store unnecessary system management commands, such as most of the service program. Only super-user customers (Note: On Linux systems, all stored in sbin directory command only the superuser can use, bin directory in order to protect all users can use);
/boot/ System startup directory, the system starts saving the relevant documents, such as kernel boot files and program files;
/dev/ Device file save location, in Linux, everything is stored as a file, including hardware, this directory is used to store all the files in the hardware device;
/etc/ Configuration file save location, all the default installation (RPM installed) service configuration files are stored in this directory all of them, such as user accounts and passwords, startup scripts services, common service profiles within the system;
/home/ Average user's home directory when creating each user, each user must have a default login location, this location is the user's home directory, all the ordinary user's home directory is to create a user name and / home / same directory, such as the user's home directory yao is: / home / yao;
/lib/ System call library storage location;
/lost+found/ 当系统意外崩溃或机器意外关机时,而产生的一些文件碎片放在这里,当系统启动的过程中fsck工具会检查这里,并修复已经损坏的文件系统,这个目录只在每个分区中出现,例如/lost+found/就是根分区的备份恢复目录,/boot/lost+found就是/boot/分区的备份恢复目录;
/media/ 挂载目录,系统建议是用来挂载媒体设备的,例如软件和光盘;
/mnt/ 挂载目录,建议挂载额外设备,如U盘,移动硬盘和其他操作系统的分区;
/misc/ 挂载目录,系统建议是用来挂载NFS服务的共享目录(注:系统虽然准备了三个默认的挂载目录,但是只要是一个已经建立好的空目录就可以作为挂载点);
/opt/ 第三方安装的软件保存的位置,这个目录就是放置和安装其他软件的位置,手工安装的源码软件包都可以安置在这个目录,但现在大家更习惯吧软件放置到/usr/local/目录当中,也就是说/usr/local/目录页可以用来安装软件;
/proc/ 虚拟文件系统。该目录中的数据并不保存在硬盘中,而是保存在内存中,主要包括系统的内核、进程、外部设备状态和网络状态等;
/sys/ 虚拟文件系统,和/proc目录类似,都是保存在内存当中的,主要是保存内核相关信息;
/root/ 超级用户的家目录,普通用户目录在/home/下,超级用户的家目录直接在根目录下;
/srv/ 服务数据目录,一系列服务启动之后,可以在这个目录中保存所需要的数据;
/tmp/ 临时目录,系统存放临时文件的目录,该目录下所有用户都可以访问和写入,建议每次开机都把该目录清空;
/usr/ 系统软件资源目录,usr不是user的缩写,而是unix software resuorce的缩写,所以不是存放用户数据,而是存放系统软件资源的目录,系统中安装的软件大多数保存在这个目录下;
/var/ 动态数据保存位置,主要保存缓存,日志以及软件运行所产生的文件;
(2)注意点:
  • bin是binary的缩写,代表的意思是二进制,放在这里的都是可执行的二进制文件,在Linux中就是命令;
  • Representative foregoing sbin s super (super) means;
  • Command bin under all users can use, and can be used in single-user mode;
  • Sbin under the command of only the super user can use;
  • usr / bin can no longer use single-user mode, safe mode in Windows and almost single-user mode, generally used for repair;

4, Linux is just a small point

(1) Linux strictly case-sensitive;
(2) all the contents in Linux are saved in a file. Including hardware, hardware files are: / dev / sd [ap] , CD-ROM files are: / dev / SR0;
(3) in Linux, the command is executed most of them are temporary in effect, if you want permanent, basic needs modify the configuration file;
(4) Linux not test the extension distinguish file types (the following are some of the habitual usage, help administrators identify, facilitate management only):

  • Archive: .gz .bz2 tar.bz2 .tgz
  • Binary packages: .rpm
  • Page document: .sh
  • Profile: .conf

After (5) Linux desired storage device must hang up users to use, including hard disk, U disk and CD-ROM;
procedures under (6) Windows can not be installed and run directly on Linux;

Guess you like

Origin blog.csdn.net/weixin_45116657/article/details/93846980