Linux Study Notes-2. Introduction to Linux System

2. Introduction to Linux system

 

 

1. Linux is strictly case-sensitive.

2. All content in Linux is saved in file form, including hardware:

The hard disk file is /dev/sd[ap]

CD files are /dev/sr0 etc.

 

 

3. Linux has no extension file type

General general specification, Linux does not need these extensions, and it can run normally without it. It is for manual reading and identification:

Compressed package: .gz.bz2.tar.gz2.tgz

Binary package: .rpm

Web page file: .html.php

Script file: .sh

Configuration file: .conf

4. The storage devices of Linux must be mounted before users can use them, including hard disks, U disks and CD-ROMs.

5. Programs under Windows generally cannot be installed and run directly in Linux.

 

 

2.1. The role of the Linux main directory

 

 

superuser root

Ordinary user, non-root user

Single user mode: start the smallest service, mainly used to repair the system, similar to Windows safe mode

 

 

directory name

Directory role

/

The root directory, located at the top level of the directory structure, is represented by a slash ( / ), similar to "C:\" in Windows operating systems

/bin/

The directory, also known as the binary directory, stores the system command directory , as well as the symbolic link of some executable files , which can be executed by ordinary users and super users. However, commands placed in /bin can also be executed in single-user mode.

/sbin/

Save commands related to system environment settings. Only super users can use these commands to set system environment settings, but some commands can be viewed by ordinary users.

/usr/bin/

usr:Unix System Resource , the directory for storing system commands, which can be executed by ordinary users and super users. These commands have nothing to do with system startup and cannot be executed in single-user mode.

/usr/sbin

Stores unnecessary system administration commands for the root file system, such as most service programs. Only superusers can use it. You can actually notice that in the Linux system, all commands saved in the sbin directory can only be used by superusers, and commands saved in the bin directory can be used by all users.

/boot/

The system startup directory, saves files related to system startup, such as kernel files and bootstrap (grub) files, etc.

/dev/

Device file save location. Everything in Linux is saved as a file, including hardware. This directory is where the user saves all hardware device files.

/etc/

The default save location for configuration files. The configuration files of all the services using the default installation method ( rpm installation) in the system are all stored in this directory, such as user accounts and passwords, service startup scripts, and configuration files of common services.

/home/

The home directory of ordinary users. When creating each user, each user must have a default login location, which is the user's home directory. The home directory of all ordinary users is to create a directory under /home with the same user name. For example, the home directory of user user1 is /home/user1

/lib/

System call function library storage location

/lost+found/

When the system crashes unexpectedly or the machine shuts down unexpectedly, some file fragments are placed here. When the system starts, the fsck ( File System Check ) tool will check here and repair the damaged file system. This directory only appears in each partition. For example, /lost+found/ is the backup and recovery directory for the root partition, and /boot/lost+found/ is the backup and recovery directory for the /boot partition.

The lost+found directory is not found in CentOS7 ?

/media/

mount directory. The system is recommended for mounting multimedia devices, such as floppy disks and CD-ROMs.

/ mnt /

mount directory. There was only this mount directory in early Linux , and there was no subdivision. Now this directory system recommends to mount additional devices such as USB drives, removable hard drives and other operating system partitions.

/misc/

mount directory. The system recommends to mount the shared directory of the NFS service.

/media /mnt /misc are three mount directories prepared by the system. However, what to mount is determined by the administrator and used according to personal habits. For example, some people often use: /mnt/cdrom to mount a CD, /mnt/usb to mount a U disk.

The misc directory is not found in CentOS7 ?

/opt/

表示的是可选择的意思,第三方安装的软件保存位置。这个目录就是放置和安装其他软件的位置,我手工安装的源码包软件都可以安装到这个目录 当中。不过我还是更加习惯把软件放置到/usr/local目录当中,也就是说/usr/local/目录也可 以用来安装软件

/proc/

虚拟文件系统,该目录中的数据不保存到硬盘当中,而是保存到内存当中。主要保存系统的内核,进程,外部设备状态 和网络状态灯。如/proc/cpuinfo是保存CPU信息的,/proc/devices是保存设备驱动列表的,/proc/filesystems是保存文件系统列表的,/proc/net/是保存网络协议信息的

/sys/

虚拟文件系统,和/proc/一样,都是保存在内存当中的,主要是保存内核相关的信息,不要把数据存放在这里,重启以后就丢失了。

/root/

超级用户的家目录。普通用户的家目录在/home下,超级用户家目录直接在/

/srv/

服务数据目录。一些系统启动之后,可以在这个目录中保存所需要的数据。

/tmp/

临时目录。系统存放临时文件的目录,该目录下所有用户都可以访问和写入。我们建议此目录中不能保存重要数据,最好每次开机都把该目录清空。

/usr

系统软件资源目录。注意usr不是user缩写,而是Unix Software Resource的缩写,所以不是存放用户数据,而存放系统软件资源的目录。系统中安装的软件大多数都保存在这里。

/var/

动态数据保存位置。主要保存缓存,日志及软件运行所产生的文件。例如:日志,邮件,数据库等经常变化的数据保存在这里

 

 

 

 

2.2.服务器注意事项

 

 

1、远程服务器不允许关机,只能重启。

远程服务器一般都在机房,而且在全球各地,如果关机了,谁来开机?

2、重启服务器时应该关闭服务。

服务器磁盘在读写当中时,都是高速旋转当中,如果突然断电,可能直接导致硬盘损坏,数据丢失。

3、不要在服务器访问高峰期运行高负载命令。

进行大数量压缩解压缩,复制,备份都是高负载命令,尽量在访问量比较少的时候操作。

4、远程配置防火墙时,不要把自己踢出服务器。

通过IP地址,端口号,MAC地址等来判断是否可以访问服务器。如果把自己踢出去了,就访问不了服务器了,服务器无法访问了怎么办?类似服务器关机一样,要跑到机房去访问了。

 

5、指定合理的密码规范并定期更新

6、合理分配权限,够用就好。

7、定期备份重要数据和日志。

 

 

 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325959118&siteId=291194637
Recommended