分享 8 篇使用 Linux 命令行的技巧
命令行

> 
> 要好好利用无所不能的 Linux 命令行提供的所有功能
> 
> 
> 


![](/data/attachment/album/202205/10/084827v23ia3wlkdirr6r5.jpg "Terminal command prompt on orange background")


Linux 命令行是极其灵活的。无论你是管理服务器还是在桌面系统上启动终端窗口，都可以通过命令行无所不包的工具包来更新文件、调整系统性能或者管理进程。命令行里发生的事情是非常有趣的。


我们发布了许多关于如何充分利用系统的优秀文章，证明了命令行的流行。以下是 8 篇关于 Linux 命令阅读量最高的文章：


### 《使用这些技巧让 Bash 命令历史更加有用》



> 
> **[文章地址](/article-12344-1.html)**
> 
> 
> 


Bash 是大多数 Linux 系统上的默认命令行 Shell。Seth Kenlon 编写了该指南，用于帮助你了解 Bash 命令历史。修改 Bash 命令历史通常没有听起来那么危险，特别是当你带有目的地修改它的时候。告诉 Bash 你希望它记住什么，甚至还可以直接通过删除你不想要或不需要的条目来重写命令历史。根据需要使用你的历史会话，明智地行使你对命令历史的权力。


### 《如何在 Linux 终端中兼顾特性和性能》



> 
> **[文章地址](https://opensource.com/article/20/7/performance-linux-terminal)**
> 
> 
> 


Ricardo Gerardi 非常喜欢命令行应用程序，他花了很多时间在终端上工作。Ricardo 投入了一些时间，把命令行变成了一个令人愉快的工作环境。你可以通过了解如何自定义终端应用程序、主题和提示符，来创建一个功能丰富、易于使用系统资源的终端。


### 《放弃 Bash 转投拥有更优美配置的 fish》



> 
> **[文章地址](https://opensource.com/article/20/3/fish-shell)**
> 
> 
> 


Matt Broberg 最近放弃了默认的命令行解释器 —— Bash，转而支持 fish。fish 自豪地宣称自己是 “90 年代的命令行 shell”。这个以鱼为主题的 “友好的交互式 shell” 为命令行创造了更愉快的体验。阅读 Matt 的文章来进一步了解如何充分利用 fish。如果你不想再对你的终端修修补补，换一个更漂亮的默认 shell，把更多精力放在代码上，不妨试一试 fish。


### 《分析 Linux 里二进制文件的 10 种方式》



> 
> **[文章地址](/article-12187-1.html)**
> 
> 
> 


我们每天都在和二进制文件打交道，但我们对它们的了解甚少。Linux 提供了一组丰富的工具，使分析二进制文件变得轻而易举！这些简单的命令和工具可以帮助你顺利完成分析二进制文件的任务。无论你的工作角色是什么，了解这些工具的基本知识将帮助你更好地了解你的 Linux 系统。Gaurav Kamathe 介绍了一些最流行的用于管理二进制文件的 Linux 工具和命令，包括 `file`、`nm`、`strings` 和 `hexdump`。


### 《可用于 Linux 命令行的 4 种 Markdown 工具》



> 
> **[文章地址](/article-12048-1.html)**
> 
> 
> 


当涉及使用 Markdown 格式的文件时，命令行工具占据了主导地位。它们轻巧、快速、强大而又灵活，其中大多数遵循 Unix “把一件事情做好”的哲学。Scott Nesbitt 回顾了 4 种命令行实用工具，它们可以帮助你更高效地处理 Markdown 文件。


### 《禁用 atime 来提高 Linux 系统性能》



> 
> **[文章地址](https://opensource.com/article/20/6/linux-noatime)**
> 
> 
> 


每当我在为家里的电脑升级 Linux 时，我都会把我通常要做的任务列出来。这些年来，它们已经成为了习惯：备份文件、还原系统、重新安装、恢复文件，然后重新安装额外的我最喜欢的应用程序。我还会对系统进行了一些调整。其中一个调整就是 `atime`，它是 Linux 里每个文件的三个时间戳之一。关掉 `atime` 是一种简单但有效的提升系统性能的方法。下面是关于 atime` 的介绍，以及为什么它会有影响。


### 《使用 fstrim 延长固态硬盘的寿命》



> 
> **[文章地址](/article-11959-1.html)**
> 
> 
> 


在过去的十年中，固态硬盘（SSD）带来了一种全新的管理存储的方式。相比传统的机械硬盘，固态硬盘具有一些优点，比如安静、更酷的操作和更快的接口规格。当然，新技术带来了新的维护和管理方法。Alan Formy-Duval 写了一个新的 systemd 服务让你更容易管理固态硬盘。


### 《Linux 命令行工具的 5 种新式替代品》



> 
> **[文章地址](https://opensource.com/article/20/6/modern-linux-command-line-tools)**
> 
> 
> 


在我们日常使用的 Linux 或 Unix 系统中，我们会使用许多命令行工具来完成我们的工作，并帮助我们更好地了解和管理我们的系统。多年来，这些工具已经现代化并移植到了不同的系统中。然而，总的来讲，它们仍然保持着最初的想法、外观和感觉。近年来，开源社区已经开发出了提供额外好处的替代工具。Ricardo Gerardi 向我们展示了如何通过这 5 种新的替代品改进旧的命令行工具来获得新的好处。


### 总结


把这些文章作为跳板，寻找你自己关于命令行的技巧和花招吧！这份清单里还缺少什么吗？请在下方评论，或者提交一篇你自己的文章！




---


via: <https://opensource.com/article/21/1/linux-commands>


作者：[Jim Hall](https://opensource.com/users/jim-hall) 选题：[lujun9972](https://github.com/lujun9972) 译者：[FYJNEVERFOLLOWS](https://github.com/FYJNEVERFOLLOWS) 校对：[wxy](https://github.com/wxy)


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


OK
The Linux command line provides a great deal of flexibility. Whether you are managing a server or launching a terminal window on a desktop system, the command line brings with it an extensive toolkit to update files, tweak system performance, and manage processes. The command line is where it's at.

Testifying to the command line's popularity, Opensource.com publishes many excellent articles about how to get the most out of your system. The following were some of Opensource.com's most-read articles about Linux commands in 2020:

[Make Bash history more useful with these tips](https://opensource.com/article/20/6/bash-history-control)

Bash is the default command line shell on most Linux systems. Seth Kenlon wrote this guide to help you with your Bash **history**. Manipulating history is usually less dangerous than it sounds, especially when you're curating it with a purpose in mind. Tell Bash what you want it to remember—or even rewrite history by deleting entries you don't want or need. Use your history sessions as required, and exercise your power over history wisely.

[How I balance features and performance in my Linux terminal](https://opensource.com/article/20/7/performance-linux-terminal)


Ricardo Gerardi is a big fan of command line applications and spends a lot of his time working in a terminal. Ricardo invested some time to make the command line a pleasant environment to work in. Learn how to customize terminal apps, themes, and the prompt to create a feature-rich terminal that's easy on system resources.

[Drop Bash for the fish shell to get beautiful defaults](https://opensource.com/article/20/3/fish-shell)

Matt Broberg recently let go of the default command line interpreter, Bash, in favor of fish, which proudly markets itself as "a command line shell for the '90s." The fish-themed "friendly interactive shell" creates a more enjoyable experience on the command line. Read Matt's article to learn more about how to get the most out of fish. If you're looking to move away from tinkering with your terminal, focus more on code, and have a more beautiful default shell, give fish a try.

[10 ways to analyze binary files on Linux](https://opensource.com/article/20/4/linux-binary-analysis)

We work with binaries daily, yet we understand so little about them. Linux provides a rich set of tools that makes analyzing binaries a breeze! These simple commands and tools can help you sail through the task of analyzing binary files. Whatever your job role, knowing the basics about these tools will help you understand your Linux system better. Gaurav Kamathe covers some of the most popular Linux tools and commands to manage binaries, including **file**, **nm**, **strings**, and **hexdump**.

[4 Markdown tools for the Linux command line](https://opensource.com/article/20/3/markdown-apps-linux-command-line)

When it comes to working with files formatted with Markdown, command line tools rule the roost. They're light, fast, powerful, and flexible, and most of them follow the Unix philosophy of doing one thing well. Scott Nesbitt reviews four command line utilities that can help you work more efficiently with Markdown files.

[Improve Linux system performance with noatime](https://opensource.com/article/20/6/linux-noatime)

Whenever I upgrade Linux on my home computer, I have a list of tasks I usually do. They've become habits over the years: I back up my files, wipe the system, reinstall from scratch, restore my files, then reinstall my favorite extra applications. I also make a few system tweaks. One tweak is **atime**, which is one of the three timestamps on every file on Linux. Turning off **atime** is a small but effective way to improve system performance. Here's what it is and why it matters.

[Extend the life of your SSD drive with fstrim](https://opensource.com/article/20/2/trim-solid-state-storage-linux)

Over the past decade, solid-state drives (SSD) have brought about a new way of managing storage. SSDs have benefits like silent and cooler operation and a faster interface spec, compared to their elder spinning ancestors. Of course, new technology brings with it new methods of maintenance and management. Alan Formy-Duval wrote about a new **systemd** service to make your life easier when managing SSDs.

[5 modern alternatives to essential Linux command line tools](https://opensource.com/article/20/6/modern-linux-command-line-tools)

In our daily use of Linux/Unix systems, we use many command line tools to complete our work, and to help us understand and manage our systems better. Over the years, these tools have been modernized and ported to different systems. However, in general, they still follow their original idea, look, and feel. In recent years, the open source community has developed alternative tools that offer additional benefits. Ricardo Gerardi shows us how to gain new benefits by improving old command line tools with these five updated alternatives.

## Wrap up

Use these articles as a springboard to finding your own tips and tricks for the command line. Is there something missing from this list? Comment below, or better yet, submit an article of your own!

## 1 Comment