用 Ttyper 测试你在 Linux 终端的打字速度
打字 终端
![](/data/attachment/album/202105/18/092309xnzs2qgey3ss8cmq.jpg)


有几种方法可以测试和提高你的打字速度。你可以使用在线工具，在桌面上安装专门的应用，或者在 Linux 终端测试。


Linux 终端？是的。从 [浏览互联网](https://itsfoss.com/terminal-web-browsers/) 到 [玩游戏](https://itsfoss.com/best-command-line-games-linux/)，你可以在强大的 Linux 终端中做 [许多有趣的事情](https://itsfoss.com/funny-linux-commands/)。测试你的打字速度就是其中之一。


### Ttyper：基于终端的打字测试工具


[Ttyper](https://github.com/max-niederman/ttyper) 是一个用 [Rust](https://www.rust-lang.org/) 编写的工具，允许你练习打字。


它给出了一些最常见的英语单词的随机选择。打出的正确单词用绿色突出显示，错误的用红色突出显示，而且这是实时发生的。你可以按退格键纠正单词，但这将导致分数下降。


![](/data/attachment/album/202105/18/092315bzryrtzzpxep5cnt.png)


当你打完所有显示的单词后，你会得到你的打字速度（每分钟字数）、准确率和正确按键数的结果。如果你没有心情打完全部，你可以使用 `Ctrl+C` 退出 Ttyper。


![](/data/attachment/album/202105/18/092316b738pa12eeatud3d.png)


你可以在这个由开发者录制的 GIF 中看到 Ttyper 的操作。


![](/data/attachment/album/202105/18/092317zwjjioogoziutt8j.gif)


默认情况下，你有 50 个单词可以练习，但你可以用命令选项来扩大。你还可以使用一个自定义的文本文件，用它的内容来练习打字。




| 命令 | 内容 |
| --- | --- |
| `ttyper` | 200 个最常见的英语单词中的 50 个 |
| `ttyper -w 100` | 200 个最常见的英语单词中的 100 个 |
| `ttyper -w 100 -l english1000` | 1000 个最常见的英语单词中的 100 个 |
| `ttyper text.txt` | 内容来自用空格分隔的 `test.txt` |


Ttyper 也专注于开发者。它支持几种编程语言，如果你是一个程序员，你可以用它来测试和改进你在编码时的打字速度。


![](/data/attachment/album/202105/18/092318pyzy26a262y8yezg.png)


截至目前，支持 C、Csharp、Go、HTML、Java、JavaScript、Python、Ruby 和 Rust 语言。


你可以通过以下方式改变语言：



```
ttyper -l html

```

顺便说一下，“Ttyper” 中的双 “T” 不是一个打字错误。它是故意的，因为TTY（**T**ele**TY**pewriter）代表 [终端模拟器](https://itsfoss.com/linux-terminal-emulators/)，表明它是一个终端工具。


### 在 Linux 上安装 Ttyper


Ttyper 是用 Rust 构建的，你可以把它安装在任何支持 Rust 编程语言及其 [Cargo 软件包管理器](https://doc.rust-lang.org/cargo/index.html)的 Linux 发行版上。


Cargo 相当于 Python 中的 PIP。它有一个[中央仓库](https://crates.io/)，你可以用 Cargo 轻松地下载和安装 Rust 包和它的依赖项。


我将添加在基于 Ubuntu 的 Linux 发行版上安装 Cargo 的说明。你应该可以用你的[发行版的包管理器](https://itsfoss.com/package-manager/)来安装它。


请确保你在 Ubuntu 上启用了 universe 仓库。你可以用这个命令来安装 Cargo：



```
sudo apt install cargo

```

它将安装 Cargo 包管理器和 Rust 语言的 `rustc` 包。


当你的系统安装了 Cargo，就可以用这个命令来安装 Ttyper：



```
cargo install ttyper

```

这将在你的主目录下的 `.cargo/bin` 目录中添加一个可执行 Rust 文件。它将在软件包安装输出的最后显示。


![](/data/attachment/album/202105/18/092319e11grpv1vgdzez9d.png)


你可以切换到这个目录：



```
cd ~/.cargo/bin

```

并运行 `ttyper` 可执行文件：



```
./ttyper

```

当然，这不是很方便。这就是为什么你应该 [把这个目录添加到 PATH 变量中](https://itsfoss.com/add-directory-to-path-linux/)。如果你熟悉 Linux 的命令行，你可以很容易做到这一点。


不幸的是，我不能在这里给你确切的命令，因为你需要提供这个目录的绝对路径，而这个路径名称会根据你的用户名而不同。例如，对我来说，它是 `/home/abhishek/.cargo/bin`。这个绝对路径对你来说会有所不同。


我建议阅读 [绝对路径和相对路径](https://linuxhandbook.com/absolute-vs-relative-path/) 以了解更多关于这个问题的信息。


你可以通过删除二进制文件来卸载 Ttyper，或者用 Cargo 命令来卸载：



```
cargo uninstall ttyper

```

如果你喜欢这个灵巧的终端工具，[在 GitHub 上给它加星](https://github.com/max-niederman/ttyper) 以感谢开发者的努力。


正如我在本文开头提到的，你可以在终端做很多很酷的事情。如果你想给你的同事一个惊喜，也许你可以试试 [完全在 Linux 终端中制作幻灯片][12]。




---


via: <https://itsfoss.com/ttyper/>


作者：[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
There are several ways to test and improve your typing speed. You can use online tools, install dedicated applications on the desktop or test in the Linux terminal.

Linux terminal? That’s right. From [browsing internet](https://itsfoss.com/terminal-web-browsers/) to [playing games](https://itsfoss.com/best-command-line-games-linux/), you can do [so many fun things in the mighty Linux terminal](https://itsfoss.com/funny-linux-commands/). Testing your typing speed is one of them.

## Ttyper: Terminal-based typing test tool

[Ttyper](https://github.com/max-niederman/ttyper) is a tool written in [Rust](https://www.rust-lang.org/) that allows you to practice your touch typing.

It gives a random selection of some of the most common English words. The correct typed words are highlighted in green and the incorrect ones in red and this happens in real time. You can press backspace and correct the words but that will contribute to a reduced score.

![ttyper typing speed test linux](https://itsfoss.com/content/images/wordpress/2021/05/ttyper-typing-speed-test-linux-800x441.png)

When you finish typing all the displayed words, you get the result with your typing speed in words per minute, accuracy and number of correct keypresses. You can ** use Ctrl+C to exit** Ttyper if you are not in a mood for typing the entire section.

![ttyper typing test result](https://itsfoss.com/content/images/wordpress/2021/05/ttyper-typing-test-result-800x547.png)

You can see Ttyper in action in this GIF recorded by the developer.

![ttyper](https://itsfoss.com/content/images/wordpress/2021/05/ttyper-800x498.gif)

By default, you get 50 words to practice but you may expand that with command options. You can also use a custom text file and use its content to practice typing.

Command | Contents |
---|---|

ttyper | 50 of the 200 most common English words |

ttyper -w 100 | 100 of the 200 most common English words |

ttyper -w 100 -l english1000 | 100 of the 1000 most common English words |

ttyper text.txt | contents of test.txt split at whitespace |


Ttyper also focuses on developers. It supports several programming languages and if you are a programmer, you may use it to test and improve your typing while you code.

![ttyper typing test html](https://itsfoss.com/content/images/wordpress/2021/05/ttyper-typing-test-html-800x441.png)

As of now, C, Csharp, Go, HTML, Java, JavaScript, Python, Ruby and Rust languages are supported.

You may change the language in the following manner:

`ttyper -l html`


By the way, the double ‘T’ in ‘Ttyper’ is not a typo. It is deliberate as [TTY](https://itsfoss.com/what-is-tty-in-linux/) (**T**ele**TY**pewriter) represent the [terminal emulator](https://itsfoss.com/linux-terminal-emulators/), an indication that it is a terminal tool.

**Recommended Read:**

## Installing Ttyper on Linux

Ttyper is built with Rust and you can install it on any Linux distribution that has support for Rust programming language and its [Cargo package manager](https://doc.rust-lang.org/cargo/index.html).

Cargo is the Rust equivalent to Python’s PIP. There is a [central repository](https://crates.io/) and you can download and install the Rust packages along with its dependencies easily with Cargo.

I am going to add the [instructions for installing Rust and Cargo on Ubuntu-based Linux distributions](https://itsfoss.com/install-rust-cargo-ubuntu-linux/). You should be able to install it using your [distribution’s package manager](https://itsfoss.com/package-manager/).

Please make sure that you have universe repository enabled on Ubuntu. You can install Cargo with this command:

`sudo apt install cargo`


It will install Cargo package manager along with `rustc`

package for Rust language.

Once you have Cargo installed on your system, use it install Ttyper with this command:

`cargo install ttyper`


This will add an executable rust file in .cargo/bin directory under your home directory. It will be mentioned at the end of the output of the package installation.

![installing ttyper linux](https://itsfoss.com/content/images/wordpress/2021/05/installing-ttyper-linux-800x399.png)

You may switch to this directory:

`cd ~/.cargo/bin`


and run the ttyper executable:

`ttyper`


Of course, it’s not very convenient. This is why you should [add this directory to the PATH variable](https://itsfoss.com/add-directory-to-path-linux/). If you are familiar with the Linux command line, you can easily do that.

Unfortunately, I cannot give you the exact commands here because you need to provide the absolute PATH to this directory and that path name will differ based on your username. For example, for me, it is /home/abhishek/.cargo/bin. This absolute PATH will be different for you.

I advise reading about [absolute and relative path](https://linuxhandbook.com/absolute-vs-relative-path/) for more clarity on this topic.

You can uninstall Ttyper by removing the binary file or use Cargo command in this manner:

`cargo uninstall ttyper`


If you like this nifty terminal tool, [star it on GitHub](https://github.com/max-niederman/ttyper) to appreciate the developer’s effort.

As I mentioned at the beginning of this article, you can do a lot of cool stuff in the terminal. If you want to surprise your colleagues, maybe you can try [making presentation slides entirely in the Linux terminal](https://itsfoss.com/presentation-linux-terminal/).