The kernel is the heart of the system. It manages the communication between the underlying hardware and the peripherals. The kernel also makes sure that processes and daemons (server processes) are started and stopped at the exact right times. The kernel has a lot of other important tasks, so many that there is a special kernel-development mailing list on this subject only, where huge amounts of information are shared. It would lead us too far to discuss the kernel in detail. For now it suffices to know that the kernel is the most important file on the system.
When I was looking for an appropriate explanation on the concept of a shell, it gave me more trouble than I expected. All kinds of definitions are available, ranging from the simple comparison that “the shell is the steering wheel of the car”, to the vague definition in the Bash manual which says that “bash is an sh-compatible command language interpreter,” or an even more obscure expression, “a shell manages the interaction between the system and its users”. A shell is much more than that.
A shell can best be compared with a way of talking to the computer, a language. Most users do know that other language, the point-and-click language of the desktop. But in that language the computer is leading the conversation, while the user has the passive role of picking tasks from the ones presented. It is very difficult for a programmer to include all options and possible uses of a command in the GUI-format. Thus, GUIs are almost always less capable than the command or commands that form the backend.
The shell, on the other hand, is an advanced way of communicating with the system, because it allows for two-way conversation and taking initiative. Both partners in the communication are equal, so new ideas can be tested. The shell allows the user to handle a system in a very flexible way. An additional asset is that the shell allows for task automation.
Just like people know different languages and dialects, the computer knows different shell types:
The file /etc/shells gives an overview of known shells on a Linux system:
mia:~> cat /etc/shells /bin/bash /bin/sh /bin/tcsh /bin/csh
/bin/sh is usually a link to Bash, which will execute in Bourne shell compatible mode when called on this way.
Your default shell is set in the /etc/passwd file, like this line for user mia:
mia:L2NOfqdlPrHwE:504:504:Mia Maya:/home/mia:/bin/bash
To switch from one shell to another, just enter the name of the new shell in the active terminal. The system finds the directory where the name occurs using the PATH settings, and since a shell is an executable file (program), the current shell activates it and it gets executed. A new prompt is usually shown, because each shell has its typical appearance:
mia:~> tcsh [mia@post21 ~]$
If you don’t know which shell you are using, either check the line for your account in /etc/passwd or type the command
echo $SHELL
Your home directory is your default destination when connecting to the system. In most cases it is a subdirectory of /home, though this may vary. Your home directory may be located on the hard disk of a remote file server; in that case your home directory may be found in /nethome/your_user_name. In another case the system administrator may have opted for a less comprehensible layout and your home directory may be on /disk6/HU/07/jgillard.
Whatever the path to your home directory, you don’t have to worry too much about it. The correct path to your home directory is stored in the HOME environment variable, in case some program needs it. With the echo command you can display the content of this variable:
orlando:~> echo $HOME /nethome/orlando
You can do whatever you like in your home directory. You can put as many files in as many directories as you want, although the total amount of data and files is naturally limited because of the hardware and size of the partitions, and sometimes because the system administrator has applied a quota system. Limiting disk usage was common practice when hard disk space was still expensive. Nowadays, limits are almost exclusively applied in large environments. You can see for yourself if a limit is set using the quota command:
pierre@lamaison:/> quota -v Diskquotas for user pierre (uid 501): none
In case quotas have been set, you get a list of the limited partitions and their specific limitations. Exceeding the limits may be tolerated during a grace period with fewer or no restrictions at all. Detailed information can be found using the info quota or man quota commands.
Your home directory is indicated by a tilde (~), shorthand for /path_to_home/user_name. This same path is stored in the HOME variable, so you don’t have to do anything to activate it. A simple application: switch from /var/music/albums/arno/2001 to images in your home directory using one elegant command:
rom:/var/music/albums/arno/2001> cd ~/images rom:~/images> pwd /home/rom/images
Later in this chapter we will talk about the commands for managing files and directories in order to keep your home directory tidy.
As we mentioned before, most configuration files are stored in the /etc directory. Content can be viewed using the cat command, which sends text files to the standard output (usually your monitor). The syntax is straight forward:
cat file1 file2 … fileN
In this section we try to give an overview of the most common configuration files. This is certainly not a complete list. Adding extra packages may also add extra configuration files in /etc. When reading the configuration files, you will find that they are usually quite well commented and self-explanatory. Some files also have man pages which contain extra documentation, such as man group.
Table 3-3. Most common configuration files
| File | Information/service |
|---|---|
aliases |
Mail aliases file for use with the Sendmail and Postfix mail server. Running a mail server on each and every system has long been common use in the UNIX world, and almost every Linux distribution still comes with a Sendmail package. In this file local user names are matched with real names as they occur in E-mail addresses, or with other local addresses. |
apache |
Config files for the Apache web server. |
bashrc |
The system-wide configuration file for the Bourne Again SHell. Defines functions and aliases for all users. Other shells may have their own system-wide config files, like cshrc. |
crontab and the cron.* directories |
Configuration of tasks that need to be executed periodically - backups, updates of the system databases, cleaning of the system, rotating logs etc. |
default |
Default options for certain commands, such as useradd. |
filesystems |
Known file systems: ext3, vfat, iso9660 etc. |
fstab |
Lists partitions and their mount points. |
ftp* |
Configuration of the ftp-server: who can connect, what parts of the system are accessible etc. |
group |
Configuration file for user groups. Use the shadow utilities groupadd, groupmod and groupdel to edit this file. Edit manually only if you really know what you are doing. |
hosts |
A list of machines that can be contacted using the network, but without the need for a domain name service. This has nothing to do with the system’s network configuration, which is done in /etc/sysconfig. |
inittab |
Information for booting: mode, number of text consoles etc. |
issue |
Information about the distribution (release version and/or kernel info). |
ld.so.conf |
Locations of library files. |
lilo.conf, silo.conf, aboot.conf etc. |
Boot information for the LInux LOader, the system for booting that is now gradually being replaced with GRUB. |
logrotate.* |
Rotation of the logs, a system preventing the collection of huge amounts of log files. |
mail |
Directory containing instructions for the behavior of the mail server. |
modules.conf |
Configuration of modules that enable special features (drivers). |
motd |
Message Of The Day: Shown to everyone who connects to the system (in text mode), may be used by the system admin to announce system services/maintenance etc. |
mtab |
Currently mounted file systems. It is advised to never edit this file. |
nsswitch.conf |
Order in which to contact the name resolvers when a process demands resolving of a host name. |
pam.d |
Configuration of authentication modules. |
passwd |
Lists local users. Use the shadow utilities useradd, usermod and userdel to edit this file. Edit manually only when you really know what you are doing. |
printcap |
Outdated but still frequently used printer configuration file. Don’t edit this manually unless you really know what you are doing. |
profile |
System wide configuration of the shell environment: variables, default properties of new files, limitation of resources etc. |
rc* |
Directories defining active services for each run level. |
resolv.conf |
Order in which to contact DNS servers (Domain Name Servers only). |
sendmail.cf |
Main config file for the Sendmail server. |
services |
Connections accepted by this machine (open ports). |
sndconfig or sound |
Configuration of the sound card and sound events. |
ssh |
Directory containing the config files for secure shell client and server. |
sysconfig |
Directory containing the system configuration files: mouse, keyboard, network, desktop, system clock, power management etc. (specific to RedHat) |
X11 |
Settings for the graphical server, X. RedHat uses XFree, which is reflected in the name of the main configuration file, XFree86Config. Also contains the general directions for the window managers available on the system, for example gdm, fvwm, twm, etc. |
xinetd.* or inetd.conf |
Configuration files for Internet services that are run from the system’s (extended) Internet services daemon (servers that don’t run an independent daemon). |
Throughout this guide we will learn more about these files and study some of them in detail.
Prev: Orientation in the file system: The path
Home
Next: Orientation in the file system:The most common devices
Copyright (c) by the authors.
This section of the wiki is licensed under the terms of the GNU Free Documentation License.
See the LBook-licensing page for details.
Linux® is a registered trademark of Linus Torvalds.