Introduction

  The system locale specifies the language settings of system services and user interfaces. The keyboard layout settings control the layout used on the text console and graphical user interfaces.

  These settings can be made by modifying the /etc/locale.conf configuration file or by using the localectl utility. Also, you can use the graphical user interface to perform the task; for a description of this method, see Fedora Installation Guide.

1. Setting the System Locale

  System-wide locale settings are stored in the /etc/locale.conf file, which is read at early boot by the systemd daemon. The locale settings configured in /etc/locale.conf are inherited by every service or user, unless individual programs or individual users override them.

  The basic file format of /etc/locale.conf is a newline-separated list of variable assignments. For example, German locale with English messages in /etc/locale.conf looks as follows:

LANG=de_DE.UTF-8
LC_MESSAGES=C

  Here, the LC_MESSAGES option determines the locale used for diagnostic messages written to the standard error output. To further specify locale settings in /etc/locale.conf, you can use several other options, the most relevant are summarized in Table 1, “Options configurable in /etc/locale.conf”. See the locale(7) manual page for detailed information on these options. Note that the LC_ALL option, which represents all possible options, should not be configured in /etc/locale.conf.

  Table 1. Options configurable in /etc/locale.conf

Option Description
LANG Provides a default value for the system locale.
LC_COLLATE Changes the behavior of functions which compare strings in the local alphabet.
LC_CTYPE Changes the behavior of the character handling and classification functions and the multibyte character functions.
LC_NUMERIC Describes the way numbers are usually printed, with details such as decimal point versus decimal comma.
LC_TIME Changes the display of the current time, 24-hour versus 12-hour clock.
LC_MESSAGES Determines the locale used for diagnostic messages written to the standard error output.

1.1. Displaying the Current Status

  The localectl command can be used to query and change the system locale and keyboard layout settings. To show the current settings, use the status option:

localectl status

  Example 1. Displaying the Current Status

  The output of the previous command lists the currently set locale, keyboard layout configured for the console and for the X11 window system.

~]$ localectl status
   System Locale: LANG=en_US.UTF-8
       VC Keymap: us
      X11 Layout: n/a

1.2. Listing Available Locales

  To list all locales available for your system, type:

localectl list-locales

  Example 2. Listing Locales

  Imagine you want to select a specific English locale, but you are not sure if it is available on the system. You can check that by listing all English locales with the following command:

~]$ localectl list-locales | grep en_
en_AG
en_AG.utf8
en_AU
en_AU.iso88591
en_AU.utf8
en_BW
en_BW.iso88591
en_BW.utf8

output truncated

1.3. Setting the Locale

  To set the default system locale, use the following command as root:

localectl set-locale LANG=locale

  Replace locale with the locale name, found with the localectl list-locales command. The above syntax can also be used to configure parameters from Table 1, “Options configurable in /etc/locale.conf”.

  Example 3. Changing the Default Locale

  For example, if you want to set British English as your default locale, first find the name of this locale by using list-locales. Then, as root, type the command in the following form:

~]# localectl set-locale LANG=en_GB.utf8

2. Changing the Keyboard Layout

  The keyboard layout settings enable the user to control the layout used on the text console and graphical user interfaces.

2.1. Displaying the Current Settings

  As mentioned before, you can check your current keyboard layout configuration with the following command:

localectl status

  Example 4. Displaying the Keyboard Settings

  In the following output, you can see the keyboard layout configured for the virtual console and for the X11 window system.

~]$ localectl status
   System Locale: LANG=en_US.utf8
       VC Keymap: us
      X11 Layout: us

2.2. Listing Available Keymaps

  To list all available keyboard layouts that can be configured on your system, type:

localectl list-keymaps

  Example 5. Searching for a Particular Keymap

  You can use grep to search the output of the previous command for a specific keymap name. There are often multiple keymaps compatible with your currently set locale. For example, to find available Czech keyboard layouts, type:

~]$ localectl list-keymaps | grep cz
cz
cz-cp1250
cz-lat2
cz-lat2-prog
cz-qwerty
cz-us-qwertz
sunt5-cz-us
sunt5-us-cz

2.3. Setting the Keymap

  To set the default keyboard layout for your system, use the following command as root:

localectl set-keymap map

  Replace map with the name of the keymap taken from the output of the localectl list-keymaps command. Unless the --no-convert option is passed, the selected setting is also applied to the default keyboard mapping of the X11 window system, after converting it to the closest matching X11 keyboard mapping. This also applies in reverse, you can specify both keymaps with the following command as root:

localectl set-x11-keymap map

  If you want your X11 layout to differ from the console layout, use the --no-convert option.

localectl --no-convert set-x11-keymap map

  With this option, the X11 keymap is specified without changing the previous console layout setting.

  Example 6. Setting the X11 Keymap Separately

  Imagine you want to use German keyboard layout in the graphical interface, but for console operations you want to retain the US keymap. To do so, type as root:

~]# localectl --no-convert set-x11-keymap de

  Then you can verify if your setting was successful by checking the current status:

~]$ localectl status
   System Locale: LANG=de_DE.UTF-8
       VC Keymap: us
      X11 Layout: de

  Apart from keyboard layout (map), three other options can be specified:

localectl set-x11-keymap map model variant options

  Replace model with the keyboard model name, variant and options with keyboard variant and option components, which can be used to enhance the keyboard behavior. These options are not set by default. For more information on X11 Model, X11 Variant, and X11 Options see the kbd(4) man page.

3. Additional Resources

  For more information on how to configure the keyboard layout on Fedora, see the resources listed below:

  Installed Documentation

  • localectl(1) — The manual page for the localectl command line utility documents how to use this tool to configure the system locale and keyboard layout.
  • loadkeys(1) — The manual page for the loadkeys command provides more information on how to use this tool to change the keyboard layout in a virtual console.

Fedora 22中的Locale and Keyboard Configuration的更多相关文章

  1. Fedora 22中的日期和时间配置

    Introduction Modern operating systems distinguish between the following two types of clocks: A real- ...

  2. Fedora 22中的用户和用户组管理

    The control of users and groups is a core element of Fedora system administration. This chapter expl ...

  3. Fedora 22中的RPM软件包管理工具

    Introduction The RPM Package Manager (RPM) is an open packaging system that runs on Fedora as well a ...

  4. Fedora 22中的Services and Daemons

    Introduction Maintaining security on your system is extremely important, and one approach for this t ...

  5. Fedora 22中的DNF软件包管理工具

    Introduction DNF is the The Fedora Project package manager that is able to query for information abo ...

  6. 在Fedora 22下安装配置RealVNC Server 5.2.3的经验总结

    RealVNC是目前功能最全.性能最好的VNC商业软件套件,很多时候为了确保性能和功能的统一,还是大量地在使用RealVNC.最近在Fedora 22工作站上安装RealVNC Server 5.2. ...

  7. 在同一个硬盘上安装多个 Linux 发行版及 Fedora 21 、Fedora 22 初体验

    在同一个硬盘上安装多个 Linux 发行版 以前对多个 Linux 发行版的折腾主要是在虚拟机上完成.我的桌面电脑性能比较强大,玩玩虚拟机没啥问题,但是笔记本电脑就不行了.要在我的笔记本电脑上折腾多个 ...

  8. 如何在Fedora 22上面配置Apache的Docker容器

    在这篇文章中,我们将会学习关于Docker的一些知识,如何使用Docker部署Apache httpd服务,并且共享到Docker Hub上面去.首先,我们学习怎样拉取和使用Docker Hub里面的 ...

  9. fedora 23中配置nfs-server

    fedora 23中配置nfs-server */--> fedora 23中配置nfs-server Table of Contents 1. 产考资料 2. NFS配置文件 2.1. /et ...

随机推荐

  1. 理解CSS视觉格式化

    前面的话   CSS视觉格式化这个词可能比较陌生,但说起盒模型可能就恍然大悟了.实际上,盒模型只是CSS视觉格式化的一部分.视觉格式化分为块级和行内两种处理方式.理解视觉格式化,可以确定得到的效果是应 ...

  2. Java数据库连接技术——JDBC

    大家好,今天我们学习了Java如何连接数据库.之前学过.net语言的数据库操作,感觉就是一通百通,大同小异. JDBC是Java数据库连接技术的简称,提供连接各种常用数据库的能力. JDBC API ...

  3. 如何创建Vim Dotfile?

    Dotfile是电脑系统里的隐藏文件,它是专门给更高级的用户,如开发者.程序员或工程师使用的,让他们用来调整系统.如何创建Vim-Dotfile? 可以参考以下步骤: 1. 首先,你要检查一下.vim ...

  4. Android Ormlite 学习笔记1 -- 基础

    Ormlite 是一个开源Java数据实体映射框架.其中依赖2个核心类库: 1.ormlite-android-4.48.jar 2.ormlite-core-4.48.jar 新建项目,引用上面2个 ...

  5. jsp页面无法识别el表达式的解决方案

    今天在写一个springmvc的小demo时,碰到一个问题,在jsp页面中书写为${user.username}的表达式语言,在浏览器页面中仍然显示为${user.username},说明jsp根本不 ...

  6. await and async

    Most people have already heard about the new “async” and “await” functionality coming in Visual Stud ...

  7. isEmpty和isNull()区别

     isEmpty和isNull()区别一个NULL字符串一定是一个空串,一个空串未必是一个NULL字符串例如:QString().isNull():   //结果为trueQString().isEm ...

  8. iosselect:一个js picker项目,在H5中实现IOS的select下拉框效果

    具体文档和demo可以访问github:https://github.com/zhoushengmufc/iosselect 移动端浏览器对于select的展示样式是不一致的,ios下是类似原生的pi ...

  9. HA 高可用软件系统保养指南

    又过了一年 618,六月是公司一年一度的大促月,一般提前一个月各系统就会减少需求和功能的开发,转而更多去关注系统可用性.稳定性和管控性等方面的非功能需求.大促前的准备工作一般叫作「备战」,可以把线上运 ...

  10. 基于Node.js实现一个小小的爬虫

    以前一直听说有爬虫这种东西,稍微看了看资料,貌似不是太复杂. 正好了解过node.js,那就基于它来个简单的爬虫. 1.本次爬虫目标: 从拉钩招聘网站中找出“前端开发”这一类岗位的信息,并作相应页面分 ...