Contents
Abstract
This chapter starts with information about various software packages, the
virtual consoles, and the keyboard layout. We talk about software
components like bash
, cron
, and logrotate
, because they were changed or
enhanced during the last release cycles. Even if they are small or
considered of minor importance, users may want to change their default
behavior, because these components are often closely coupled with the
system. The chapter is finished by a section about language and
country-specific settings (I18N and L10N).
The programs bash
, cron
, logrotate
, locate
, ulimit
, and free
, and the file
resolv.conf
are very important for system administrators
and many users. Man pages and info pages are two useful sources of
information about commands, but both are not always available. GNU Emacs is
a popular and very configurable text editor.
Bash is the default system shell. When used as a login shell, it reads several initialization files. Bash processes them in the order they appear in this list:
/etc/profile
~/.profile
/etc/bash.bashrc
~/.bashrc
Make custom settings in ~/.profile
or
~/.bashrc
. To ensure the correct
processing of these files, it is necessary to copy the basic settings from
/etc/skel/.profile
or
/etc/skel/.bashrc
into the home directory
of the user. It is recommended to copy the settings from
/etc/skel
after an update. Execute the following
shell commands to prevent the loss of personal adjustments:
mv ~/.bashrc ~/.bashrc.old cp /etc/skel/.bashrc ~/.bashrc mv ~/.profile ~/.profile.old cp /etc/skel/.profile ~/.profile
Then copy personal adjustments back from the
*.old
files.
If you want to run commands regularly and automatically in the background at predefined times, cron is the tool to use. cron is driven by specially formatted time tables. Some of of them come with the system and users can write their own tables if needed.
The cron tables are located in
/var/spool/cron/tabs
. /etc/crontab
serves as a systemwide cron table. Enter the username to run
the command directly after the time table and before the command. In Example 10.1, “Entry in /etc/crontab”, root
is entered. Package-specific tables,
located in /etc/cron.d
, have the same format. See the
cron man page (man cron).
You cannot edit /etc/crontab
by calling the command
crontab -e. This file must be loaded directly into an
editor, modified, then saved.
A number of packages install shell scripts to the directories
/etc/cron.hourly
, /etc/cron.daily
,
/etc/cron.weekly
, and
/etc/cron.monthly
, whose execution is controlled by
/usr/lib/cron/run-crons
.
/usr/lib/cron/run-crons
is run every 15 minutes
from the main table (/etc/crontab
). This guarantees
that processes that may have been neglected can be run at the proper time.
To run the hourly
,
daily
, or other periodic maintenance scripts at
custom times, remove the time stamp files regularly using
/etc/crontab
entries (see Example 10.2, “/etc/crontab: Remove Time Stamp Files”, which removes the
hourly
one before every full hour, the
daily
one once a day at 2:14 a.m., etc.).
Example 10.2. /etc/crontab: Remove Time Stamp Files
59 * * * * root rm -f /var/spool/cron/lastrun/cron.hourly 14 2 * * * root rm -f /var/spool/cron/lastrun/cron.daily 29 2 * * 6 root rm -f /var/spool/cron/lastrun/cron.weekly 44 2 1 * * root rm -f /var/spool/cron/lastrun/cron.monthly
Alternatively, set DAILY_TIME
in
/etc/sysconfig/cron
to the time at which
cron.daily
should start. The setting of
MAX_NOT_RUN
ensures that the daily jobs get triggered
to run, even if the user did not turn on the computer at the specified
DAILY_TIME
for a longer period of time. The maximum value
of MAX_NOT_RUN
is 14 days.
The daily system maintenance jobs are distributed to various scripts
for reasons of clarity. They are contained in the package aaa_base
.
/etc/cron.daily
contains, for example, the components
suse.de-backup-rpmdb
,
suse.de-clean-tmp
, or
suse.de-cron-local
.
There are a number of system services (daemons) that,
along with the kernel itself, regularly record the system status and
specific events to log files. This way, the administrator can regularly check
the status of the system at a certain point in time, recognize errors or
faulty functions, and troubleshoot them with pinpoint precision. These log
files are normally stored in /var/log
as specified by
FHS and grow on a daily basis. The logrotate
package
helps control the growth of these files.
Configure logrotate with the file
/etc/logrotate.conf
. In particular, the
include
specification primarily configures the
additional files to read. Programs that produce log files install individual
configuration files in /etc/logrotate.d
. For example,
such files ship with the packages, e.g. apache2
(/etc/logrotate.d/apache2
) and
syslogd
(/etc/logrotate.d/syslog
).
Example 10.3. Example for /etc/logrotate.conf
# see "man logrotate" for details # rotate log files weekly weekly # keep 4 weeks worth of backlogs rotate 4 # create new (empty) log files after rotating old ones create # uncomment this if you want your log files compressed #compress # RPM packages drop log rotation information into this directory include /etc/logrotate.d # no packages own lastlog or wtmp - we'll rotate them here #/var/log/wtmp { # monthly # create 0664 root utmp # rotate 1 #} # system-specific logs may be also be configured here.
logrotate is controlled through
cron and is called daily by
/etc/cron.daily/logrotate
.
locate, a command for quickly
finding files, is not included
in the standard scope of installed software. If desired,
install the package findutils-locate
.
The updatedb process is
started automatically every night or about 15 minutes
after booting the system.
With the ulimit (user limits) command, it is possible to set limits for the use of system resources and to have these displayed. ulimit is especially useful for limiting the memory available for applications. With this, an application can be prevented from using too much memory on its own, which could bring the system to a standstill.
ulimit can be used with various options. To limit memory usage, use the options listed in Table 10.1, “ulimit: Setting Resources for the User”.
Table 10.1. ulimit: Setting Resources for the User
| The maximum resident set size |
| The maximum amount of virtual memory available to the shell |
| The maximum size of the stack |
| The maximum size of core files created |
| All current limits are reported |
Systemwide entries can be made in
/etc/profile
. There, enable creation of core
files, needed by programmers for debugging. A
normal user cannot increase the values specified in
/etc/profile
by the system administrator, but can
make special entries in ~/.bashrc
.
Example 10.4. ulimit: Settings in ~/.bashrc
# Limits maximum resident set size (physical memory): ulimit -m 98304 # Limits of virtual memory: ulimit -v 98304
Memory amounts must be specified in KB. For more detailed information, see man bash.
![]() | Important |
---|---|
Not all shells support ulimit directives. PAM (for
instance, |
The free command is somewhat misleading if your goal is
to find out how much RAM is currently being used. That information
can be found in /proc/meminfo
. These days, users with
access to a modern operating system, such as Linux, should not really
need to worry much about memory. The concept of available
RAM dates back to before the days of unified memory
management. The slogan free memory is bad memory
applies well to Linux. As a result, Linux has always made the effort to
balance out caches without actually allowing free or unused memory.
Basically, the kernel does not have direct knowledge of any applications or user data. Instead, it manages applications and user data in a page cache. If memory runs short, parts of it are written to the swap partition or to files, from which they can initially be read with the help of the mmap command (see man mmap).
The kernel also contains other caches, such as the
slab cache, where the caches used for network access
are stored. This may explain differences between the counters in
/proc/meminfo
. Most, but not all of them, can be
accessed via /proc/slabinfo
.
Domain name resolution is handled through the file
/etc/resolv.conf
. Refer to Chapter 16, The Domain Name System.
This file is updated by the script
/sbin/modify_resolvconf
exclusively, with no other
program having permission to modify /etc/resolv.conf
directly. Enforcing this rule is the only way to guarantee that the system's
network configuration and the relevant files are kept in a consistent state.
For some GNU applications (such as tar), the man pages are no longer
maintained. For these commands, use the --help
option to
get a quick overview of the info pages, which provide more in-depth
instructions. Info
is GNU's hypertext system. Read an introduction to this
system by entering info info
. Info pages
can be viewed with Emacs by entering emacs -f
info
or directly in a console with
info. You can also use tkinfo, xinfo, or the
help system to view info pages.
GNU Emacs is a complex work environment. The following sections cover the configuration files processed when GNU Emacs is started. More information is available at http://www.gnu.org/software/emacs/.
On start-up, Emacs reads several files containing
the settings of the user, system administrator, and distributor for
customization or preconfiguration. The initialization file
~/.emacs
is installed to
the home directories of the individual users from
/etc/skel
. .emacs
, in turn, reads
the file /etc/skel/.gnu-emacs
. To
customize the program, copy .gnu-emacs
to the home directory (with cp /etc/skel/.gnu-emacs
~/.gnu-emacs) and make the desired settings
there.
.gnu-emacs
defines the file
~/.gnu-emacs-custom
as custom-file
.
If users make settings with the customize
options in
Emacs, the settings are saved to ~/.gnu-emacs-custom
.
With openSUSE, the emacs
package
installs the file site-start.el
in the directory
/usr/share/emacs/site-lisp
. The file
site-start.el
is loaded before the
initialization file ~/.emacs
. Among other things,
site-start.el
ensures that special configuration files
distributed with Emacs add-on packages, such as
psgml
, are loaded automatically.
Configuration files of this type are located in
/usr/share/emacs/site-lisp
, too, and always begin with
suse-start-
. The local system administrator can specify
systemwide settings in default.el
.
More information about these files is available in the Emacs info file under Init File: info:/emacs/InitFile. Information about how to disable loading these files (if necessary) is also provided at this location.
The components of Emacs are divided into several packages:
The base package emacs
.
emacs-x11
(usually
installed): the program with X11
support.
emacs-nox
: the
program without X11 support.
emacs-info
: online
documentation in info format.
emacs-el
: the
uncompiled library files in Emacs Lisp. These are not required at
runtime.
Numerous add-on packages can be installed if needed:
emacs-auctex
(for LaTeX),
psgml
(for SGML and XML),
gnuserv
(for client and server
operation), and others.