The standard Linux directory structure mostly follows the POSIX Filesystem Hierarchy Standard. One of the system folders most commonly edited or modified is the /etc directory. Here’s a summary of what files/folders should you expect to see here and what are their functions.
Mainly, the /etc contains system-global configuration files, which affects how programs run and how the behaves for all users.
Why is it called /etc?
In initial days of UNIX OS development there is a folder for each type of data like /bin folder for all your executable binaries
/boot folder for all booting related information.
/dev folder for all hardware devices attached to machine.
But people encountered a situation to keep some files which can be a config file or a data file or a socket file or some other files. So they implemented a folder to keep all these files in it and they named it as /etc(short for etcetera, meaning “and so on”). As time passed the meaning of this folder has changed but not the name “etc”. Now /etc folder means a central location for all your configuration files are located and this can be treated as nerve center of your Linux/Unix machine. Next section displays some files/folders commonly installed in most of Linux/Unix machines.
The /etc folder content can be classified on the following groups:
1. Configuration tables(tab like crontab, fstab, mtab etc)
2. Running Configurations(rc like rc.local, rc1.d, bashrc, wgetrc etc)
3. Configuration files(conf/cfg like pam.conf, ntp.conf etc)
4. Deny/Allow files()
5. Other directories and files
Table files (The ***TAB) in /etc folder in Linux
These are the files which end with tab or start with tab(which is short form of table) such as crontab, fstab, inittab etc. These files main intention is to keep a table of content for their corresponding settings. Below are some of the files which fall under this category.
/etc/crontab – Table for the Linux scheduling daemon – cron. Users can edit this file to schedule running programs or scripts.
/etc/inittab – Contains what are the run-levels, what system have to do at each run-level and default run-level info.
/etc/fstab – Contains file system mounting information and we can edit this file to mount file system permanently and delete mount points.
/etc/mtab – Contains all mounted device status like what devices are mounted, where they mounted and properties of mount points.
/etc/quotatab – Quota related table for mentioning different qutos
/etc/rwtab – When your computer comes back up, the root and any other system partitions will be mounted read-only. All the files and directories listed in /etc/rwtab will be mounted read-write on a tmpfs file system. You can add additional files and directories to rwtab to make them writeable after reboot.
Running Configuration files(rc) in /etc folder
These are again a type of config files which will force a service to start/stop, for a user to use specific environment etc.
/etc/bash.bashrc – System wide bash shell running configuration file which is loaded for every user
/etc/inputrc — Global inputrc for libreadline
/etc/nanorc – Nano editor running configurations, activate syntax highlighting, etc.
rc0.d, rc1.d, rc2.d, rc3.d, rc4.d, rc5.d, rc6.d, rcS.d – running configurations like what services has to start and stop for each run level from zero to six. If you observe rcS.d this folder is same as rc1.d folder which means Single run level.
/etc/rc.local –This file contains commands which need to be executed after completing booting. We can edit this file and keep the commands which we want to execute at the time of booting.
Config files in /etc folder
These are the main configuration files for many applications installed in your machine. These files are text files which can be edited with editors like VI editor so that applications works according to your requirement.
/etc/sysconfig/ – contains files/folder for configuring system level services like cron, grub, firewall, network.
/etc/sysctl.conf – contains settings for system level settings
/etc/logrotate.conf – config for the logrotate utility.
/etc/dnsmasq.conf – DNS client related configuration file
/etc/exports – NFS share configuration file. In this file we will share our local folder to a specific IP address or network with different.
/etc/grub.conf – Main configuration file for grub boot loader
/etc/shadow – User login password hashes are stored here.
/etc/group – User groups information such as which user belongs to which group, what is GID etc.
/etc/passwd – User configurations such as user login name, shell, UID and GID are stored here.
/etc/my.cnf – Mysql configuration file.
/etc/mdadm.conf – Raid configuration file.
/etc/hosts – Hosts to IP address mapping file, This is mother of all name to IP matching files.
/etc/resolv.conf – DNS and domain client configuration file. With out proper DNS server in this file, we can not access internet.
/etc/rsyslog.conf – Remote syslog server configuration file.
Deny/Allow files in /etc folder
These are the files which contain what users are allowed/denied for particular service, what IP address are allowed/denied to access our services etc.
/etc/at.deny – Keep users in this file to deny at jobs execution.
/etc/at.allow – Keep users in this file to allow at jobs execution.
/etc/hosts.allow – TCP wrapper files for allowing services for a particular host/network.
/etc/hosts.deny – TCP wrapper files for allowing services for a particular host/network.
Other files and directories in /etc/
cron.d/, cron.daily/, cron.deny, cron.hourly/, cron.monthly/, crontab, cron.weekly/ – Crontab related files and folders for effective management for scheduling in Linux.
/etc/default/ – Some of the common configuration files are located here.
/etc/issue – This is the file which is displayed at every login session.
/etc/motd – Message of the day file which is shown after you login to any machine.
/etc/services – Available services and their corresponding port information is stored here
/etc/protocols – Available network protocols such as IGP, ISIS etc.
/etc/redhat-release – If yu find this file, that indicates you are working on Redhat based machines and it contain OS version and release details.
/etc/debian_version – If yu find this file, that indicates you are working on Debian based machines and it contain OS version and release details.
/etc/shells – All available/installed shells in your machine.
/etc/sudoers – Main sudo configuration file.