Merge pull request #15085 from geekpi/translating

translated
This commit is contained in:
geekpi 2019-08-21 08:57:15 +08:00 committed by GitHub
commit 3291e26999
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 134 additions and 143 deletions

View File

@ -1,143 +0,0 @@
[#]: collector: (lujun9972)
[#]: translator: (geekpi)
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )
[#]: subject: (How To Change Linux Console Font Type And Size)
[#]: via: (https://www.ostechnix.com/how-to-change-linux-console-font-type-and-size/)
[#]: author: (sk https://www.ostechnix.com/author/sk/)
How To Change Linux Console Font Type And Size
======
It is quite easy to change the text font type and its size if you have graphical desktop environment. How would you do that in an Ubuntu headless server that doesnt have a graphical environment? No worries! This brief guide describes how to change Linux console font and size. This can be useful for those who dont like the default font type/size or who prefer different fonts in general.
### Change Linux Console Font Type And Size
Just in case you dont know yet, this is how a headless Ubuntu Linux server console looks like.
![][2]
Ubuntu Linux console
As far as I know, we can [**list the installed fonts**][3], but there is no option to change the font type or its size from Linux console as we do in the Terminal emulators in GUI desktop.
But that doesnt mean that we cant change it. We still can change the console fonts.
If youre using Debian, Ubuntu and other DEB-based systems, you can use **“console-setup”** configuration file for **setupcon** which is used to configure font and keyboard layout for the console. The standard location of the console-setup configuration file is **/etc/default/console- setup**.
Now, run the following command to setup font for your Linux console.
```
$ sudo dpkg-reconfigure console-setup
```
Choose the encoding to use on your Linux console. Just leave the default values, choose OK and hit ENTER to continue.
![][4]
Choose encoding to set on the console in Ubuntu
Next choose the character set that should be supported by the console font from the list. By default, it was the the last option i.e. **Guess optimal character set** in my system. Just leave it as default and hit ENTER key.
![][5]
Choose character set in Ubuntu
Next choose the font for your console and hit ENTER key. Here, I am choosing “TerminusBold”.
![][6]
Choose font for your Linux console
In this step, we choose the desired font size for our Linux console.
![][7]
Choose font size for your Linux console
After a few seconds, the selected font with size will applied for your Linux console.
This is how console fonts looked like in my Ubuntu 18.04 LTS server before changing the font type and size.
![][8]
This is after changing the font type and size.
![][9]
As you can see, the text size is much bigger, better and the font type is different that default one.
You can also directly edit **/etc/default/console-setup** file and set the font type and size as you wish. As per the following example, my Linux console font type is “Terminus Bold” and font size is 32.
```
ACTIVE_CONSOLES="/dev/tty[1-6]"
CHARMAP="UTF-8"
CODESET="guess"
FONTFACE="TerminusBold"
FONTSIZE="16x32"
```
* * *
**Suggested read:**
* [**How To Switch Between TTYs Without Using Function Keys In Linux**][10]
* * *
##### Display Console fonts
To show your console font, simply type:
```
$ showconsolefont
```
This command will show a table of glyphs or letters of a font.
![][11]
Show console fonts
If your Linux distribution does not have “console-setup”, you can get it from [**here**][12].
On Linux distributions that uses **Systemd** , you can change the console font by editing **“/etc/vconsole.conf”** file.
Here is an example configuration for German keyboard.
```
$ vi /etc/vconsole.conf
KEYMAP=de-latin1
FONT=Lat2-Terminus16
```
Hope you find this useful.
--------------------------------------------------------------------------------
via: https://www.ostechnix.com/how-to-change-linux-console-font-type-and-size/
作者:[sk][a]
选题:[lujun9972][b]
译者:[译者ID](https://github.com/译者ID)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://www.ostechnix.com/author/sk/
[b]: https://github.com/lujun9972
[2]: https://www.ostechnix.com/wp-content/uploads/2019/08/Ubuntu-Linux-console.png
[3]: https://www.ostechnix.com/find-installed-fonts-commandline-linux/
[4]: https://www.ostechnix.com/wp-content/uploads/2019/08/Choose-encoding-to-set-on-the-console.png
[5]: https://www.ostechnix.com/wp-content/uploads/2019/08/Choose-character-set-in-Ubuntu.png
[6]: https://www.ostechnix.com/wp-content/uploads/2019/08/Choose-font-for-Linux-console.png
[7]: https://www.ostechnix.com/wp-content/uploads/2019/08/Choose-font-size-for-Linux-console.png
[8]: https://www.ostechnix.com/wp-content/uploads/2019/08/Linux-console-tty-ubuntu-1.png
[9]: https://www.ostechnix.com/wp-content/uploads/2019/08/Ubuntu-Linux-TTY-console.png
[10]: https://www.ostechnix.com/how-to-switch-between-ttys-without-using-function-keys-in-linux/
[11]: https://www.ostechnix.com/wp-content/uploads/2019/08/show-console-fonts.png
[12]: https://software.opensuse.org/package/console-setup

View File

@ -0,0 +1,134 @@
[#]: collector: (lujun9972)
[#]: translator: (geekpi)
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )
[#]: subject: (How To Change Linux Console Font Type And Size)
[#]: via: (https://www.ostechnix.com/how-to-change-linux-console-font-type-and-size/)
[#]: author: (sk https://www.ostechnix.com/author/sk/)
如何更改 Linux 控制台字体类型和大小
======
如果你有图形桌面环境,那么就很容易更改文本的字体以及大小。你如何在没有图形环境的 Ubuntu 无头服务器中做到?别担心!本指南介绍了如何更改 Linux 控制台的字体和大小。这对于那些不喜欢默认字体类型/大小或者喜欢不同字体的人来说非常有用。
### 更改 Linux 控制台字体类型和大小
如果你还不知道,这就是无头 Ubuntu Linux 服务器控制台的样子。
![][2]
Ubuntu Linux 控制台
据我所知,我们可以[**列出已安装的字体**][3],但是没有选项可以像在 Linux 桌面终端仿真器中那样更改 Linux 控制台字体类型或大小。
但这并不意味着我们无法改变它。我们仍然可以更改控制台字体。
如果你正在使用 Debian、Ubuntu 和其他基于 DEB 的系统,你可以使用 **“console-setup”** 配置文件来设置 **setupcon**,它用于配置控制台的字体和键盘布局。控制台设置的配置文件位于 **/etc/default/console-setup**。
现在,运行以下命令来设置 Linux 控制台的字体。
```
$ sudo dpkg-reconfigure console-setup
```
选择要在 Linux 控制台上使用的编码。只需保留默认值,选择 “OK” 并按回车继续。
![][4]
选择要在 Ubuntu 控制台上设置的编码
接下来,在列表中选择受支持的字符集。默认情况下,这是我系统中的最后一个选项,即 **Guess optimal character set**。只需保留默认值,然后按回车键。
![][5]
在 Ubuntu 中选择字符集
接下来选择控制台的字体,然后按回车键。我这里选择 “TerminusBold”。
![][6]
选择 Linux 控制台的字体
这里,我们为 Linux 控制台选择所需的字体大小。
![][7]
选择 Linux 控制台的字体大小
几秒钟后,所选的字体及大小将应用于你的 Linux 控制台。
这是在更改字体类型和大小之前,我的 Ubuntu 18.04 LTS 服务器中控制台字体的样子。
![][8]
这是更改之后。
![][9]
如你所见,文本更大、更好,字体类型不同于默认。
你也可以直接编辑 **/etc/default/console-setup**,并根据需要设置字体类型和大小。根据以下示例,我的 Linux 控制台字体类型为 “Terminus Bold”字体大小为 32。
```
ACTIVE_CONSOLES="/dev/tty[1-6]"
CHARMAP="UTF-8"
CODESET="guess"
FONTFACE="TerminusBold"
FONTSIZE="16x32"
```
##### 显示控制台字体
要显示你的控制台字体,只需输入:
```
$ showconsolefont
```
此命令将显示字体的字形或字母表。
![][11]
显示控制台字体
如果你的 Linux 发行版没有 “console-setup”你可以从[**这里**][12]获取它。
在使用 **Systemd** 的 Linux 发行版上,你可以通过编辑 **“/etc/vconsole.conf”** 来更改控制台字体。
以下是德语键盘的示例配置。
```
$ vi /etc/vconsole.conf
KEYMAP=de-latin1
FONT=Lat2-Terminus16
```
希望这篇文章对你有用!
--------------------------------------------------------------------------------
via: https://www.ostechnix.com/how-to-change-linux-console-font-type-and-size/
作者:[sk][a]
选题:[lujun9972][b]
译者:[geekpi](https://github.com/geekpi)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://www.ostechnix.com/author/sk/
[b]: https://github.com/lujun9972
[2]: https://www.ostechnix.com/wp-content/uploads/2019/08/Ubuntu-Linux-console.png
[3]: https://www.ostechnix.com/find-installed-fonts-commandline-linux/
[4]: https://www.ostechnix.com/wp-content/uploads/2019/08/Choose-encoding-to-set-on-the-console.png
[5]: https://www.ostechnix.com/wp-content/uploads/2019/08/Choose-character-set-in-Ubuntu.png
[6]: https://www.ostechnix.com/wp-content/uploads/2019/08/Choose-font-for-Linux-console.png
[7]: https://www.ostechnix.com/wp-content/uploads/2019/08/Choose-font-size-for-Linux-console.png
[8]: https://www.ostechnix.com/wp-content/uploads/2019/08/Linux-console-tty-ubuntu-1.png
[9]: https://www.ostechnix.com/wp-content/uploads/2019/08/Ubuntu-Linux-TTY-console.png
[10]: https://www.ostechnix.com/how-to-switch-between-ttys-without-using-function-keys-in-linux/
[11]: https://www.ostechnix.com/wp-content/uploads/2019/08/show-console-fonts.png
[12]: https://software.opensuse.org/package/console-setup