一些经典 Linux 命令的现代替代品
Linux 命令 替代品
![](/data/attachment/album/202201/12/155211u6dwvwv66hwvzo8g.jpg)


当你 [开始学习 Linux](https://academy.itsfoss.com/) 时，最初学习的是一套标准的 Linux 命令，这些命令从 UNIX 时代就已经存在了。随着你作为一个 Linux 用户的年龄增长，你会不断地掌握这套标准命令。


但是，这些标准的、传统的命令是几十年前创建的，虽然它们完成了预定的工作，但是它们的功能还可以改进，结构还可以简化。


这就是为什么存在 “替代” 工具，以加强传统的 UNIX/Linux 命令。在这篇文章中，我将列出一些新的命令行工具，你可以用这些工具来代替旧式的经典 Linux 命令。


请注意，你不应该过分依赖这些替代品，特别是如果你管理（或计划管理）许多 Linux 服务器时。传统的 Linux 命令在所有的 Linux 发行版和 Linux 服务器上都可以找到。这些现代的替代方案很有可能在远程服务器上无法使用。


在你的个人能力范围内，你可以学习了解这些新的工具，以帮助你更有效率。


听起来不错？让我们看看你是否能在这里找到你下一个最喜欢的命令行工具。


### HTTPie: wget 和 curl 的替代品


[在终端下载文件](https://itsfoss.com/download-files-from-linux-terminal/) 时，`wget` 和 `curl` 是两个最常用的工具。有趣的是，并不是所有的发行版都默认安装了 `curl` 和 `wget`。


HTTPie（`http`）以一种更人性化的方式做同样的工作。你会看到彩色的、格式化的输出，这使得它更容易理解和调试。


![](/data/attachment/album/202201/12/155228amchccynwnzwz8my.jpg)


### 蝙蝠：猫的替代品


`cat` 命令可能是你最先学会的命令之一。它可以完成查看小型文本文件内容的工作。


但 [bat 命令](https://github.com/sharkdp/bat) 更上一层楼，添加了语法高亮和 Git 集成等功能，并且还提供了分页选项。


![](/data/attachment/album/202201/12/155228mgvg4khz9udjg0x9.png)


### ncdu: du 命令的替代品


Linux 中的 [du 命令](https://linuxhandbook.com/find-directory-size-du-command/) 用来检查一个目录的大小。这不是一个非常直观的命令，当然它的默认输出也不算非常好。


与此相比，`ncdu` 要好得多，它能及时提供相关信息。


![](/data/attachment/album/202201/12/155229ecycz7nhg886a967.png)


它还有其他一些功能，比如用图表显示磁盘使用情况，对显示进行排序，甚至可以交互式地删除目录。


它是基于 ncurses 的，因此 “nc” 这个前缀被加到 `du` 中。此外，还有一个类似的 CLI 工具：[gdu](https://itsfoss.com/gdu/)，也是一个 `du` 的替代品，因为是使用 Go 编写的，这使得它的性能得到了提升。


### htop: top 命令的替代品


`top` 命令是 Linux 终端中的任务管理器。它是一个查看运行进程和资源消耗的好工具，但是 [理解和使用 top 命令](https://linuxhandbook.com/top-command/) 可能很复杂。


另一方面，[htop](https://htop.dev/) 有一个漂亮的彩色输出，并且界面比 `top` 命令更直观。你可以垂直和水平滚动，以图形方式配置显示的信息。你可以在 `htop` 的输出屏幕上交互式地杀死进程。


![](/data/attachment/album/202201/12/155229eaxpofjx88jafrif.png)


### fd：find 命令的替代品


`find` 命令是最强大和最常用的 Linux 命令之一。不能想象一个系统管理员可以不使用 `find` 命令就能生存下去。


但是，`find` 命令的结构奇怪，如果你进行大量的查找操作，它可能会很慢。


一个更好、更快的替代方案是 [fd 命令](https://github.com/sharkdp/fd)。`fd` 是用 Rust 编写的，它比其传统的竞争对手更简单、更快速。


![](/data/attachment/album/202201/12/155229prxw1m77x1uxmt57.png)


### exa：ls 命令的替代品


[exa](https://itsfoss.com/exa/) 命令行工具不止可以列出目录内容。它的默认设置更好，使用颜色来区分文件类型和元数据。`exa` 还可以显示一个文件的扩展属性，以及标准的文件系统信息，如 inode、块数，以及文件的各种日期和时间。


你可以使用树状视图来查看目录结构。它也有内置的 Git 支持，可以看到哪些文件被修改、提交和暂存等。


![](/data/attachment/album/202201/12/155230z10175h058we3drw.jpg)


### duf：df 命令的替代品


Linux 中的 [df 命令](https://linuxhandbook.com/df-command/) 用来检查磁盘空间。虽然它在大多数情况下都不错，但一个更简单、更好的替代方法是 [duf](https://itsfoss.com/duf-disk-usage/)，这是一个用 Go 编写的工具。


它提供了一个所有挂载设备的概览，这很容易理解。你还可以指定一个目录/文件名并检查该挂载点的可用空间。


通过 `duf`，你可以对输出进行排序、列出 indoe 信息，甚至将输出保存为 JSON 格式。


![](/data/attachment/album/202201/12/155230m3lpwmhpjw2oplx2.jpg)


### 太长不读：男人的替代品


我知道对于纯粹主义者来说，[Linux 中的手册页](https://itsfoss.com/linux-man-page-guide/) 是不二之选。但是，手册页有时会过于详细和复杂，难以阅读和理解。


这就是 `tldr` 登场的时机。“TLDR” 是流行的互联网行话，意思是“<ruby> 太长不读 <rt>  to long didn't read </rt></ruby>”。这就是他们创建 `tldr` 的想法。如果你觉得手册页太长而不想阅读，[tldr 通过提供命令的实际例子而将其简化了](https://itsfoss.com/tldr-linux-man-pages-simplified/)。


![](/data/attachment/album/202201/12/155230s7e7520wzzc58gf5.png)


### Neovim：Vim 的替代品


我希望我在这里没有冒犯谁，但更好的 Vim 不是 Emacs，而是 [Neovim](https://neovim.io/)。


几年前，作为对传统的 Vi 编辑器的改进，Vim 出现了。又是几年过去了，Neovim 提出了将 Vim 扩展为一个 IDE 的想法。


它增加了现代终端的功能，如光标样式、焦点事件、括号内粘贴等，并内置了一个终端模拟器。最重要的是，你不需要忘却 Vim 的习惯就可以开始使用 Neovim。


### 你的选择呢？


再次强调，这些替代命令还不能完全替代原来的命令，特别是如果你管理许多 Linux 系统的话。你可能无法在所有的系统上找到并安装它们。只有你可以完全控制你的 Linux 机器时，它们才是好东西。


除此以外，你是否在这个列表中找到了一些好的替代命令行工具？是哪一个呢？另外，你知道其他一些可以 “替代” 传统 UNIX 命令的工具吗？为什么不在评论区与我们分享呢？




---


via: <https://itsfoss.com/legacy-linux-commands-alternatives/>


作者：[Abhishek Prakash](https://itsfoss.com/author/abhishek/) 选题：[lujun9972](https://github.com/lujun9972) 译者：[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)

When you [start learning Linux](https://academy.itsfoss.com/), you begin with a standard set of Linux commands that have been in existence since the UNIX days. As you grow old as a Linux user, you keep on mastering the same set of standard commands.

But these standard, legacy commands were created several decades ago and while they do their intended jobs, their functionalities could be improved and the structure could be simplified.

This is why there exists ‘alternative’ tools that enhance the legacy UNIX/Linux commands. In this article, I am going to list some new CLI tools that you could use in place of the good old classic Linux commands.

Please note that you should not rely too much on these alternatives, specially if you manage (or plan to manage) numerous Linux servers. The legacy Linux commands are found on all Linux distributions, all Linux servers. These modern replacements are more likely to be not available on remote servers.

In your individual capacity, you can always explore these new tools that could help you in being more efficient.

Sounds all good? Let’s see if you can find your next favorite CLI tool here.

## HTTPie: Alternative to wget and curl

When it comes to [downloading files in terminal](https://itsfoss.com/download-files-from-linux-terminal/), wget and curl are the two of the most common tools. Interestingly, not all distributions have curl, wget installed by default.

HTTPie does the same job but in a more human-friendly way. You have colorized, formatted output which makes it easier to understand and debug.

![httpie screenshot](https://itsfoss.com/content/images/wordpress/2022/01/httpie-screenshot-800x399.jpg)

## Bat: Alternative to cat

The cat command is perhaps one of the first command you learn. It does the job for viewing the contents of small text files.

But [bat command](https://github.com/sharkdp/bat) takes it to the next level by adding features like syntax highlighting and Git integration. Pagination option is also available.

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

## ncdu: Alternative to du command

The [du command in Linux](https://linuxhandbook.com/find-directory-size-du-command/) is used for checking the size of a directory. It’s not very straightforward command and it certainly doesn’t give a very good default output.

Compared to that, ncdu is a lot better than providing the relevant information at the first glance.

![ncdu command example](https://itsfoss.com/content/images/wordpress/2022/01/ncdu-command-example-800x448.png)

There are other features here such as showing the disk usage in graphs, sort the display and even delete directories interactively.

It is based on ncurses and hence the ‘nc’ is added to ‘du’. A similar CLI tool is [gdu](https://itsfoss.com/gdu/) which is a du replacement written in Go which gives it a performance boost.

## Htop: Alternative to top command

The top command in works as the task manager in Linux terminal. It is a good tool for looking at running processes and resource consumption but [understanding and using the top command](https://linuxhandbook.com/top-command/) could be complicated.

[Htop](https://htop.dev/) on the other hand has a pretty, colorful output and a more intuitive interface than the top command. You can scroll vertically and horizontally, configure the displayed information graphically etc. You can kill processes interactively right from the output screen of htop.

![htop example](https://itsfoss.com/content/images/wordpress/2022/01/htop-example-800x453.webp)

## fd: Alternative to the find command

The find command is one of the most powerful and most used Linux commands. It’s impossible to imagine that a sysadmin could survive without using the find command.

But the find command has a strange structure and it could be slow if you do a large set of find operations.

A better and faster alternative is [fd command](https://github.com/sharkdp/fd). Written in Rust, fd is simpler and faster than its legacy competitor.

![fd command](https://itsfoss.com/content/images/wordpress/2022/01/fd-command-800x514.webp)

## exa: Alternative to ls command

The [exa CLI tool](https://itsfoss.com/exa/) adds a few features while listing directory contents. It has better defaults and uses colors to distinguish file types and metadata. exa can also display a file’s extended attributes, as well as standard filesystem information such as the inode, the number of blocks, and a file’s various dates and times.

You can use the tree view to see directory structure. It also has built-in Git support to see what files have changed, committed and staged etc.

![04 exa all flags](https://itsfoss.com/content/images/wordpress/2021/11/04_exa_all_flags-800x600.webp)

## Duf: Alternative to the df command

The [df command in Linux](https://linuxhandbook.com/df-command/) is used for checking disk space. While it works most of the time, an easier and better alternative is [duf](https://itsfoss.com/duf-disk-usage/), a tool written in Go.

It gives you an overview of all the devices mounted which is easy to understand. You also have the ability to specify a directory/file name and check free space for that mount point.

With duf, you can sort the output, list indoe information and even save the output in JSON format.

![duf screenshot](https://itsfoss.com/content/images/wordpress/2021/02/duf-screenshot.jpg)

## Tldr: Alternative to man command

I know the purist says that there is no alternative to the [man pages in Linux](https://itsfoss.com/linux-man-page-guide/). But man pages could be too detailed and complicated at times to read and understand.

Enter tldr. TLDR is the popular Internet jargon for ‘too long didn’t read’. And that’s the idea behind the creation of tldr. If you find man pages too long to read, [tldr simplifies](https://itsfoss.com/tldr-linux-man-pages-simplified/) that by providing practical examples of the command.

![tldr example](https://itsfoss.com/content/images/wordpress/2022/01/tldr-example-800x594.png)

## Neovim: Alternative to Vim

I hope I am not committing a blasphemy here but a better Vim is not Emacs, it’s [Neovim](https://neovim.io/).

Years ago, Vim came up as an improvement to the legacy Vi editor. A few years back, Neovim came up with the idea to extend Vim as an IDE.

It adds modern terminal features such as cursor styling, focus events, bracketed paste etc. with a built-in terminal emulator. The best thing is that you don’t need to unlearn Vim to start using Neovim.

[7 Reasons NeoVim is Better Than VimNepVim or Vim? Which one of the two similar editors is better? I think it is NeoVim and I have good reasons to support this claim.](https://linuxhandbook.com/neovim-vs-vim/)![](https://linuxhandbook.com/content/images/2023/01/neovim-vs-vim.png)


![](https://linuxhandbook.com/content/images/2023/01/neovim-vs-vim.png)

## Your choice?

Again, these alternative commands should not be considered as a drop-in replacement, specially if you manage numerous Linux systems. You may not find and install them on all the systems. They are good only if you have full control on your Linux machine(s).

Keeping that aside, did you find some good alternative command line tools in this list? Which one is it? Also, do you know some other tools that could ‘replace’ the legacy UNIX commands? Why not share it with us in the comment section?