Contents
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 concludes with a section about language and
country-specific settings (I18N and L10N).
The programs bash
,
cron
,
logrotate
,
locate
,
ulimit
and
free
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 19.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, then modified and 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 19.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 19.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
Or you can 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 tasks 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 onto 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 19.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 available memory for applications. With this, an application can be prevented from co-opting too much of the system resources and slowing or even hanging up the operating system.
ulimit can be used with various options. To limit memory usage, use the options listed in Table 19.1, “ulimit: Setting Resources for the User”.
Table 19.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 19.4. ulimit: Settings in ~/.bashrc¶
# Limits maximum resident set size (physical memory): ulimit -m 98304 # Limits of virtual memory: ulimit -v 98304
Memory allocations must be specified in KB. For more detailed information, see man bash.
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 systems, 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 the differences between the counters in
/proc/meminfo
. Most, but not all, of them can be
accessed via /proc/slabinfo
.
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.
With man man_page
you
normally display a man page for instant reading. Now, if a man page with
the same name exists in different sections, man
prompts the user, the page from which section shall be made visible. The
user is then expected to type the section as the answer.
If you want to return to the previous behavior, set
MAN_POSIXLY_CORRECT=1
in a shell initialization file
such as ~/.bashrc
.
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 the loading of 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
(LaTeX),
psgml
(SGML and XML),
gnuserv
(client and server
operation) and others.
Linux is a multiuser and multitasking system. The advantages of these
features can be appreciated even on a stand-alone PC system. In text mode,
there are six virtual consoles available. Switch between them using
Alt+F1 through
Alt+F6. The
seventh console is reserved for X and the tenth console shows kernel
messages. More or fewer consoles can be assigned by modifying the file
/etc/inittab
.
To switch to a console from X without shutting it down, use Ctrl+Alt+F1 to Ctrl+Alt+F6. To return to X, press Alt+F7.
To standardize the keyboard mapping of programs, changes were made to the following files:
/etc/inputrc
/etc/X11/Xmodmap
/etc/skel/.emacs
/etc/skel/.gnu-emacs
/etc/skel/.vimrc
/etc/csh.cshrc
/etc/termcap
/usr/share/terminfo/x/xterm
/usr/share/X11/app-defaults/XTerm
/usr/share/emacs/VERSION
/site-lisp/term/*.el
These changes only affect applications that use terminfo entries or whose configuration files are changed directly (vi, emacs, etc.). Applications not shipped with the system should be adapted to these defaults.
Under X, the compose key (multikey) can be enabled as explained in
/etc/X11/Xmodmap
.
Further settings are possible using the X Keyboard Extension (XKB). This extension is also used by the desktop environments GNOME (gswitchit) and KDE (kxkb).
For More Information | |
---|---|
Information about XKB is available in the documents listed in
|
The system is, to a very large extent, internationalized and can be flexibly modified for local needs. In other words, internationalization (I18N) allows specific localizations (L10N). The abbreviations I18N and L10N are derived from the first and last letters of the words and, in between, the number of letters omitted.
Settings are made with LC_
variables defined in
the file /etc/sysconfig/language
. This refers not
only to native language support, but also to the
categories Messages (Language), Character
Set, Sort Order, Time and
Date, Numbers and
Money. Each of these categories can be defined
directly with its own variable or indirectly with a master variable in the
file language
(see the locale man
page).
RC_LC_MESSAGES
,
RC_LC_CTYPE
,
RC_LC_COLLATE
,
RC_LC_TIME
,
RC_LC_NUMERIC
,
RC_LC_MONETARY
These variables are passed to the shell without the
RC_
prefix and represent the listed
categories. The shell profiles concerned are listed below. The current
setting can be shown with the command locale.
RC_LC_ALL
This variable, if set, overwrites the values of the variables already mentioned.
RC_LANG
If none of the previous variables are set, this is the fallback. By
default, only RC_LANG
is set. This makes it
easier for users to enter their own values.
ROOT_USES_LANG
A yes
or no
variable. If set to
no
, root
always works in the POSIX environment.
The variables can be set with the YaST sysconfig editor (see Section 17.3.1, “Changing the System Configuration Using the YaST sysconfig Editor”). The value of such a variable contains the language code, country code, encoding and modifier. The individual components are connected by special characters:
LANG=<language>[[_<COUNTRY>].<Encoding>[@<Modifier>]]
You should always set the language and country codes together. Language settings follow the standard ISO 639 available at http://www.evertype.com/standards/iso639/iso639-en.html and http://www.loc.gov/standards/iso639-2/. Country codes are listed in ISO 3166 available at http://www.din.de/gremien/nas/nabd/iso3166ma/codlstp1/en_listp1.html.
It only makes sense to set values for which usable description files can
be found in /usr/lib/locale
. Additional description
files can be created from the files in
/usr/share/i18n
using the command
localedef. The description files are part of the
glibc-i18ndata
package. A description file for
en_US.UTF-8
(for English and United States) can be
created with:
localedef -i en_US -f UTF-8 en_US.UTF-8
LANG=en_US.UTF-8
This is the default setting if American English is selected during installation. If you selected another language, that language is enabled but still with UTF-8 as the character encoding.
LANG=en_US.ISO-8859-1
This sets the language to English, country to United States and the
character set to ISO-8859-1
. This character set
does not support the Euro sign, but it can be useful sometimes for
programs that have not been updated to support
UTF-8
. The string defining the charset
(ISO-8859-1
in this case) is then evaluated by
programs like Emacs.
LANG=en_IE@euro
The above example explicitly includes the Euro sign in a language setting. This setting is basically obsolete now, as UTF-8 also covers the Euro symbol. It is only useful if an application supports ISO-8859-15 and not UTF-8.
SuSEconfig reads the variables in
/etc/sysconfig/language
and writes the necessary
changes to /etc/SuSEconfig/profile
and
/etc/SuSEconfig/csh.cshrc
.
/etc/SuSEconfig/profile
is read or
sourced by /etc/profile
.
/etc/SuSEconfig/csh.cshrc
is sourced by
/etc/csh.cshrc
. This makes the settings available
systemwide.
Users can override the system defaults by editing their
~/.bashrc
accordingly. For instance, if you do not
want to use the systemwide en_US
for program messages,
include LC_MESSAGES=es_ES
so that messages are
displayed in Spanish instead.
~/.i18n
¶
If you are not satisfied with locale system defaults, change the settings
in ~/.i18n
according to the Bash scripting syntax.
Entries in ~/.i18n
override system defaults from
/etc/sysconfig/language
. Use the same variable names
but without the RC_
namespace prefixes. For example,
use LANG
instead of RC_LANG
:
LANG=cs_CZ.UTF-8 LC_COLLATE=C
Files in the category Messages are, as a rule, only
stored in the corresponding language directory (like
en
) to have a fallback. If you set
LANG
to en_US
and the message
file in /usr/share/locale/en_US/LC_MESSAGES
does not
exist, it falls back to
/usr/share/locale/en/LC_MESSAGES
.
A fallback chain can also be defined, for example, for Breton to French or for Galician to Spanish to Portuguese:
LANGUAGE="br_FR:fr_FR"
LANGUAGE="gl_ES:es_ES:pt_PT"
If desired, use the Norwegian variants Nynorsk and Bokmål instead (with
additional fallback to no
):
LANG="nn_NO"
LANGUAGE="nn_NO:nb_NO:no"
or
LANG="nb_NO"
LANGUAGE="nb_NO:nn_NO:no"
Note that in Norwegian, LC_TIME
is also treated
differently.
One problem that can arise is a separator used to delimit groups of
digits not being recognized properly. This occurs if
LANG
is set to only a two-letter language code
like de
, but the definition file glibc uses is located
in /usr/share/lib/de_DE/LC_NUMERIC
. Thus
LC_NUMERIC
must be set to
de_DE
to make the separator definition visible to the
system.
The GNU C Library Reference Manual, Chapter
“Locales and Internationalization”. It is included in
glibc-info
.
Markus Kuhn, UTF-8 and Unicode FAQ for Unix/Linux, currently at http://www.cl.cam.ac.uk/~mgk25/unicode.html.
Unicode-Howto, by Bruno Haible:
/usr/share/doc/howto/en/txt/Unicode-HOWTO.gz
(package howto
).