win7 命令行工具
The terminal/command line is a sacred tool that developers have under their belt. It is possibly the most used tool for programmers. I believe that is because of how lightweight it is and also the unbelievable amount of things you can do with it. Some developers even go the extra mile to do everything inside of the terminal. Kudos to them.
终端/命令行是开发人员的神圣工具。 它可能是程序员最常用的工具。 我相信这是因为它的重量很轻,并且您可以用它做很多事。 一些开发人员甚至不遗余力地在终端内部进行所有操作。 对他们表示敬意。
I’ll be showing some of the CLI (Command-Line Interface) tools that I personally think are awesome and use pretty much on a daily basis. Granted, there are so many tools out there for the command line that this list barely scratches the surface.
我将展示一些我个人认为很棒的CLI(命令行界面)工具,并且每天都会大量使用。 诚然,那里有太多用于命令行的工具,以至于这个列表几乎没有触及表面。
1. vim (1. vim)
What kind of terminal list wouldn’t include vim
? There are tons of debates about whether or not vim
is the editor for programming or if it’s a tool invented for lunatics, but we will not be discussing that here.
哪种终端列表不包含vim
? 关于vim
是否是 程序设计编辑器,或者它是为疯子发明的工具,但是我们在这里不再讨论。
For those of you who are not familiar with vim
, it is a text editor that improves on the out-of-the-box vi
tool shipped with any UNIX system. It allows you to edit or create a file through your terminal.
对于不熟悉vim
,它是一个文本编辑器,可以改进任何UNIX系统附带的现成的vi
工具。 它允许您通过终端编辑或创建文件。
This tool is helpful if you want to quickly edit a file while you are in the terminal and don’t want to open up your IDE or a GUI text editor like VSCode or Sublime Text.
如果您想在终端中快速编辑文件并且不想打开IDE或VSCode或Sublime Text之类的GUI文本编辑器,此工具将非常有用。
Keep in mind that this tool can be a little tricky to use when first learning it, as many of the shortcuts are not as intuitive as modern-day text editors. However, if you do invest the time to learn vim
, it can be extremely powerful for a developer. This is why vim
has a huge community. This community is so large that developers will even make plug-ins for popular IDEs and text editors to emulate the vim
experience.
请记住,此工具在初学时可能会有些棘手,因为许多快捷方式并不像现代文本编辑器那样直观。 但是,如果您确实花时间学习vim
,那么对于开发人员来说,它可能会非常强大。 这就是为什么vim
具有庞大的社区。 这个社区是如此之大,以至于开发人员甚至会为流行的IDE和文本编辑器制作插件来仿效vim
体验。
2. vtop (2. vtop)
top
is a very common command that is used within the terminal to display information about processes that your system has running and general information about the memory and CPU usage of your machine. If you have ever used top
, it can be a little confusing to look at. So how can we make this information a little easier to process? Introducing vtop
, an implementation of top
that has graphs!
top
是一个非常常见的命令,用于在终端中显示有关系统正在运行的进程的信息以及有关计算机内存和CPU使用率的常规信息。 如果您曾经使用过top
,那么看起来可能会有些混乱。 那么,如何使这些信息更容易处理呢? 引入vtop
,这是具有图形的top
的实现!
I like having a visual guide for anything, and having one for top
information is killer. I have this running all day so that I can keep an eye on my system’s load.
我喜欢拥有任何事物的可视化指南,而拥有top
信息则是杀手.。 我整天都在运行,以便可以随时注意系统的负载。
You’re going to need npm
for this tool.
您将需要npm
才能使用此工具。
3. fzf (3. fzf)
This next one is a really cool tool. It’s called fzf
. It’s a general-purpose command-line fuzzy finder that allows you to find files based on whatever you type. On its own, it’s an OK tool. It will list all the different files in the current directory you’re in. You can think of it as a Spotlight search, but in your terminal.
下一个是一个非常酷的工具。 叫做fzf
。 这是一个通用的命令行模糊查找器,可让您根据键入的内容查找文件。 就其本身而言,这是一个确定的工具。 它会列出您当前所在目录中的所有不同文件。您可以将其视为Spotlight搜索,但可以在终端中进行。
Now the real power of this tool comes when you combine fzf
with other existing commands like kill
or cat
. In order to do this, you’re going to need to run the install script that is provided with the package or inside the repository:
现在,当您将fzf
与其他现有命令(例如kill
或cat
结合使用时,此工具才真正fzf
。 为了做到这一点,您将需要运行软件包或存储库中随附的安装脚本:
/usr/local/opt/fzf/installor~/.fzf/install
You will need to restart your terminal or source
your .bashrc
. It will ask you some questions, and once you’ve answered all of them, you will have unlocked fzf
's fullest potential.
您将需要重新启动终端或source
您.bashrc
。 它会问您一些问题,并且回答fzf
所有问题后,您便可以充分发挥fzf
的潜力。
Now you can run commands like:
现在,您可以运行以下命令:
cat **[TAB]
vim **[TAB]
ssh **[TAB]
fzf
will kick into gear and find all the possible entries that can work with the command:
fzf
将投入使用,并找到可与该命令一起使用的所有可能的条目:
Another cool application of this is using it with the kill
command. This is probably the one I use most. The days of typing ps -ef | grep [process-name]
and then either manually typing or copying the process ID to kill are long gone. Instead, you can run kill [tab]
or kill -9 [tab]
. Fuzzy-find the process you want to kill and press enter. It will automatically fill the process ID in for you.
另一个很酷的应用程序是将它与kill
命令一起使用。 这可能是我最常用的一种。 键入ps -ef | grep [process-name]
的日子ps -ef | grep [process-name]
ps -ef | grep [process-name]
,然后手动键入或复制要杀死的进程ID早已不复存在。 相反,您可以运行kill [tab]
或kill -9 [tab]
。 模糊查找要杀死的进程,然后按Enter。 它将自动为您填写进程ID。
There are tons of other use cases that I can go over, but these are the main ones I would like to point out.
我还有很多其他用例,但这些是我要指出的主要用例。
4.垃圾箱 (4. trash-cli)
Ever rm -rf
something and immediately realize that it wasn’t something you wanted to delete forever? I hope this isn't just me. If you don’t want to deal with that kind of anxiety, then I would recommend using trash-cli
.
曾经rm -rf
某个东西,立即意识到这不是您想要永久删除的东西吗? 我希望这不只是我。 如果您不想处理这种焦虑,那么我建议您使用trash-cli
。
This tool basically just puts items inside your system’s trash instead of wiping it completely from existence.
该工具基本上只是将项目放入系统的垃圾桶中,而不是完全消除其存在。
Instead of typing out trash
, I have an alias in my .bashrc
that replaces the rm
command:
我没有在trash
中键入trash
,而是在我的.bashrc
中有一个别名来代替rm
命令:
alias rm=trash
Now when something is deleted using rm
, you don’t have to worry about it being gone forever. You can simply retrieve it from the trash if you like. And yes, this works with different flags that rm
provides.
现在,使用rm
删除某些内容时,您不必担心它会永远消失。 您可以根据需要直接从垃圾桶中检索它。 是的,这适用于rm
提供的不同标志。
5.速度测试 (5. speed-test)
This one is pretty straightforward. If you want to see how fast your internet is without having to open up Chrome, speed-test
is for you.
这很简单。 如果您想在不打开Chrome的情况下查看互联网的speed-test
则可以进行speed-test
。
This is a tool I use quite frequently and always like to have in my back pocket just so that I don’t have to chew up additional resources from Chrome. Also, it’s pretty cool to do it in the terminal.
这是我经常使用的工具,并且总是喜欢随身携带,这样我就不必从Chrome中获取更多资源。 另外,在终端中执行此操作也很酷。
You’re going to need npm
for this tool.
您将需要npm
才能使用此工具。
6. Wikit (6. wikit)
This one is a much smaller repo, and I love it. I have my terminal open all day via iTerm2, so being able to search Wikipedia is awesome. wikit
allows you to do that from the terminal. You’d be surprised by how often I use this one on a day-to-day basis.
这是一个小得多的仓库,我喜欢它。 我的终端通过iTerm2全天开放,因此能够搜索Wikipedia非常棒。 wikit
允许您从终端执行此操作。 您会惊讶于我每天使用这一频率。
You’re going to need npm
for this tool.
您将需要npm
才能使用此工具。
7.硬币顶 (7. cointop)
This last one might not be for everyone, but I use it every day. For those of you who are in the crypto world, then you probably already know about this tool.
最后一个可能并不适合所有人,但是我每天都在使用它。 对于那些身处加密世界的人来说,您可能已经了解此工具。
I dabble in cryptocurrency here and there, and keeping up with so many different types of coins — let alone their prices — can be exhausting. With prices moving so quickly in the crypto world, cointop
is a lifesaver.
我在这里和那里涉足加密货币,跟上这么多不同类型的硬币(更不用说价格)了,可能会精疲力尽。 在加密cointop
世界中,价格如此之快地波动, cointop
成为了救命稻草。
cointop
is a play on the top
command. However, instead of displaying system information, cointop
displays information about cryptocurrencies.
cointop
是对top
命令的播放。 但是, cointop
不会显示系统信息, cointop
显示有关加密货币的信息。
结论 (Conclusion)
There are so many more CLI tools that I use on a day-to-day basis, but these are the ones that stand out to me in my toolkit. I can go on forever about CLI tools. They are one of my favorite things to tinker with in the world of software. I always get excited whenever I find a new CLI tool that allows me to accomplish something so minuscule.
我每天都会使用更多的CLI工具,但是这些工具在我的工具箱中对我来说很突出。 我可以永远继续使用CLI工具。 它们是我在软件世界中最喜欢修改的东西之一。 每当我找到一个新的CLI工具时,我总是会感到兴奋,它可以使我完成如此微不足道的事情。
I also love the fact that most of these tools are community-driven — a bunch of developers just working on a small tool because they think they’re neat.
我也喜欢这样一个事实,其中大多数工具都是社区驱动的-一堆开发人员只是在开发一个小型工具,因为他们认为它们很简洁。
I’ll see you all in the next one!
下一个见,大家见!
翻译自: https://medium.com/better-programming/7-awesome-command-line-tools-36cea5cfc026
win7 命令行工具