在linux下修改系统配置时就会在/etc这个目录下修改配置文件,可见这个目录是系统的配置文件目录。
在终端输入ls看看里面的文件:
$ ls
acpi calendar dpkg host.conf ldaptor magic.mime os-release rc2.d shells udev
adduser.conf chatscripts drirc hostname ldapvi.conf mailcap overlayroot.conf rc3.d signond.conf udisks2
alternatives console-setup emacs hosts ld.so.cache mailcap.order pam.conf rc4.d skel ufw
apache2 cpu environment hosts.allow ld.so.conf manpath.config pam.d rc5.d sos.conf updatedb.conf
apg.conf cracklib ffserver.conf hosts.deny ld.so.conf.d mdadm papersize rc6.d sound update-manager
apm cron.d fonts ImageMagick-6 legal memcached.conf passwd rc.local ssh update-motd.d
apparmor cron.daily fstab init libao.conf mime.types passwd- rcS.d ssl update-notifier
apparmor.d cron.hourly fuse.conf init.d libaudit.conf mke2fs.conf perl resolvconf subgid UPower
apport cron.monthly gai.conf initramfs-tools libnl-3 modprobe.d php resolv.conf subgid- upstart-xsessions
apt crontab gconf inputrc libpaper.d modules pki rmt subuid usb_modeswitch.conf
at.deny cron.weekly gdb insserv lightdm modules-load.d pm rpc subuid- vdpau_wrapper.cfg
at-spi2 crypttab ghostscript insserv.conf lighttpd mongodb.conf polkit-1 rsyslog.conf subversion vim
auth-client-config cupshelpers gnome insserv.conf.d lintianrc mtab popularity-contest.conf rsyslog.d sudoers vmware-tools
avahi dbus-1 gnome-vfs-2.0 iproute2 locale.alias mysql ppp samba sudoers.d vtrgb
bash.bashrc dconf GNUstep iscsi locale.gen nanorc profile sane.d supervisor vulkan
bash_completion debconf.conf groff issue localtime network profile.d screenrc sysctl.conf wgetrc
bash_completion.d debian_version group issue.net logcheck NetworkManager protocols securetty sysctl.d wpa_supplicant
bind default group- java-8-openjdk login.defs networks pulse security sysstat X11
bindresvport.blacklist deluser.conf grub.d kbd logrotate.conf newt python selinux systemd xdg
binfmt.d depmod.d gshadow kernel logrotate.d nsswitch.conf python2.7 sensors3.conf terminfo xml
bluetooth dhcp gshadow- kernel-img.conf lsb-release nvcc.profile python3 sensors.d texmf zsh_command_not_found
bonobo-activation dictionaries-common gss ldap ltrace.conf openal python3.5 services thermald
byobu dkms gtk-2.0 ldap-account-manager lvm OpenCL rarfiles.lst sgml timezone
ca-certificates dnsmasq.d gtk-3.0 ldap.conf machine-id openmpi rc0.d shadow tmpfiles.d
ca-certificates.conf docker hdparm.conf ldapscripts magic opt rc1.d shadow- ucf.conf
可以看到里面都是些系统配置文件,系统配置目录,应用程序配置文件,应用程序配置目录。
/etc/profile
系统全局环境变量设置,里面可以添加对所有用户有效的环境变量,系统配置等。
$ cat profile
if [ "$PS1" ]; then
if [ "$BASH" ] && [ "$BASH" != "/bin/sh" ]; then
if [ -f /etc/bash.bashrc ]; then
. /etc/bash.bashrc
fi
else
if [ "`id -u`" -eq 0 ]; then
PS1='# '
else
PS1='$ '
fi
fi
fi
if [ -d /etc/profile.d ]; then
for i in /etc/profile.d/*.sh; do
if [ -r $i ]; then
. $i
fi
done
unset i
fi
/etc/bash.bashrc
bash的环境变量配置,里面添加启动bash时读取的环境。
$ cat bash.bashrc
[ -z "$PS1" ] && return
shopt -s checkwinsize
if [ -z "${debian_chroot:-}" ] && [ -r /etc/debian_chroot ]; then
debian_chroot=$(cat /etc/debian_chroot)
fi
PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w\$ '
if [ ! -e "$HOME/.sudo_as_admin_successful" ] && [ ! -e "$HOME/.hushlogin" ] ; then
case " $(groups) " in *\ admin\ *|*\ sudo\ *)
if [ -x /usr/bin/sudo ]; then
cat <<-EOF
To run a command as administrator (user "root"), use "sudo <command>".
See "man sudo_root" for details.
EOF
fi
esac
fi
if [ -x /usr/lib/command-not-found -o -x /usr/share/command-not-found/command-not-found ]; then
function command_not_found_handle {
if [ -x /usr/lib/command-not-found ]; then
/usr/lib/command-not-found -- "$1"
return $?
elif [ -x /usr/share/command-not-found/command-not-found ]; then
/usr/share/command-not-found/command-not-found -- "$1"
return $?
else
printf "%s: command not found\n" "$1" >&2
return 127
fi
}
fi
/etc/hosts
主机域名的配置。
$ cat hosts
127.0.0.1 localhost
127.0.1.1 ubuntu
::1 localhost ip6-localhost ip6-loopback
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
192.168.2.22 Master
192.168.2.23 Backup
192.168.2.61 vedio1
192.168.2.62 vedio2
/etc/ld.so.cof
ldconfig命令读取的系统库目录配置文件。
$ cat ld.so.conf
include /etc/ld.so.conf.d/*.conf
/usr/local/cuda-8.0/lib64
/usr/local/samba/lib
/etc/ld.so.cache
ldconfig命令读取的系统库路径生成的缓存文件。
/etc/timezone
系统的时间时区设置。
/etc/adduser.conf
添加的用户信息。
/etc/deluser.conf
删除用户信息。
/etc/group
用户组信息。
/etc/crontab
系统定时任务信息。
/etc/passwd
用户密码信息。
/etc/sudoers
具有sodu执行权限的用户信息。
/etc/protocols
系统支持的ip协议簇。
/etc/sysctl.conf
系统内核的配置文件。
$ cat sysctl.conf
//lwn.net/Articles/277146/