Linux directory structure important supplement

Continue to learn important Linux directory structure.

Modify the hostname

Check / etc / hostname, you can see the hostname, modifications are divided into temporary and permanent modifications to modify.

Temporarily modify: hostname host name, host name can be seen though modified into luxiaofeng, reconnect after Ctrl + D Linux system host name has become luxiaofeng, but see the / etc / hostname file found that this is only a temporary change to take effect, the real name or youngchaolin.

Permanent modification: hostnamectl set-hostname host name, which is a modification of the way after a Centos7.

As it can be seen, and then reconnect the use of permanent changes, modify the host name, hostname file content is permanently changed.

Modify the Linux kernel parameter information file

Modify /etc/sysctl.conf, as you can see the prompt to /usr/lib/sysctl.d and other documents to be modified, temporarily put aside, later supplemented how to optimize.

If you want the changes to take effect, use the sysctl -p command to take effect. 

Source compile and install the software default path location

/usr/local

Under Linux there are three ways to install the software, stupid windows system is different from the installation of:

(1) rpm packages installed rpm -ivh .rpm package name

(2) yum install rpm package manager, it's smart to help us select a package needed dependencies, in essence, is to install rpm, but automatically resolve dependencies, we do not need all the rpm package ready before you start installation

(3) the source code for installation, which is characteristic of linux

Directory for source files

/ Rerecording usr / src specifically later, put the first FIG.

Log Directory

/ Var / log directory, records information system and software running in place.

messages

System-level log files, records linux running, if wants to operation and maintenance, the log files need to read every day estimate. When the system operational failure, failure information can be viewed through it.

Modify the host name can be seen that the messages are also recorded in the log file. If the system is running linux long time, there will be a lot of information messages, with time suffix to distinguish.

secure

安全日志文件,通过它可以查看用户登录信息,故意登录失败几次后,就有了如下的失败记录,这个可以用来查看是否有黑客刻意破解登录系统。

dmesg

硬件信息加载情况日志文件。

cron

定时任务日志文件,具体后面补充。

进程和内核信息

/proc下查看进程和内核信息,比较常用的有meminfo,cpuinfo,loadavg等。

查看内存信息

也可以通过free -m命令来查看内存信息。

查看cpu信息

查看负载

通过查看负载可以判断系统繁忙程度,配合uptime命令一起使用。其中uptime的第一列代表当前时间,up 3:03代表系统运行时间,下面我刻意的多登陆一个用户后,显示为2个user了,然后load average代表平均负载,0.00代表1分钟负载,0.01代表5分钟负载,0.05代表15分钟负载。

负载的数字和CPU核数相当的时候就是负载的一个经验临界点,例如一颗两核CPU,临界负载就是2,后面详细研究。

另外w命令可以查看用户登录信息。

查看挂载情况

/proc/mounts

 

以上为linux重要目录结构的补充,后续深入后再补充。

Guess you like

Origin www.cnblogs.com/youngchaolin/p/11247059.html