在 Ubuntu 中更改键盘布局
键盘布局
![](/data/attachment/album/202312/05/160115uz3s3y093fak0za9.png)



> 
> 在 Ubuntu 中拥有多个键盘布局并在它们之间切换非常简单。下面就教你怎么做。
> 
> 
> 


当 [你安装Ubuntu](https://itsfoss.com/install-ubuntu/) 时，你可以选择键盘布局。你可能已经默认选择了美国英语布局，现在你想将其更改为英国英语、印度英语或你选择的任何其他键盘布局。


好在你可以在同一个 Ubuntu 系统中拥有多种键盘布局。这是相当方便的。


在本教程中，你将学习：


* 在 Ubuntu 桌面中添加新的键盘布局
* 在可用键盘布局之间切换
* 删除额外的键盘布局
* 改变键盘布局的命令行方法


### 步骤 1：添加新的键盘布局


要更改键盘布局，你需要先在系统上启用另一个键盘布局。


进入系统设置。按 Ubuntu 中的 `Super` 键（Windows 键）并搜索“Setting”。


![](/data/attachment/album/202312/05/160144injsdaa4qpdia2db.png)


在系统设置中，在左侧边栏中查找 <ruby> 键盘 <rt>  Keyboard </rt></ruby>。选择后，你应该会在 <ruby> 输入源 <rt>  Input Sources </rt></ruby> 下看到添加新键盘布局的选项。单击 “+” 号。


![Add new keyboard layout](/data/attachment/album/202312/05/160144vzmvu5bee570b3r5.png)


你将看到一些键盘选项，但如果单击三个点，你可以获得更多选项。你可以在此处滚动浏览或搜索。


![There are more keyboard layouts available](/data/attachment/album/202312/05/160145c9m9x5rxpx7kagx6.png)


单击你想要的键盘布局。请记住，所选的键盘布局可能有子布局。


例如，当我单击\*\*英语（印度）**时，它会向我显示从丹麦到加纳等的一些英语键盘布局。在这里，我选择了**英语（印度，卢比）\*\*键盘。这是将要添加的键盘布局。


![](/data/attachment/album/202312/05/160145c3o2m5n35mywtmpm.png)


你将在“输入源”下看到新添加的键盘布局。


![](/data/attachment/album/202312/05/160146bipxixuooxcwpsab.png)


这与我之前在 [Ubuntu 中添加印地语键盘布局](https://itsfoss.com/type-indian-languages-ubuntu/) 时使用的方法相同。


### 步骤 2：切换键盘布局


这样，你就成功添加了另一个键盘布局。但它没有被使用。你必须在可用的输入源之间切换。


有两种方法可以做到这一点。


#### 方法 1：同时使用 Super+Space 键


切换键盘布局的更快方法是 [使用键盘快捷键](https://itsfoss.com/ubuntu-shortcuts/) ，同时按 `Super` 键（Windows 键）和空格键。它将立即显示所有启用的键盘布局。


![](/data/attachment/album/202312/05/160146k4epkq6ske2s97ci.png)


你可以在按住 `Super` 键的同时多次按空格键在可用选项之间移动。


#### 方法 2：使用鼠标切换键盘布局


记住所有这些键盘快捷键并不容易，这是可以理解的。


当你在系统上启用多个键盘布局时，你会注意到键盘布局名称显示在面板的右上角。单击它，你将看到在布局之间切换的选项或查看所选的键盘布局。


![Switch between keyboard layouts](/data/attachment/album/202312/05/160146m4rr20zd06vbu2t9.png)


### 额外提示：删除额外的键盘布局


不喜欢系统中的多个键盘布局？ 不用担心。你可以轻松删除它们。


如你之前所见，再次进入键盘设置。单击你选择的键盘旁边的三个垂直点符号。你应该在这里看到删除选项。


![](/data/attachment/album/202312/05/160147dizpzbbld2bp3ifz.png)


### 使用命令行更改键盘布局（不推荐）


如果你是桌面用户，我强烈推荐上面讨论的图形方法。


如果你在服务器上并且必须使用其他键盘布局，则可以选择命令行。


现在，有多种方法可以更改 Linux 中的键盘布局。但对于 Ubuntu，我更喜欢 [dpkg](https://wiki.debian.org/dpkg) 方式。



```
sudo dpkg-reconfigure keyboard-configuration

```

输入你的密码，你将在终端中看到：


![](/data/attachment/album/202312/05/160147onnoyqnwzwkqkqwb.png)


要在此 TUI（终端用户界面）中导航，请使用箭头键在可用选项之间移动。**使用 `Tab` 键转至 “OK” 或 “Cancel” 选项**。当你位于其中之一时，请按回车键确认你的选择。


选择你选择的国家/地区，然后你可以选择键盘布局。


![](/data/attachment/album/202312/05/160147mi3vskd3vk9mwybk.png)


添加附加键盘后，系统会要求你分配键盘快捷键以在它们之间进行切换。


![](/data/attachment/album/202312/05/160148zv4fmf0i80m8o0es.png)


你也可以将新键盘布局设置为系统中的默认布局和唯一布局。不过，如果你在不相似的语言之间执行此操作，这可能会存在风险。我的意思是，如果你使用英语美国键盘（物理）并将布局切换为匈牙利语，则你将无法使用所有按键。


之后你会看到几个屏幕。


如果你对新的键盘布局不满意，可以再次键入相同的命令，然后重新配置布局。


*（题图：MJ/f03362cf-72d0-4003-b334-44c533e113a0）*




---


via: <https://itsfoss.com/ubuntu-change-keyboard/>


作者：[Abhishek Prakash](https://itsfoss.com/author/abhishek/) 选题：[lujun9972](https://github.com/lujun9972) 译者：[geekpi](https://github.com/geekpi) 校对：[wxy](https://github.com/wxy)


本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译，[Linux中国](https://linux.cn/) 荣誉推出


OK
![Warp Terminal](/assets/images/warp-terminal.webp)


![Warp Terminal](/assets/images/warp-terminal.webp)

When [you install Ubuntu](https://itsfoss.com/install-ubuntu/), you get to choose the keyboard. You may have gone with the default choice of English US and now you want to change it to English UK or India or any other keyboard of your choice.

The good thing is that you can have multiple keyboard layouts in the same Ubuntu system. This is quite convenient.

In this tutorial, you'll learn to:

- Add new keyboard layouts in Ubuntu desktop
- Switch between the available keyboards
- Remove Additional keyboards
- Command line method of changing keyboard layout

## Step 1: Add new keyboard layout

To change the keyboard layout, you need to have another keyboard layout enabled on your system first.

Go to system settings. Press the [Super key](https://itsfoss.com/super-key/) in Ubuntu (Windows symboled key) and search settings.

![Start System Settings in Ubuntu](https://itsfoss.com/content/images/2023/11/start-system-settings-ubuntu-1.png)

In the system settings, look for Keyboard in the left sidebar. Once you select that, you should see the option of adding a new keyboard under the **Input Sources **section. Click the + sign.

![Adding new keyboard layout in Ubuntu](https://itsfoss.com/content/images/2023/11/adding-new-keyboard-layout-ubuntu-1.png)

You'll be presented with a few keyboard options but you can get a lot more if you click on the three dots. You can scroll through or search by typing the in here.

![](https://itsfoss.com/content/images/2023/11/adding-keyboard-layout-1-1.png)

![](https://itsfoss.com/content/images/2023/11/more-keyboard-layouts.png)

There are more keyboard layouts available

Click on your desired keyboard. Keep in mind that the selected keyboard layout may have sub-layouts.

For example, when I click on **English (India)** it shows me a number of English keys from Denmark to Ghana or what not. In here, I chose the **English (India, with rupee)** keyboard. This is the keyboard layout that will be added.

![Adding the new keyboard layout in Ubuntu](https://itsfoss.com/content/images/2023/11/new-keyboard-layout-added-ubuntu-1.png)

You'll see the newly added keyboard layout under the Input Sources section.

![Multiple keyboards available in Ubuntu](https://itsfoss.com/content/images/2023/11/multiple-keyboards-ubuntu.png)

This is the same method I used for adding a [Hindi keyboard in Ubuntu earlier](https://itsfoss.com/type-indian-languages-ubuntu/).

## Step 2: Switching keyboards

So, you have successfully added another keyboard. But it is not in use. You have to switch between the available input sources.

There are two ways of doing it.

### Method 1: Use Super+Space keys together

The quicker method for switching the keyboards to [use keyboard shortcuts in Ubuntu](https://itsfoss.com/ubuntu-shortcuts/). Press the Super key (Windows key) and Space together. It will momentarily show all the enabled keyboard layouts.

![Switching between keyboard layouts using shortcuts](https://itsfoss.com/content/images/2023/11/switch-keyboard-layout-using-keyboard-shortcut-in-ubuntu.png)

You can press Space key multiple times while holding the Super key to move between the available options.

### Method 2: Use mouse to switch keyboards

It's not easy to remember all these keyboard shortcuts and that's understandable.

When you have more than one keyboards enabled on the system, you'll notice that the keyboard name is being displayed in the top right corner of the panel. Click on it and you'll see the option to switch between the layouts or see the selected keyboard layouts.

![Switching keyboard layouts](https://itsfoss.com/content/images/2023/11/switching-keyboard-layout-ubuntu-1.png)

## Bonus Tip: Remove additional keyboard

Not liking multiple keyboards in your system? No worries. You can easily remove them.

Go to the keyboard settings once again as you saw previously. Click on the three vertical dots symbol next to the keyboard of your choice. You should see the remove option here.

![Remove additional keyboard layout](https://itsfoss.com/content/images/2023/11/remove-additional-keyboard-layout-ubuntu-1.png)

## Using command line for changing keyboard layout (not recommended)

If you are a desktop user, I strongly recommend the graphical method discussed above.

If you are on a server and you must use some other keyboard layout, you could opt for the command line.

Now, there are multiple ways to change the keyboard layout in Linux. But for Ubuntu, I prefer the [dpkg](https://wiki.debian.org/dpkg) way.

`sudo dpkg-reconfigure keyboard-configuration`


Enter your password and you shall see this in your terminal:

![Change keyboard layout in the command line](https://itsfoss.com/content/images/2023/11/changing-keyboard-layout-ubuntu-command-line.png)

To navigate in this TUI (terminal user interface), use the arrow keys to move between the available options. **Use the tab key to go to the <OK> or <Cancel> options**. When you are at one of them, press enter to confirm your choice.

Go with the country of your choice and then you'll have the option to choose the keyboard layout.

![](https://itsfoss.com/content/images/2023/11/adding-keyboard-ubuntu-command-line-1.png)

![](https://itsfoss.com/content/images/2023/11/adding-keyboard-ubuntu-command-line-2.png)

When you have added the additional keyboard, you'll be asked to assign a keyboard shortcut to switch between them.

![](https://itsfoss.com/content/images/2023/11/keyboard-switch-option.png)

You may also go and make the new keyboard the default and the only layout in the system. Though this could be risky if you do it between languages that are not similar. I mean if you use English US keyboard (physical) and you switch the layout to Hungarian, you won't have all the keys available.

You'll be seeing several screens afterward.

If you are not happy with the new keyboard layout, you can type the same command again and then reconfigure the layout.