< Previous | Contents | Next >
3.2.3. The most important files and directories
3.2.3.1. The kernel
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.
3.2.3.2. The shell
3.2.3.2.1. What is a shell?
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.
3.2.3.2.2. Shell types
Just like people know different languages and dialects, the computer knows different shell types:
• sh or Bourne Shell: the original shell still used on UNIX systems and in UNIX related environments. This is the basic shell, a small program with few features. When in POSIX-compatible mode, bash will emulate this shell.
• bash or Bourne Again SHell: the standard GNU shell, intuitive and flexible. Probably most advisable for beginning users while being at the same time a powerful tool for the advanced and professional user. On Linux, bash is the standard shell for common users. This shell is a so-called superset of the Bourne shell, a set of add-ons and plug-ins. This means that the Bourne Again SHell is compatible with the Bourne shell: commands that work in sh, also work in bash. However, the reverse is not always the case. All examples and exercises in this book use bash.
• csh or C Shell: the syntax of this shell resembles that of the C programming language. Sometimes asked for by programmers.
• tcsh or Turbo C Shell: a superset of the common C Shell, enhancing user-friendliness and speed.
• ksh or the Korn shell: sometimes appreciated by people with a UNIX background. A superset of the Bourne shell; with standard configuration a nightmare for beginning users.
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
mia:~> cat /etc/shells
/bin/bash
/bin/sh
/bin/tcsh
/bin/csh
Fake Bourne shell
Note that /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 ~]$
mia:~> tcsh
[mia@post21 ~]$
3.2.3.2.3. Which shell am I using?
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
3.2.3.3. Your home directory
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
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
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.
No Quota?
If your system can not find the quota, then no limitation of file system usage is being applied.
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
rom:/var/music/albums/arno/2001> cd ~/images
rom:~/images> pwd