每个 Linux 用户都应该知道的 31 条命令
Linux 命令
![](/data/attachment/album/202211/24/184845y5i7757o708odem7.png)


哪些是**最基本**的 Linux 的命令？


经常有读者问我这个问题，我一直试图避免回答这个问题。


为什么呢？我不知道 Linux 命令吗？不是的。这不是原因。而是因为很难对它们进行分类。对我来说必不可少的东西对你来说可能并不重要。


但我想这适用于所有的东西，我们网站上的每一个这样的推荐应用程序列表也都是这样。


这就是为什么我最终放弃了，并创建了这个基本但**重要的** Linux 命令列表，它应该对作为 Linux 用户的你有所帮助。这更多的是针对 Ubuntu 这样的桌面用户，但如果你把 Ubuntu 作为服务器使用，它们也应该对你有所帮助。


### Linux 的基本命令


我在这里列出的每个命令都有多个选项和多种用途。如果我尝试给出每个命令的最常见的例子，它将很容易变成一本超过一万字的口袋书。


我不会详述这些命令中的任何一个。我将列出每个命令的目的及其基本语法。你可以从这些命令的链接教程中阅读更多关于使用这些命令的信息。


在你开始阅读列表之前推荐阅读：


* [Linux 中路径的概念](https://linuxhandbook.com/absolute-vs-relative-path/)
* [文件权限的概念](https://linuxhandbook.com/linux-file-permissions/)
* [了解 Linux 终端的行话](https://itsfoss.com/basic-terminal-tips-ubuntu/)


还有一件事。我在这里更多地使用了**文件夹**这个术语，而不是**目录**。


[在 Linux 中文件夹被称为目录](https://itsfoss.com/folder-directory-linux/)，有些人可能不喜欢这样。然而，我相信对于初学者来说，这更容易掌握。


#### 1、ls 命令：列出一个文件夹的内容


这是一个新的 Linux 用户最先学会的几个命令之一。这个命令可以让你看到当前文件夹里有哪些文件和文件夹。



```
ls

```

你可以使用长列表选项 `ls -l` 来查看细节，如文件大小、权限、修改时间等。如果你想，你可以对这些选项进行排序和控制。



```
ls -l

```

![ls 命令](/data/attachment/album/202211/24/184927ap7zq2ltx83kplk7.png)


推荐阅读：



> 
> **[ls 命令示例](https://linuxhandbook.com/ls-command/)**
> 
> 
> 


#### 2、cd 命令：改变目录


默认情况下，你从你的主目录下开始。你经常需要改变目录并移动到另一个目录。


例如，你下载了一个 deb 文件或脚本。现在你想运行它。你可以通过提供完整的路径从你现在的工作目录运行它，但是切换到下载的位置会让事情更简单。


`cd` 命令代表“<ruby> 改变目录 <rt>  change directory </rt></ruby>”，你可以改变你的位置，移动到另一个目录。


![cd 命令示例](/data/attachment/album/202211/24/184927wdf3mdfvzgz36f9t.png)


在这一点上，我强烈建议阅读关于 Linux 中路径的概念，这样在 Linux 命令行中浏览目录时，事情就容易理解了。


推荐阅读：



> 
> **[cd 命令示例](https://linuxhandbook.com/cd-command-examples/)**
> 
> 
> 


#### 3、cat 命令：读取一个文本文件


如果你想在 Linux 中快速查看一个文本文件的内容，`cat` 是你需要使用的命令。它在屏幕上显示内容。



```
cat filename

```

![cat 命令示例](/data/attachment/album/202211/24/184927vm22yx8u8shu2zad.png)


你也可以使用 `cat` 命令来创建新的文件或给现有文件添加更多的文本。


推荐阅读：



> 
> **[cat 命令的例子](https://linuxhandbook.com/cat-command/)**
> 
> 
> 


#### 4、less 命令：读取一个大的文本文件


`cat` 命令对于查看小的文本文件已经足够了。但是，如果你有一个有数百行的巨大文本文件，我不建议使用 `cat`。它将用所有的文本淹没你的屏幕，而你将很难处理它。


这就是 `less` 命令有用的地方。当你用 `less` 打开一个文件时，它会分页打开文件。你可以向上/向下滚动，寻找文本等等。


![用 less 命令阅读大文件](/data/attachment/album/202211/24/184928ntessiqmzeaa947c.png)


一旦你读完了文件，你可以按 `Q` 键退出 `less` 视图。你会注意到，屏幕上什么都没有显示。你的屏幕是干净的。


推荐阅读：



> 
> **[less 命令示例](https://linuxhandbook.com/less-command/)**
> 
> 
> 


#### 5、touch 命令：创建新文件


在 Linux 终端中，有多种创建新文件的方法。你在上面看到的 `cat` 命令也可以创建新文件。


然而，我更喜欢用 `touch` 命令来实现这一目的。



```
touch new_file_name

```

![touch command ubuntu](/data/attachment/album/202211/24/184928a4ll1ff8z9wr1for.png)


如果你对现有的文件使用它，它们的时间戳会被修改。


推荐阅读：



> 
> **[touch 命令示例](https://linuxhandbook.com/touch-command/)**
> 
> 
> 


#### 6、mkdir 命令：创建新的文件夹


虽然没有创建新文件的特定命令，但有一个专门的命令用于创建新的文件夹（或目录，我们在 Linux 中称之为“目录”）。



```
mkdir new_dir

```

![mkdir 命令示例](/data/attachment/album/202211/24/184928pbylrprcxblnxu01.png)


推荐阅读：



> 
> **[mkdir 命令示例](https://linuxhandbook.com/mkdir-command/)**
> 
> 
> 


#### 7、cp 命令：复制文件和文件夹


在命令行中复制文件和文件夹也是你会遇到的常见任务之一。`cp` 命令是“<ruby> 复制 <rt>  Copy </rt></ruby>”的简称，用于这一目的。


想象一下，你必须修改一个配置文件。一个聪明的做法是用另一个名字复制该文件。这样一来，你就有了一个文件的备份。



```
cp existing_file.txt existing_file.back

```

你也可以使用同样的 `cp` 命令来复制目录。为此，你必须指定递归选项 `-r`。



```
cp -r dir another_location

```

![cp 命令示例](/data/attachment/album/202211/24/184929forrbbr1d6obo4rr.png)


推荐阅读：



> 
> **[cp 命令示例](https://linuxhandbook.com/cp-command/)**
> 
> 
> 


#### 8、mv 命令：剪贴或重命名文件和文件夹


`mv` 命令是 “<ruby> 移动 <rt>  Move </rt></ruby>” 的意思。当你把一个文件复制到另一个地方时，它仍然保留在原来的地方。


`mv` 命令将文件和文件夹移动到另一个位置。你可以把它看作是一个剪切-粘贴的操作。



```
mv file.txt /another/location

```

你也可以使用 `mv` 命令来重命名文件。



```
mv file.txt new_file.txt

```

同样的 `mv` 命令也可以移动或重命名文件夹，不需要任何特殊的选项。


![mv 命令示例](/data/attachment/album/202211/24/184929ptltrztit3vvottc.png)


推荐阅读：



> 
> **[mv 命令示例](https://linuxhandbook.com/mv-command/)**
> 
> 
> 


#### 9、rm 命令：删除文件和文件夹


要在 Linux 终端中删除文件，你可以使用 `rm`（“<ruby> 删除 <rt>  Remove </rt></ruby>”的缩写）命令。



```
rm filename

```

在命令行中删除文件后，没有撤销选项。这就是为什么你在删除文件时要非常小心。如果你害怕删除错误的文件，可以使用选项 `-i` 的交互式模式，它给你一个额外的提示来确认操作。



```
rm -i filename

```

使用递归选项 `-r`，你也可以使用相同的 `rm` 命令来删除文件夹。


![rm 命令示例](/data/attachment/album/202211/24/184929yzhatcgebga2c6kb.png)


推荐阅读：



> 
> **[rm 命令示例](https://linuxhandbook.com/remove-files-directories/)**
> 
> 
> 


#### 10、nano 命令：编辑文件


迟早有一天，你会被要求对一个文件的内容进行修改。想象一下，你必须改变 SSH、Grub 或其他一些应用程序的配置文件。


有一些 [基于命令行的](https://itsfoss.com/command-line-text-editors-linux/) 文本编辑器可以达到这个目的。Ubuntu 预装了 Nano 编辑器，它比 Vim、Emacs 等更容易使用。


**如果你好奇它们有什么不同**，请阅读我们的 [Nano vs. Vim 对比](https://itsfoss.com/vim-vs-nano/) 文章。


更容易使用并不意味着和基于 GUI 的文本编辑器一样舒适。你将不得不使用键盘快捷键来移动、修改、保存和退出文件。


要用 `nano` 打开一个新的、未命名的文件，请使用：



```
nano

```

要在 nano 中编辑一个现有的文件，请使用：



```
nano filename

```

在这两种情况下，你都应该看到一个类似这样的界面。


![nano 命令示例](/data/attachment/album/202211/24/184930yadncah3czi3p3i2.png)


要保存（或放弃修改）并退出编辑器界面，请使用 `Ctrl+x` 键。


请参考我之前创建的 [nano 初学者指南](https://itsfoss.com/nano-editor-guide/) 来适应它。


#### 11、clear 命令：清除终端屏幕


Nano 感觉很复杂，对吗？让我来分享一个简单的命令。


`clear` 命令可以清除终端。就是这样。



```
clear

```

你为什么需要这样做呢？嗯，如果你的终端屏幕充斥着随机的东西，而你想做一些新的事情。清理终端就像清理黑板或在你的笔记本上打开一个新页。


#### 12、ps 命令：检查和管理进程


`ps` 命令是用来管理你系统上运行的进程的。每个进程都有一个相关的 ID，称为 PID，它可以用于各种目的，例如 [终止一个进程](https://itsfoss.com/how-to-find-the-process-id-of-a-program-and-kill-it-quick-tip/)。



```
~$ ps
    pid tty time cmd
  15358 ?        00:00:00 bash
  15404 ? 00:00:00 ps

```

这里，


* `PID`：进程 ID
* `TTY`：与进程相关的控制终端（现在已经不那么重要了）
* `TIME`：总的 CPU 使用时间
* `CMD`：运行该进程的命令名称


但一个系统不可能只运行两到三个进程，不是吗？要查看所有用户运行的所有进程，请使用：



```
ps aux

```

这将给出一个庞大的进程列表和关于它们的更多细节。如果你运行这个命令，现在将是使用 `clear` 命令的绝佳时机。


![进程列表](/data/attachment/album/202211/24/185014jzb18h8l6hhbhnhj.jpg)


推荐阅读：



> 
> **[ps 命令示例](https://linuxhandbook.com/ps-command/)**
> 
> 
> 


#### 13、top 命令：系统监控


`ps` 命令给你提供了所有正在运行的进程，而 `top` 命令给你提供了进程和系统资源消耗的实时视图。



```
top

```

把它看作是 Linux 中任务管理器的终端版本。通过 `top` 命令，你会看到很多有趣的细节。


我主要使用 `top` 命令来检查哪个进程占用了太多的 CPU 或内存。如果你有兴趣做实验，还有 [更好的 top 替代品](https://itsfoss.com/linux-system-monitoring-tools/)。


![top 命令](/data/attachment/album/202211/24/184930vaiepi1rvipfz0kp.png)


要 [停止运行的 top 命令](https://itsfoss.com/stop-program-linux-terminal/)，请使用 `Ctrl+C` 键盘快捷键。


推荐阅读：



> 
> **[有效使用 top 命令作为任务管理器](https://linuxhandbook.com/top-command/)**
> 
> 
> 


#### 14、lsblk 命令： 列出磁盘和分区


`lsblk` 命令列出了你系统中所有的块设备。用非常简单（技术上不完全准确）的术语来说，它显示的是磁盘和分区。



```
~# lsblk
NAME    MAJ:MIN RM  SIZE RO TYPE MOUNTPOINTS
loop0     7:0    0 79.9M  1 loop /snap/lxd/22923
loop1     7:1    0  103M  1 loop /snap/lxd/23541
loop2     7:2    0 63.2M  1 loop /snap/core20/1623
loop3     7:3    0   48M  1 loop /snap/snapd/17336
loop4     7:4    0   48M  1 loop /snap/snapd/17029
loop6     7:6    0 63.2M  1 loop /snap/core20/1634
vda     252:0    0   25G  0 disk 
├─vda1  252:1    0 24.9G  0 part /
├─vda14 252:14   0    4M  0 part 
└─vda15 252:15   0  106M  0 part /boot/efi
vdb     252:16   0  466K  1 disk 
~#

```

#### 15、fdisk 命令：列出并管理磁盘和分区


另一个类似但更好的命令是 `fdisk` 命令。它可以让你操作磁盘的分区。这意味着你可以用这个命令创建新的分区，删除和调整现有分区的大小。


你还可以用它来列出系统中所有的块设备，包括 [回环设备](https://itsfoss.com/loop-device-linux/)。



```
sudo fdisk -l

```

如果你有许多分区、磁盘和回环设备（由 Snap 应用程序创建），输出结果可能是巨大的。我在这里展示的是输出的相关部分：



```
Disk /dev/vda: 25 GiB, 26843545600 bytes, 52428800 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: gpt
Disk identifier: 0B7C796D-51CD-4DD4-962A-7D94B31690E2

Device      Start      End  Sectors  Size Type
/dev/vda1  227328 52428766 52201439 24.9G Linux filesystem
/dev/vda14   2048    10239     8192    4M BIOS boot
/dev/vda15  10240   227327   217088  106M EFI System

```

#### 16、find 命令：搜索文件


即使作为一个桌面用户，你也会遇到在 Linux 命令行中搜索文件的情况。


`find` 命令是一个用于此目的的广泛而通用的命令。它有 50 多个选项，而你可能永远不会需要所有的选项。


下面是一个 `find` 命令的例子，它将给你提供当前目录中所有以 `.txt` 扩展名结尾的文件。



```
find . -type f -name "*.txt"

```

其他常见的例子包括按大小、修改时间等查找文件。你可以 [将 find 与 exec](https://linuxhandbook.com/find-exec-command/) 或 [xargs](https://linuxhandbook.com/xargs-command/) 结合起来，对 `find` 命令的结果采取行动。例如，你可以寻找所有的 `.txt` 文件并选择删除它们。


推荐阅读：



> 
> **[find 命令示例](https://linuxhandbook.com/find-command-examples/)**
> 
> 
> 


#### 17、grep 命令：在文件内容中搜索


`find` 命令根据文件的名称和类型来搜索文件。如果你想根据文件的内容进行搜索，你可以使用 `grep`命令。


因此，与其寻找所有以 `.txt` 结尾的文件，不如用 `grep` 寻找所有包含文本 `foss` 的文件。



```
grep -ri search_term

```

![grep 命令示例](/data/attachment/album/202211/24/184930zn3l5clzc59andxw.png)


想学习更多吗？这里有一些更多的 [grep 命令示例](https://linuxhandbook.com/grep-command-examples/)。方便的 [grep 速查表](https://linuxhandbook.com/grep-command-cheatsheet/) 应该可以帮助你。


#### 18、kill 命令：终止进程


暴力不是答案......它是解决方案。


开个玩笑！


如果你有一个行为不端的进程，占用了太多的系统资源，你可以 [找到它，然后终止](https://itsfoss.com/how-to-find-the-process-id-of-a-program-and-kill-it-quick-tip/) 它，[使用 kill 命令](https://linuxhandbook.com/kill-process/) 就行。



```
sudo kill -9 process_ID_or_Name

```

正如你在上面的命令中看到的，你需要知道进程 ID（PID）或进程名称来终止它。你可以使用 `ps` 或 `top` 命令来获得 PID或确切的进程名称。



```
ps aux | grep -i “name of your desired program”

```

你注意到 `grep` 命令的使用了吗？你已经在利用这个列表中提到的命令了。


![find kill process](/data/attachment/album/202211/24/184930xtti493m9tapdiit.png)


我不知道你怎么想的，但是当我寻找流氓进程来终止时，我觉得自己就像 [《飓风营救》中的连姆·尼森](https://www.imdb.com/title/tt0936501/?ref_=tt_urv)。


![Taken meme find you kill you](/data/attachment/album/202211/24/184931y4brb4dwwardpmjs.jpg)


#### 19、history 命令：回头看看你过去运行了哪些命令


比如，你在几天前使用了一个特定的 Linux 命令。现在你需要再次运行它，但你不能正确地想起它。


你可以按上下方向键。


这对许多 Linux 用户来说是一个熟悉的场景：这就是 `history` 命令的作用。


在 Ubuntu 中，你的 Shell 会保存你所运行的命令的历史。在终端输入 `history`，你会看到你过去运行的命令的历史。


![history 命令](/data/attachment/album/202211/24/184931gze06705t3uoq6h3.png)


你可以选择从历史记录中运行一个条目，使用其编号，像这样。



```
!number

```

但即使是历史记录也可能是巨大的，所以（再次）使用 `grep` 命令来过滤你的搜索词。



```
~$ history | grep aux
 1915  ps aux
 1952  ps aux | grep -i spotify
 1955  ps -aux | grep -i calculator
 1957  ps -aux | grep -i calculator
 1959  ps -aux | grep -i calculator
 1970  history | grep aux

```

还有一种方法可以进入命令历史并进行搜索。按 `Ctrl+R`，然后输入搜索词。


推荐阅读：



> 
> **[history 命令示例](https://linuxhandbook.com/history-command/)**
> 
> 
> 


#### 20、chmod 命令：改变文件权限


我强烈建议在这个阶段阅读有关 [Linux 文件权限](https://linuxhandbook.com/linux-file-permissions/)。这将有助于你更好地理解，而不是盲目地运行 [chmod 命令](https://linuxhandbook.com/chmod-command/)。


`chmod`（“<ruby> 改变模式 <rt>  change mode </rt></ruby>”）命令是用来改变文件的权限的。


这个命令最常见的用途是当你想让一个文件可执行时。有一个Shell脚本？像这样让它可执行：



```
chmod u+x file-executable

```

还有更多的使用情况，使 `chmod`成为 Ubuntu 用户必须知道的命令。


**有趣的事实**：`chmod 777` 命令为所有用户提供了所有的权限。这代表了我们的座右铭是 “让每个人都能获得知识”。


#### 21、lshw 命令：获取硬件细节


在 Linux 中，有大量的命令行 [工具可以用来获取硬件细节](https://itsfoss.com/hardinfo/) 和其他系统信息。


可能预装在 Ubuntu 上的是 `lshw`（“<ruby> 列出硬件 <rt>  list hardware </rt></ruby>”的缩写）。


现在，默认情况下，它显示了大量关于所有硬件组件的详细信息，相信我，这不是很容易理解。



```
lshw

```

你可能会感到在这里使用 `grep` 的诱惑，但没有必要这样做。`lshw` 的输出被分成几类，你可以用它来显示一类硬件的细节。


[想知道你的网络适配器的制造商](https://itsfoss.com/find-network-adapter-ubuntu-linux/)？使用这个：



```
lshw -C network

```

![lshw 命令示例](/data/attachment/album/202211/24/184931kxczmcplnmcnlcci.png)


#### 22、sudo 命令：以 root 权限运行命令


你一定注意到，我在之前讨论的一些命令中使用了 `sudo` 作为前缀。


默认情况下，在 Ubuntu 中，`sudo` 的配置方式是，它允许你（默认的管理用户）以 root 权限运行任何命令。


你被要求输入一个密码，而且是你的用户账户密码。当你输入密码时，屏幕上没有任何显示。新用户对此感到困惑，但这是 UNIX/Linux 的预期行为。你输入密码并按回车键。


![使用 sudo 的例子](/data/attachment/album/202211/24/184932gj1gpjdjjgpn3bdb.png)


推荐阅读：



> 
> **[Ubuntu 中的 root 用户](https://itsfoss.com/root-user-ubuntu/)**
> 
> 
> 


#### 23、apt 命令： 安装、删除和管理 .deb 包


在 Ubuntu 中，`apt` 命令被用来管理软件包。你必须和 `sudo` 一起使用它，因为这些是管理任务。


要安装一个软件包，请使用：



```
sudo apt install package_name

```

要删除一个安装软件，请使用：



```
sudo apt remove package_name

```

要一次性用所有可升级的软件包更新你的 Ubuntu 系统：



```
sudo apt update && sudo apt upgrade

```

[apt update 和 upgrade 的区别](https://itsfoss.com/apt-update-vs-upgrade/) 是：`update` 会刷新软件包的缓存，而 `upgrade` 则是实际安装更新。


`apt` 命令还有很多内容。你可以阅读 [这个详细的 apt 命令指南](https://itsfoss.com/apt-command-guide/)。


#### 24、add-apt-repository 命令：添加和删除 PPA


好吧，这个命令已经不像十年前那么流行了。你仍然会在这里和那里遇到 [add-apt-repository 命令](https://itsfoss.com/add-apt-repository-command-not-found/)。它是用来管理你系统中的 PPA（非官方的、用户生成的软件库）。


在跟随网络上的教程时，你可能会遇到由三行组成的安装说明：



```
sudo add-apt-repository ppa:dr-akulavich/lighttable
sudo apt update
sudo apt install lighttable-installer

```

第一个命令是添加 PPA（外部资源库）。你已经熟悉了下面两条，它们用于更新软件包缓存和安装你刚刚添加的 PPA 仓库提供的软件。


要删除一个 PPA，你应该首先删除你从它那里安装的软件，然后像这样删除它：



```
sudo add-apt-repository -r ppa:dr-akulavich/lighttable

```

我有一篇 [关于 PPA 的完整指南](https://itsfoss.com/ppa-guide/)，可以了解关于这个主题的更多细节。


#### 25、snap 命令：安装、删除和管理 Snap 包


到目前为止，你知道 apt 软件包和它们的管理。然而，Ubuntu 也使用并积极推荐使用其 Snap 打包格式。


学习一些基本的 `snap` 命令将帮助你有效地管理这些软件包。


要找到一个软件包，请使用：



```
snap find search_term

```

要安装一个软件包，请使用：



```
sudo snap install package_name

```

要列出已安装的 Snap 应用程序：



```
snap list

```

要删除一个已安装的 Snap 应用程序，请使用：



```
sudo snap remove package_name

```

#### 26、ip 命令：检查 IP 地址和其他信息


`ip` 命令可以让你 [检查你的 IP 地址](https://itsfoss.com/check-ip-address-ubuntu/)。你还可以查看和操作路由、网络设备等。



```
ip a

```

![ip 地址检查](/data/attachment/album/202211/24/184932mm0onlyn9lzyleuz.png)


#### 27、ping 命令：检查远程系统是否可达


`ping` 是另一个你应该知道的 [Linux 网络命令](https://itsfoss.com/basic-linux-networking-commands/)。要检查一个远程系统是否可用，把它的 IP 地址给 `ping` 命令：



```
ping ip_address

```

你也可以用它来检查一个网站是否关闭，尽管现在它不是很准确。


![ping command ubuntu](/data/attachment/album/202211/24/184932v00mtlomitaiq8mr.png)


使用 `Ctrl+C` 来停止运行的 `ping` 命令。


推荐阅读：



> 
> **[ping 命令示例](https://linuxhandbook.com/ping-command/)**
> 
> 
> 


#### 28、ssh 命令：连接到远程系统


我对把 `ssh` 添加到必须知道的 Linux 命令列表中持怀疑态度。许多桌面用户可能不需要它。SSH 被用于从你的终端连接到其他 Linux系统。



```
ssh user@address_of_remote_system

```

当然，你需要知道远程系统的用户和密码。


如果你有云服务器或家庭设置，其中有其他 Linux 系统，你可以用它从你的主系统连接到它们。


#### 29、scp 命令：在远程系统之间复制文件


既然我在列表中包括了 `ssh`，那么包括一些 [通过 SSH 连接在远程系统之间传输文件的命令](https://linuxhandbook.com/transfer-files-ssh/) 才是公平的。


`scp` 命令的工作原理与你之前看到的 `cp` 命令差不多。


下面是一个例子，它把文件从远程系统上的用户的主目录复制到你本地登录系统的当前目录。



```
scp user@remote_address:/home/username/filename .

```

推荐阅读：



> 
> **[scp 命令示例](https://linuxhandbook.com/scp-command/)**
> 
> 
> 


#### 30、exit 命令：关闭终端


Linux 的基本命令列表就要结束了。那么让我们来谈谈退出终端的问题。这很简单。只要输入



```
exit

```

如果你正在使用另一个用户或 Shell，你就会从那里注销。


你也可以使用 `Ctrl+D` 键来退出终端。


#### 31、shutdown 命令：关闭或重启系统


好了。如果你还没有退出终端，让我分享一个最后的命令。


从命令行中 [关闭你的系统](https://learnubuntu.com/shutdown-ubuntu/) 怎么样？


[使用 shutdown 命令](https://linuxhandbook.com/linux-shutdown-command/) 来达到这个目的：



```
shutdown

```

上述命令 [安排在一分钟内关机](https://itsfoss.com/schedule-shutdown-ubuntu/)。你可以用以下方法让它立即关闭：



```
shutdown -now

```

你也可以使用同样的关机命令来 [重启你的 Ubuntu 系统](https://learnubuntu.com/restart-ubuntu/)。



```
shutdown -r now

```

#### 更多：man 命令：详细了解命令


还有一个，这也是最后一个，我保证。所有的 Linux 系统都有一个命令的手册。它被称为手册页，你可以通过以下方式访问已安装命令的手册页：



```
man command_name

```

[了解手册页](https://itsfoss.com/linux-man-page-guide/) 对于新用户来说，可能会让人不知所措，但它却很方便。它为你提供了一个命令的通用语法和所有选项的描述。


当你对使用一个命令没有把握时，可以先查看它的手册页，然后再在网上搜索它。


### 总是有更多……


**这只是大约 30 个命令。而且这还不到 Linux 命令的20%**。我还没有涉及很多网络命令。我甚至没有涉及用户管理命令。


我在写这篇文章时，考虑到了普通的 Ubuntu 桌面用户。这些是你更可能使用的命令。从长远来看，掌握一些这方面的知识会很有帮助。


除此以外，学习是没有止境的。即使是最老练的 Linux 用户也会不断发现和学习新东西。


考虑到你对学习 Linux 命令感兴趣，让我推荐一些 [好的 Linux书籍](https://itsfoss.com/best-linux-books/) 和资源。


* [Linux 如何工作](https://nostarch.com/howlinuxworks3)：解释了 Linux 如何工作，而不是命令。
* William Shotts 的《[Linux 命令行](https://linuxcommand.org/tlcl.php)》：可以合法地免费下载 PDF 格式的文件。
* Daniel J Barrett 的《[Linux口袋指南](https://www.oreilly.com/library/view/linux-pocket-guide/9780596806347/)》：将 Linux 命令分为不同的类别，并通过小例子进行简单的解释。
* [快速学习 Linux](https://linuxhandbook.gumroad.com/l/mEsrwA)：完全专注于 Linux 命令，有适当的例子和练习。


除此之外，你还可以从 [Linux Journey](https://linuxjourney.com/) 和 [Linux Handbook](https://linuxhandbook.com/a-to-z-linux-commands/) 等网站学习。


**我知道你已经读了很久了**，但这还不到冰山一角。总有更多的东西需要学习，但也不是说如果你不知道所有的 Linux 命令，你就必须感到痛苦。


**没有人知道所有的东西。**


现在，轮到你了。你觉得这份 Linux 命令列表有帮助吗？


**如果你要在其中增加一些命令，会是什么？评论区是你的**。




---


via: <https://itsfoss.com/essential-ubuntu-commands/>


作者：[Abhishek Prakash](https://itsfoss.com/) 选题：[lkxed](https://github.com/lkxed) 译者：[wxy](https://github.com/wxy) 校对：[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)

What are the **essential Ubuntu commands**?

I have been asked this question several times by regular readers, and I have tried to avoid answering it.

Why? Don’t I know Ubuntu commands? Nope. That’s not the reason. It is because it is difficult to categorize them. What’s essential to me may not be essential to you.

But I guess that applies to everything and every such list of recommended applications on our portal.

That’s why I finally gave in and created this list of basic yet **essential Linux commands** that should be helpful to you as a Ubuntu user. This is more focused on desktop Ubuntu users, but if you use Ubuntu as a server, they should also help you. Debian and other Linux distribution users should also find it helpful.

## Essential Ubuntu Commands

Every command I list here has multiple options and several uses. If I try giving even the most common examples of each command, it will quickly turn into a pocketbook of more than 10,000 words.

I will not go into detail with any of these commands. I’ll list the purpose of each command with its basic syntax. You can read more about using these commands from their linked tutorials.

**Recommended reading before you start following the list:**

- Concept of
[path in Linux](https://linuxhandbook.com/absolute-vs-relative-path/) [Concept of file permission](https://linuxhandbook.com/linux-file-permissions/)- Knowing the
[terminal jargon](https://itsfoss.com/basic-terminal-tips-ubuntu/)

Another thing. I have used the term **folder** here more than the **directory**.

A [folder is called a directory in Linux](https://itsfoss.com/folder-directory-linux/), and puritans may not like this. However, I believe it is easier to grasp for beginners.

### 1. ls command: List the contents of a folder

This is among the first few commands a new Linux user learns. This command lets you see what files and folders are in your current folder.

`ls`


You can use the long listing option ls -l to see details like file size, permission, modified time, etc. You can sort and control these options if you want to.

`ls -l`


![ls command ubuntu](https://itsfoss.com/content/images/wordpress/2022/11/ls-command-ubuntu.png)

**Related Read**: [ls command examples](https://linuxhandbook.com/ls-command/)

### 2. cd command: Change the directory

By default, you start in your home directory. You’ll often require to [change the directory](https://itsfoss.com/change-directories/) and move to another one.

For example, you downloaded a deb file or script. Now you want to run it. You can do that from your present working directory by providing the full path but switching to that location makes things easier.

The [cd command](https://itsfoss.com/cd-command/) stands for **change directory; **with this, you can change your location and move to another directory.

![cd command examples](https://itsfoss.com/content/images/wordpress/2022/11/cd-command-examples.png)

At this point, I highly recommend reading about the concept of paths in Linux so that things are easy to understand while navigating through directories in the Linux command line.

**Recommended Read**: [cd command examples](https://linuxhandbook.com/cd-command-examples/)

### 3. cat command: Read a text file

If you quickly want to see the contents of a text file in Linux, **cat** is the command you use. It displays the contents on the screen.

`cat filename`


![cat command example](https://itsfoss.com/content/images/wordpress/2022/11/cat-command-example.png)

You can also use the cat command to create new files or add more text to existing files.

**Recommended Read**: [cat command examples](https://linuxhandbook.com/cat-command/)

### 4. less command: Read a large text file

The cat command is good enough for viewing small text files. But I won’t recommend using cat if you have a huge text file with hundreds of lines. It will flood your screen with all the text, and you will have difficulty with it.

This is where the less command comes into the picture. When you open a file with less, it opens the file in pages. You can scroll up/down, look for text, and more.

![reading large files with less command](https://itsfoss.com/content/images/wordpress/2022/11/reading-large-files-with-less-command.png)

Once you are done reading the file, you can **exit the less view by pressing the Q key**. You’ll notice that nothing is displayed on the screen. Your screen is clean.

**Suggested Read**: [less command examples](https://linuxhandbook.com/less-command/)

### 5. touch command: Create new files

There are multiple ways of creating new files in the Linux terminal. The cat command you saw above can also create new files.

However, I prefer the touch command for this purpose.

`touch new_file_name`


![touch command ubuntu](https://itsfoss.com/content/images/wordpress/2022/11/touch-command-ubuntu.png)

If you use it with existing files, their timestamps will be modified.

**Also Read**: [touch command examples](https://linuxhandbook.com/touch-command/)

### 6. mkdir command: Make new folders

While there is no specific command for creating new files, there is a dedicated command for making new folders (or directories, as we call them in Linux).

`mkdir new_dir`


![mkdir command example](https://itsfoss.com/content/images/wordpress/2022/11/mkdir-command-example.png)

**Explore More Here**: [mkdir command examples](https://linuxhandbook.com/mkdir-command/)

### 7. cp command: Copy files and folders

Copying files and folders in the command line is also one of the common tasks you will encounter. The cp command, short for copy, is used for this purpose.

Imagine that you have to modify a configuration file. A smart move will be to copy the file with another name. This way, you’ll have a backup of the file.

`cp existing_file.txt existing_file.back`


You can use the same cp command for copying directories as well. For that, you must specify the recursive option ** -r**:

`cp -r dir another_location`


![cp command example](https://itsfoss.com/content/images/wordpress/2022/11/cp-command-example.png)

**You May Also Read**: [cp command examples](https://linuxhandbook.com/cp-command/)

### 8. mv command: Cut-paste or rename files and folders

The mv command stands for ‘move’. When you copy a file to another location, it remains in its original place.

The mv command moves the files and folders to the other location. You can think of it as a cut-paste operation.

`mv file.txt /another/location`


You can use the mv command to rename the file as well.

`mv file.txt new_file.txt`


The same mv command also moves or renames folders without any special options.

![mv command example](https://itsfoss.com/content/images/wordpress/2022/11/mv-command-example.png)

**Recommended Read**: [mv command examples](https://linuxhandbook.com/mv-command/)

### 9. rm command: Remove files and folders

You use the rm (short for remove) command to delete files in the Linux terminal.

`rm filename`


There is no undo option after you delete files in the command line. This is why you should be extremely careful while deleting files. If you are afraid of deleting the wrong file, use the interactive mode with option -i, which gives you an additional prompt to confirm the action.

`rm -i filename`


With the recursive option -r, you can also use the same rm command to delete folders.

![rm command examples](https://itsfoss.com/content/images/wordpress/2022/11/rm-command-examples.png)

**Recommended Read**: [rm command examples](https://linuxhandbook.com/remove-files-directories/)

### 10. nano: Edit files

Sooner or later, you’ll be required to make changes to the contents of a file. Imagine that you have to change a configuration file of SSH, grub, or some other application.

There are [command line-based t](https://itsfoss.com/command-line-text-editors-linux/)ext editors for this purpose. Ubuntu comes with Nano editor preinstalled, and it is relatively easier to use than Vim, Emacs, etc.

**If you are curious** **about differences**, read our [Nano vs. Vim comparison](https://itsfoss.com/vim-vs-nano/) article.

Easier to use doesn’t mean the same comfort as a GUI-based text editor. You will have to use the keyboard shortcuts for moving around, making changes, saving, and exiting files.

To open a new, unnamed file with nano, use:

`nano`


To edit an existing file in Nano, use:

`nano filename`


In both cases, you should see an interface like this.

![nano command example](https://itsfoss.com/content/images/wordpress/2022/11/nano-command-example.png)

To save (or discard changes) and exit the editor interface, use the Ctrl+x keys.

Please refer to the [Nano beginner guide](https://itsfoss.com/nano-editor-guide/) I created earlier to get comfortable with it.

### 11. clear: Clear terminal screen

Nano feels like a complicated one, right? Let me share a simple command.

The clear command clears the terminal. That’s it.

`clear`


And why do you need to do that? Well, if your terminal screen is flooded with random stuff and you want to do something new. Cleaning the terminal is like cleaning the board or opening a new page in your notebook.

### 12. ps: Check and handle processes

The ps command is for handling the processes running on your system. Each process has an associated ID called PID, which can be used for various purposes, such as [terminating a process](https://itsfoss.com/how-to-find-the-process-id-of-a-program-and-kill-it-quick-tip/).

```
abhishek@itsfoss:~$ ps
PID TTY TIME CMD
15358 ? 00:00:00 bash
15404 ? 00:00:00 ps
```


Here,

**PID:**Process ID**TTY:**Controlling terminal associated with the process (Not that important these days)**TIME:**Total CPU usage time**CMD:**Name of command that runs the process

But a system cannot run just 2-3 processes, can it? To see all the processes running by all users, use:

`ps aux`


This will give a massive list of processes and more details about them. If you run this command, now will be an excellent time to use the **clear** command.

![list processes ubuntu](https://itsfoss.com/content/images/wordpress/2022/11/list-processes-ubuntu.webp)

**Recommended Read**: [ps command examples](https://linuxhandbook.com/ps-command/)

### 13. top: System monitor

While the ps command gives you all the running processes, the top command gives you a real-time view of the processes and the system resource consumption.

`top`


Consider it like the terminal variant of the task manager in Linux. You’ll see a lot of interesting details with the top command.

I primarily use the top command to check which process takes too much CPU or RAM. There are [better top alte](https://itsfoss.com/linux-system-monitoring-tools/)[r](https://itsfoss.com/linux-system-monitoring-tools/)[natives](https://itsfoss.com/linux-system-monitoring-tools/) if you are interested in experimenting.

![top command ubuntu](https://itsfoss.com/content/images/wordpress/2022/11/top-command-ubuntu.png)

To [stop the running top command](https://itsfoss.com/stop-program-linux-terminal/), use the **Ctrl+C** keyboard shortcut.

**Recommended Read**: [Using top command effectively as a task manager](https://linuxhandbook.com/top-command/)

### 14. lsblk: List disks and partitions

The **lsblk** command lists all the block devices on your system. In really simple (and not entirely technically accurate) terms, it displays the disks and partitions.

```
root@learnubuntu:~# lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINTS
loop0 7:0 0 79.9M 1 loop /snap/lxd/22923
loop1 7:1 0 103M 1 loop /snap/lxd/23541
loop2 7:2 0 63.2M 1 loop /snap/core20/1623
loop3 7:3 0 48M 1 loop /snap/snapd/17336
loop4 7:4 0 48M 1 loop /snap/snapd/17029
loop6 7:6 0 63.2M 1 loop /snap/core20/1634
vda 252:0 0 25G 0 disk
├─vda1 252:1 0 24.9G 0 part /
├─vda14 252:14 0 4M 0 part
└─vda15 252:15 0 106M 0 part /boot/efi
vdb 252:16 0 466K 1 disk
root@learnubuntu:~#
```


### 15. fdisk: List and manage disks and partitions

Another similar but better command is the **fdisk** command. It lets you manipulate the disk partitions. This means you can create new partitions and delete and resize existing ones with this command.

You can also use it to list all the block devices, including [loop devices](https://itsfoss.com/loop-device-linux/), on your system.

`sudo fdisk -l`


The output could be huge if you have many partitions, disks, and loop devices (created by snap applications). I am showing a relevant part of the output here:

```
Disk /dev/vda: 25 GiB, 26843545600 bytes, 52428800 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: gpt
Disk identifier: 0B7C796D-51CD-4DD4-962A-7D94B31690E2
Device Start End Sectors Size Type
/dev/vda1 227328 52428766 52201439 24.9G Linux filesystem
/dev/vda14 2048 10239 8192 4M BIOS boot
/dev/vda15 10240 227327 217088 106M EFI System
```


### 16. find: Search for files

Even as a desktop user, you’ll encounter cases where you may have to search for files in the Linux command line.

The find command is an extensive and versatile command for this purpose. It has more than fifty options, and you will probably never need all of them.

Here’s an example of the find command that will give you all the files that end with .**txt** extension in the current directory.

`find . -type f -name "*.txt"`


Other common examples include finding files by size, modified time, etc. You can [combine find with exec](https://linuxhandbook.com/find-exec-command/) or [xargs](https://linuxhandbook.com/xargs-command/) to take actions on the result of the find command. For example, you can look for all the .txt files and choose to delete them.

**Also Read:** [find command examples](https://linuxhandbook.com/find-command-examples/)

### 17. grep: Search in file content

The find command search for files based on their name and type. If you want to search based on the content of the files, you use the grep command.

So, instead of looking for all files ending with .txt, you look for all files containing the text ‘foss’ with grep.

`grep -ri search_term`


![grep command examples](https://itsfoss.com/content/images/wordpress/2022/11/grep-command-examples.png)

Want more? Here are some more [practical examples of the grep command](https://linuxhandbook.com/grep-command-examples/). The handy [grep cheat sheet](https://linuxhandbook.com/grep-command-cheatsheet/) should help you out.

### 18. kill: Terminate processes

Violence is not the answer … it’s the solution.

Just kidding!

If you have a misbehaving process that takes too many system resources, you can [find it and then terminate](https://itsfoss.com/how-to-find-the-process-id-of-a-program-and-kill-it-quick-tip/) it [using the kill command](https://linuxhandbook.com/kill-process/).

`sudo kill -9 process_ID_or_Name`


As you can see in the above command, you need to know the process ID (PID) or the name to terminate it. You can use the ps or the top command to get the PID or exact process name.

`ps aux | grep -i “name of your desired program”`


Did you notice the use of grep command? You are already utilizing the commands mentioned in this list.

![find kill process ubuntu](https://itsfoss.com/content/images/wordpress/2022/11/find-kill-process-ubuntu-800x264.png)

I don’t know about you, but I feel like [Liam Nesson in Taken](https://www.imdb.com/title/tt0936501/?ref_=tt_urv) when I look for rogue processes to terminate.

![taken meme find you kill you](https://itsfoss.com/content/images/wordpress/2022/11/taken-meme-find-you-kill-you.jpg)

### 19. history: Look back into what commands you ran in the past

So, you used a specific Linux command a few days ago. You need to rerun it, but you cannot recall it correctly.

You can press the up and down arrow keys.

That’s a familiar scenario for many Linux users; this is where the history command helps.

In Ubuntu, your shell keeps a history of the commands you run. Enter history in the terminal, and you should see a history of commands you ran in the past.

![history command ubuntu](https://itsfoss.com/content/images/wordpress/2022/11/history-command-ubuntu-800x534.png)

You can choose to run an entry from the history using its number like this:

`!number`


But even the history could be huge, so (again) use the grep command to filter your search term.

```
abhishek@itsfoss:~$ history | grep aux
1915 ps aux
1952 ps aux | grep -i spotify
1955 ps -aux | grep -i calculator
1957 ps -aux | grep -i calculator
1959 ps -aux | grep -i calculator
1970 history | grep aux
```


There is another way to access the command history and search it. Press **Ctrl+R** and then enter the search term.

**Recommended Read**: [history command examples](https://linuxhandbook.com/history-command/)

### 20. chmod: Change file permissions

I highly recommend reading about [Linux file permissions](https://linuxhandbook.com/linux-file-permissions/) at this stage. That will help you understand things better than just running the [chmod command](https://linuxhandbook.com/chmod-command/) blindly.

The chmod (change mode) command is used to change a file's permissions.

The most common use of this command is when you want to make a file executable. Got a shell script? Make it executable like this:

`chmod u+x file executable`


Many more use cases make chmod a must-know command for Ubuntu users.

**Fun fact**: The parent company of **It’s FOSS** is **chmod777 Media Tech**. chmod 777 command gives all the permissions to all the users. This represents our motto of ‘*knowledge access to everyone*‘.

### 21. lshw: Get the hardware details

There are tons of command line [tools to get the hardware details](https://itsfoss.com/hardinfo/) and other system information in Linux.

The one that probably comes preinstalled on Ubuntu is** lshw** (short for list hardware).

Now, by default, it displays a vast output with details about all the hardware components and trust me, that’s not very easy to understand.

`lshw`


You may feel the temptation of using grep here, but there is no need for that. The output of lshw is divided into classes and you can use that to show the details for a class of hardware.

Want to [know the manufacturer of your network adapters](https://itsfoss.com/find-network-adapter-ubuntu-linux/)? Use this:

`lshw -C network`


![lshw command examples](https://itsfoss.com/content/images/wordpress/2022/11/lshw-command-examples.png)

### 22. sudo: Run commands with root privileges

You must have noticed that I used sudo as a prefix for some commands I discussed previously.

By default, in Ubuntu, **sudo** is configured in a way that it allows you (to the default admin user) to run any command with root privileges.

You are asked to enter a password, and it’s your user account password. When you enter the password, nothing is displayed on the screen. New users get baffled by it, but it’s the expected behavior in UNIX/Linux. You type the password and press enter.

![using sudo example ubuntu](https://itsfoss.com/content/images/wordpress/2022/11/using-sudo-example-ubuntu.png)

More about [root user in Ubuntu here](https://itsfoss.com/root-user-ubuntu/).

### 23. apt: Install, remove and manage .deb packages

The** apt** command is used for managing packages in Ubuntu. You’ll have to use it with sudo as these are administrative tasks.

To install a package, use:

`sudo apt install package_name`


To delete an installed software, use:

`sudo apt remove package_name`


To update your Ubuntu system with all upgradable packages at once:

`sudo apt update && sudo apt upgrade`


The [difference between apt update and upgrade](https://itsfoss.com/apt-update-vs-upgrade/) is that an update refreshes the package cache and the upgrade actually installs the update.

There is a lot more to the apt command. You can read [this detailed apt command guide](https://itsfoss.com/apt-command-guide/).

### 24. add-apt-repository: Add, and remove PPAs

Alright! This one is not as popular as it was a decade ago. You’ll still come across the [add-apt-repository command](https://itsfoss.com/add-apt-repository-command-not-found/) here and there. It’s used to manage your system's PPA (unofficial, user-generated repositories).

While following tutorials on the web, you may come across installation instructions that are composed of three lines:

```
sudo add-apt-repository ppa:dr-akulavich/lighttable
sudo apt update
sudo apt install lighttable-installer
```


The first command is adding the PPA (external repository). You are already familiar with the following two, which are used to update the package cache and install software provided by the PPA repository you just added.

To delete a PPA, you should first delete the software you installed from it and then remove it like this:

`sudo add-apt-repository -r ppa:dr-akulavich/lighttable`


I have a [complete guide on PPA](https://itsfoss.com/ppa-guide/) for more details on this topic.

### 25. snap: Install, remove and manage snap packages

So far, you know apt packages and their management. However, Ubuntu also uses and actively recommends using its snap packaging format.

Learning a few basic snap commands will help you manage these packages effectively.

To find a package, use:

`snap find search_term`


To install a package, use:

`sudo snap install package_name`


To list installed snap applications:

`snap list`


To remove an installed Snap application, use:

`sudo snap remove package_name`


### 26. ip: Check IP address and other info

The **ip** command lets you [check your IP address](https://itsfoss.com/check-ip-address-ubuntu/). You can also see and manipulate the routes, network devices, and more.

`ip a`


![ip address check ubuntu](https://itsfoss.com/content/images/wordpress/2022/11/ip-address-check-ubuntu.png)

### 27. ping: Check if the remote system is reachable

Ping is another [Linux networking command](https://itsfoss.com/basic-linux-networking-commands/) you should be aware of. To check whether a remote system is available or not, give its IP address to the [ping command](https://itsfoss.com/ping-command/):

`ping ip_address`


You can also use it to check if a website is down though it is not very accurate these days.

![ping command ubuntu](https://itsfoss.com/content/images/wordpress/2022/11/ping-command-ubuntu.png)

Use **Ctrl+C** to stop the running ping command.

**Recommended Read**: [ping command examples](https://linuxhandbook.com/ping-command/)

### 28. ssh: Connecting to remote systems

I was skeptical about adding ssh to the list of must-know Linux commands. Many desktop users may not need it. SSH is used for connecting to other Linux systems from your terminal.

`ssh user@ip_address_of_remote_system`


You need to know the user and password of the remote system, of course.

If you have cloud servers or a home setup where other Linux systems are available, you can use it to connect to them from your primary system.

### 29. scp: Copy files between remote systems

Since I included ssh in the list, it was only fair to include something for [transferring files between the remote systems over SSH connection](https://linuxhandbook.com/transfer-files-ssh/).

The scp command works almost like the cp command you saw earlier.

Here’s an example that copies the file from the home directory of the user on the remote system to the current directory of your locally logged in system.

`scp username@ip_address:/home/username/filename .`


**Recommended Read**: [scp command examples](https://linuxhandbook.com/scp-command/)

### 30. exit: Close the terminal

The list of essential Linux commands is ending. So let’s talk about exiting the terminal. It’s quite simple. Just enter:

`exit`


If you are using another user or shell, you’ll be logged out from that.

You may also use **Ctrl+D **keys to exit the terminal.

### 31. shutdown: Turn off or reboot the system

Alright. Let me share a final command if you haven’t exited the terminal yet.

How about [turning off your system](https://learnubuntu.com/shutdown-ubuntu/) from the command line?

[Use the shutdown command](https://linuxhandbook.com/linux-shutdown-command/) for this purpose:

`shutdown`


The above command [schedules a shutdown](https://itsfoss.com/schedule-shutdown-ubuntu/) in one minute. You can make it turn off immediately with:

`shutdown -now`


You can use the same shutdown command for [rebooting your Ubuntu system](https://learnubuntu.com/restart-ubuntu/) as well:

`shutdown -r now`


### Bonus tip: man: Learn about commands in detail

One more, and this is the last one, I promise. All Linux systems come with a manual for the commands. It’s called manpage, and you can access the manual page of an installed command with the following:

`man command_name`


[Understanding the manpage](https://itsfoss.com/linux-man-page-guide/) can be overwhelming for new users, but it comes quite handy. It gives you the generic syntax and description of a command's options.

When you are unsure about using a command, try checking its man page before searching for it on the internet.

## There’s always more …

**That’s just about 30 commands. And that’s not even 20% of the Linux commands**. I haven’t covered many networking commands. I didn’t even go for the user management commands.

I wrote this keeping a regular Ubuntu desktop user in mind. These are the kinds of commands you are more likely to use. Having some knowledge about them would be helpful in the long run.

Other than that, there is no end to learning. Even the most seasoned Linux users constantly discover and learn new stuff.

Considering that you are interested in learning Linux commands, let me recommend some[ good Linux books](https://itsfoss.com/best-linux-books/) and resources.

[How Linux Works](https://nostarch.com/howlinuxworks3): Explains the working of Linux more than the commands[The Linux Command Line by William Shotts](https://linuxcommand.org/tlcl.php): Legally available to download for free in PDF format[Linux Pocket Guide by Daniel J Barrett](https://www.oreilly.com/library/view/linux-pocket-guide/9780596806347/): Linux commands into category and briefly explained with small examples[Learn Linux Quickly](https://linuxhandbook.gumroad.com/l/mEsrwA): Entirely focused on Linux commands with proper examples and sample exercises

Apart from that, you can also learn from websites like [Linux Journey](https://linuxjourney.com/) and [Linux Handbook](https://linuxhandbook.com/a-to-z-linux-commands/).

**I know it’s been a long read**, but it’s not even the tip of the iceberg. There is always more to learn, but it’s also not the case that you have to feel miserable if you don’t know all the Linux commands.

**No one knows everything.**

Now, it’s your turn. Did you find this list of Ubuntu commands helpful?

**If you had to add some more commands to it, what would they be? The comment section is all yours.**