如何在 Ubuntu 22.04 LTS 上安装 Nano 文本编辑器

2023年 7月 20日 40.0k 0

GNU nano 是一个使用命令行界面的类 Unix 计算系统或操作环境的文本编辑器。这是一个非常适合初学者的文本编辑器,这就是为什么它最受新手青睐。然而,尽管是一个简单的文本编辑器,它仍然可以很好地用于文本和源代码编辑。terminal-linux-logo-2

在 Ubuntu 22.04 LTS Jammy Jellyfish 上安装 Nano 文本编辑器

apt步骤 1. 首先,通过在终端中运行以下命令,确保所有系统包都是最新的。

sudo apt update
sudo apt upgrade
sudo apt install wget apt-transport-https gnupg2 software-properties-common

步骤 2. 在 Ubuntu 22.04 上安装 Nano 文本编辑器。

默认情况下,Nano 在 Ubuntu 22.04 基础存储库中可用。现在运行以下命令,将最新稳定版本的 Nano 安装到您的 Ubuntu 系统:

sudo apt install nano

验证安装的 Nano 版本:

nano --version

第 3 步。使用 Nano 文本编辑器。

在这一部分中,您将获得有关如何打开和关闭文件的提示。此外,一种搜索和替换文本的方法。然后,我们将向您展示一些可以在 Nano 文本内容编辑器中使用的编辑提示和不同的用户友好命令:

打开 Nano 和编辑某个文件的主要语法是:

nano sample-file.txt

要在文本中搜索,请按CTRL + W。插入您的值并按Enter。要继续搜索相同的文本字符串,请使用ALT + W。

我们编译了最有用的命令来帮助您更有效地使用 Nano 文本编辑器:

Command Explanation
CTRL + A Let’s you jump to the beginning of the line.
CTRL + E Let’s you jump to the end of the line.
CTRL + Y Scrolls page down.
CTRL + V Scrolls page up.
CTRL + G A Help window will pop out and show you all the available commands.
CTRL + O To save the file. Nano will ask you to edit or verify the desired file name.
CTRL + W Search for a specified phrase in your text. Press ALT + Wto search for the same phrase again.
CTRL + K It cuts the entire selected line to the cut buffer (similar to the clipboard).
CTRL + U To paste the text from the cut buffer into the selected line.
CTRL + J Justifies the current paragraph.
CTRL + C Shows the current cursor position in the text (line/column/character).
CTRL + R Opens a file and inserts it at the current cursor position.
CTRL + X To exit Nano text editor. It prompts a save request if you made any changes to the file.
CTRL + Replaces string or a regular expression.
CTRL + T Invokes the spell checker, if available.
CTRL + _ Let’s go to the specified line and column number.
ALT + A To select text. You can combine this command with CTRL + K to cut a specific part of the text to the cut buffer.

感谢您使用本教程在 Ubuntu 22.04 LTS Jammy Jellyfish 系统上安装 Nano 开源文本编辑器。如需更多帮助或有用信息,我们建议您查看Nano 官方网站。

相关文章

服务器端口转发,带你了解服务器端口转发
服务器开放端口,服务器开放端口的步骤
产品推荐:7月受欢迎AI容器镜像来了,有Qwen系列大模型镜像
如何使用 WinGet 下载 Microsoft Store 应用
百度搜索:蓝易云 – 熟悉ubuntu apt-get命令详解
百度搜索:蓝易云 – 域名解析成功但ping不通解决方案

发布评论