linux的重要子目录

1. 重要的目录说明

目录

目录说明

/bin

常用的二进制命令目录。比如lscpmkdircut

/boot

存放用于系统引导时使用的各种文件

/dev

用于存放设备文件

/etc

存放系统配置文件

/home

普通用户的家目录默认数据存放目录

/lib

存放跟文件系统中的程序运行所需要的共享库及内核模块

/lost+found

存放磁盘文件或系统破的临时文件位置

/mnt

系统管理员安装临时文件系统的挂载点

/opt

自定义安装软件包的目录

/proc

虚拟目录,进程信息及内核信息

/root

Linux超级权限用户root的家目录

/sbin

超级管理员运行命令存放的目录

/selinux

SELinux存放配置文件的位置

/srv

服务启动之后需要访问的数据目录

/tmp

一般用户或正在执行的程序临时存放文件的目录

/usr

系统存放应用程序的目录

/var

放置系统执行过程中经常变化的文件

在Linux系统中一切皆文件

2.linux中重要的子目录

2.1 网卡目录

/etc/sysconfig/network-scripts/ifcfg-eth0

DEVICE=eth0    ##网卡名称

HWADDR=00:0c:29:b9:47:51   #物理名称,网卡的mac地址

TYPE=Ethernet            ##以太网

UUID=d560c64b-cdd4-419f-9c80-1a80e643252b   ##磁盘的唯一标识

ONBOOT=yes   ###网卡是否开机自启动

NM_CONTROLLED=yes     #是否接受软件控制

BOOTPROTO=none   ##网卡启动的时候如何获取IP地址(获取协议)static:静态分配IP地址;DHCP:动态分配IP地址(自动获取IP地址)

DNS1=10.0.0.2

USERCTL=no

PEERDNS=yes

IPV6INIT=no

IPADDR=10.0.0.200   ##IP地址

NETMASK=255.255.255.0  ##子网掩码

GATEWAY=10.0.0.254  @###网关地址

DNS2=10.0.0.2       ###dns地址    网址域名  在网络中使用的

###关闭某一网卡

ifdown eth0  && ifup eth0

###重启所有网卡

/etc/init.d/network restart

2.2把主机名(域名)解析为ip地址

 cat /etc/hosts

127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4

::1         localhost localhost.localdomain localhost6 localhost6.localdomain6

2.3主机名

/etc/sysconfig/network

2.4开机启动时-磁盘分区和目录的挂载关系

cat /etc/fstab

#

# /etc/fstab

# Created by anaconda on Sun Jul 16 13:01:56 2017

#

# Accessible filesystems, by reference, are maintained under '/dev/disk'

# See man pages fstab(5), findfs(8), mount(8) and/or blkid(8) for more info

#

UUID=ce5a5255-0aa2-434b-9af3-0991af9c03d1 /                       ext4    defaults        1 1

UUID=a098c44e-84f9-4d42-b2e7-8074335f77e5 /boot                   ext4    defaults        1 2

UUID=5e33d67b-dc90-44da-9b81-ba15cc31dd46 swap                    swap    defaults        0 0

tmpfs                   /dev/shm                tmpfs   defaults        0 0

devpts                  /dev/pts                devpts  gid=5,mode=620  0 0

sysfs                   /sys                    sysfs   defaults        0 0

proc                    /proc                   proc    defaults        0 0

第一列====磁盘分区 设备

第二列====目录(挂载点)

2.5开机启动的脚本文件(文件中放着开机需要启动的命令)开机自动运行的命令或脚本

 cat /etc/rc.local

#!/bin/sh

#

# This script will be executed *after* all the other init scripts.

# You can put your own initialization stuff in here if you don't

# want to do the full Sys V style init stuff.

2.6放着Linux系统的运行级别----不同的状态

at /etc/inittab

# inittab is only used by upstart for the default runlevel.

#

# ADDING OTHER CONFIGURATION HERE WILL HAVE NO EFFECT ON YOUR SYSTEM.

#

# System initialization is started by /etc/init/rcS.conf

#

# Individual runlevels are started by /etc/init/rc.conf

#

# Ctrl-Alt-Delete is handled by /etc/init/control-alt-delete.conf

#

# Terminal gettys are handled by /etc/init/tty.conf and /etc/init/serial.conf,

# with configuration in /etc/sysconfig/init.

#

# For information on how to write upstart event handlers, or how

# upstart works, see init(5), init(8), and initctl(8).

#

# Default runlevel. The runlevels used are:

#   0 - halt (Do NOT set initdefault to this)

#   1 - Single user mode

#   2 - Multiuser, without NFS (The same as 3, if you do not have networking)

#   3 - Full multiuser mode

#   4 - unused

#   5 - X11

#   6 - reboot (Do NOT set initdefault to this)

#

id:3:initdefault:

2.7运行级别说明

运行级别

说明

0

关机

1

单用户模式,root密码忘了,默认没有网络

2

多用户模式,没有NFS(网路文件系统

3

完全多用户模式,命令模式

4

没有使用

5

图像界面模式,桌面模式

6

重启

2.71如何切换运行级别

[root@zzz]# init 5

[root@zzz]# runlevel ##查看当前运行级别

3 5 ##上一次运行级别  当前运行级别

[root@zzz]#

永久切换

[root@zzz39 zzz]# grep "id:" /etc/inittab

id:3:initdefault:

 

2.8 存放的是软件管理的命令

cd /etc/init.d/

abrt-ccpp         functions         lvm2-monitor      postfix           saslauthd

abrtd             haldaemon         mdmonitor         psacct            single

abrt-oops         halt              messagebus        quota_nld         smartd

acpid             ip6tables         netconsole        rdisc             sshd

atd               iptables          netfs             rdma              svnserve

auditd            irqbalance        network           restorecond       sysstat

blk-availability  kdump             nfs-rdma          rngd              udev-post

cpuspeed          killall           ntpd              rsyslog          

crond             lvm2-lvmetad      ntpdate           sandbox

2.9 存放系统别名----存放系统环境变量

[root@zzz39 ~]# cat /etc/profile

# /etc/profile

 

# System wide environment and startup programs, for login setup

# Functions and aliases go in /etc/bashrc

 

# It's NOT a good idea to change this file unless you know what you

# are doing. It's much better to create a custom.sh shell script in

# /etc/profile.d/ to make custom changes to your environment, as this

# will prevent the need for merging in future updates.

................

2.10用户的环境变量

cat ~/.bashrc

# .bashrc

 

# User specific aliases and functions

 

#alias rm='rm -i'

alias cp='cp -i'

alias mv='mv -i'

 

# Source global definitions

if [ -f /etc/bashrc ]; then

    . /etc/bashrc

fi

...........................

2.11用户的环境变量

cat ~/.bash_profile

# .bash_profile

 

# Get the aliases and functions

if [ -f ~/.bashrc ]; then

    . ~/.bashrc

fi

 

# User specific environment and startup programs

 

PATH=$PATH:$HOME/bin

 

export PATH

2.12用户登录或远程连接之后显示的内容

[root@zzz ~]# cat /etc/motd

[root@zzz ~]# echo "welcome to  linux training" >> /etc/motd

Last login: Wed Jul 19 20:09:36 2017 from 10.0.0.1

welcome to  linux training

2.13/usr/local/编译安装的默认位置

安装软件的方法

  • yum 软件管家(yellow dog

从网上下载 自动替你安装

  • rpm 命令安装软件  

缺少东西自己加工,自己下载

  • 编译安装

自己做,自己编译

       ./configure     make   make install

2.14 /var/log/secure用户的登录信息

cat /var/log/secure

Jul 16 13:15:05 zzz39 sshd[1454]: Server listening on 0.0.0.0 port 22.

Jul 16 13:15:05 zzz39 sshd[1454]: Server listening on :: port 22.

Jul 16 13:16:45 zzz39 login: pam_unix(login:session): session opened for user root by LOGIN(uid=0)

Jul 16 13:16:45 zzz39 login: ROOT LOGIN ON tty1

Jul 16 13:28:38 zzz39 sshd[2096]: reverse mapping checking getaddrinfo for bogon [10.0.0.1] failed - POSSIBLE BREAK-IN ATTEMPT!

Jul 16 13:28:45 zzz39 sshd[2096]: Accepted password for root from 10.0.0.1 port 58100 ssh2

Jul 16 13:28:45 zzz39 sshd[2096]: pam_unix(sshd:session): session opened for user root by (uid=0)

Jul 16 17:10:41 zzz39 sshd[1605]: Server listening on 0.0.0.0 port 22.

Jul 16 17:10:41 zzz39 sshd[1605]: Server listening on :: port 22.

2.15用户的系统日志

/var/log/messages

tail -20 /var/log/messages

Jul 19 21:44:10 zzz39 init: prefdm main process (6959) terminated with status 1

Jul 19 21:44:10 zzz39 init: prefdm main process ended, respawning

Jul 19 21:44:10 zzz39 init: prefdm main process (6976) terminated with status 1

Jul 19 21:44:10 zzz39 init: prefdm main process ended, respawning

Jul 19 21:44:11 zzz39 init: prefdm main process (6993) terminated with status 1

Jul 19 21:44:11 zzz39 init: prefdm main process ended, respawning

Jul 19 21:44:11 zzz39 init: prefdm main process (7010) terminated with status 1

Jul 19 21:44:11 zzz39 init: prefdm main process ended, respawning

Jul 19 21:44:11 zzz39 init: prefdm main process (7027) terminated with status 1

Jul 19 21:44:11 zzz39 init: prefdm main process ended, respawning

Jul 19 21:44:11 zzz39 init: prefdm main process (7044) terminated with status 1

2.16cpu信息

cpu cores   : 2

apicid      : 0

initial apicid  : 0

fpu     : yes

fpu_exception   : yes

cpuid level : 22

wp      : yes

...................

2.17内存的信息

cat /proc/meminfo

MemTotal:        1004112 kB

MemFree:          656036 kB

Buffers:           44760 kB

Cached:           179504 kB

SwapCached:            0 kB

Active:           101796 kB

Inactive:         136168 kB

Active(anon):      13920 kB

Inactive(anon):        8 kB

Active(file):      87876 kB

Inactive(file):   136160 kB

.........................

2.18平均负载 ,系统的繁忙程度 

cat /proc/loadavg

0.00 0.01 0.00 2/181 7211

2.19系统挂载信息

cat /proc/mounts

rootfs / rootfs rw 0 0

proc /proc proc rw,relatime 0 0

sysfs /sys sysfs rw,relatime 0 0

devtmpfs /dev devtmpfs rw,relatime,size=487428k,nr_inodes=121857,mode=755 0 0

devpts /dev/pts devpts rw,relatime,gid=5,mode=620,ptmxmode=000 0 0

*tmpfs /dev/shm tmpfs rw,relatime 0 0

/dev/sda3 / ext4 rw,relatime,barrier=1,data=ordered 0 0

/proc/bus/usb /proc/bus/usb usbfs rw,relatime 0 0

/dev/sda1 /boot ext4 rw,relatime,barrier=1,data=ordered 0 0

none /proc/sys/fs/binfmt_misc binfmt_misc rw,relatime 0 0

/dev/sr0 /mnt/cdrom iso9660 ro,relatime 0 0

猜你喜欢

转载自www.cnblogs.com/zdqc/p/9429661.html
今日推荐