在mac homebrew_您可以通过Homebrew在Mac上获得的最佳命令行工具

在mac homebrew

在mac homebrew

ansiweather-mac-terminal

You can use your Mac’s Terminal to download files, test your internet speed, convert images, or even listen to Pandora. All this and more is just a couple of Homebrew installations away.

您可以使用Mac的终端下载文件,测试网速,转换图像,甚至收听Pandora。 所有这一切以及更多的只是几个Homebrew装置。

We’ve shown you a bunch of terminal tricks in macOS, all based on software that comes with the operating system itself. But you can do even more with the right free software, and thankfully, there’s a great package manager called Homebrew that lets you install loads of useful command line utilities. Check out our guide to installing Homebrew, if you haven’t already, then come back here to check out some of the best tools it offers.

我们已经向您展示了macOS中的许多终端技巧 ,这些技巧都基于操作系统本身随附的软件。 但是,有了合适的免费软件,您甚至可以做更多的事情,而且值得庆幸的是,有一个很棒的软件包管理器叫做Homebrew ,它可以让您安装有用的命令行实用程序。 查看我们的Homebrew安装指南 (如果您尚未安装的话),然后返回此处以查看它提供的一些最佳工具。

用wget下载任何东西 (Download Anything With wget)

wget-homebrew-mac

The ultimate download tool, wget, is great for downloading individual files or even downloading an entire website. And it’s easy to install with Homebrew. Just run:

最终的下载工具wget非常适合下载单个文件,甚至下载整个网站 。 而且使用Homebrew易于安装。 赶紧跑:

brew install wget

brew install wget

Then you can use wget to download whatever youwant. If you wanted to download the latest version of WordPress, for example, you’d run this command:

然后,您可以使用wget下载任何您想要的文件。 例如,如果您想下载最新版本的WordPress,则可以运行以下命令:

wget https://wordpress.org/latest.zip

wget https://wordpress.org/latest.zip

But this doesn’t stop at individual files. You can download entire directories, using a command like this:

但这并不仅限于单个文件。 您可以使用以下命令下载整个目录:

wget ‐‐level=1 ‐‐recursive ‐‐no-parent http://www.examplesite.egg/neatfiles/

wget ‐‐level=1 ‐‐recursive ‐‐no-parent http://www.examplesite.egg/neatfiles/

We’re really just scratching the surface here, but if you type wget --help you’ll learn a lot more.

我们实际上只是在这里wget --help ,但是,如果您键入wget --help您将学到更多。

使用speedtest_cli测试您的互联网速度 (Test Your Internet Speed With speedtest_cli)

speedtest-cli-mac

We’ve shown you how to test your internet connection speed using your browser, but wouldn’t it be faster just to open the Terminal and type a command? Yes, and installing this capability is simple:

我们已经向您展示了如何使用浏览器测试Internet连接速度 ,但是打开终端并输入命令会更快吗? 是的,安装此功能很简单:

brew install speedtest_cli

brew install speedtest_cli

You can run the test by typing speedtest-cli or speedtest_cli in the Terminal. You’ll get the same results as the web version, just with a lot less visual clutter.

您可以通过在终端中键入speedtest-clispeedtest_cli来运行测试。 您将获得与Web版本相同的结果,并且视觉混乱程度大大降低。

使用ansiweather检查天气 (Check The Weather With ansiweather)

ansiweather-mac-terminal

Get a weather forecast from the Terminal? Why not! Again, it’s easy to install.

从航站楼获得天气预报? 为什么不! 同样,它很容易安装。

brew install ansiweather

brew install ansiweather

Using this one is a little tricky, because you have to specify your location. Here’s what that looked like for me:

使用此选项有点棘手,因为您必须指定位置。 这就是我的样子:

ansiweather -l Hillsboro,OR -u imperial

ansiweather -l Hillsboro,OR -u imperial

  • ansiweather is the name of the program

    ansiweather是程序的名称

  • -l lets me set the location, and Hillsboro,OR is where I live.

    -l让我设置位置,而Hillsboro,OR是我的住所。

  • -u lets me set which units to use, and I opted for imperial because I live in the USA and that’s how they do things here.

    -u让我设置要使用的单位,我选择了imperial因为我住在美国,这就是他们在这里做事的方式。

You can read more details on the ansiweather GitHub page, if you’re interested. This application probably isn’t one you’ll use every day, but could be awesome if you’ve set up GeekTool to customize your desktop.

如果您有兴趣,可以在ansiweather GitHub页面上阅读更多详细信息。 这个应用程序可能不是您每天都会使用的应用程序,但是如果您设置了GeekTool来自定义桌面 ,那么它可能会很棒。

Calc紧缩数字 (Crunch Numbers With calc)

calc-terminal-mac

Turn your Terminal into a complete calculator by installing:

通过安装以下设备,将您的终端变成一个完整的计算器:

brew install calc

brew install calc

Launch calc and you can start typing equations, as shown in the screenshot. If you need some help learning what characters to use, just type help intro and read the resulting tutorial. The program is quite powerful once you learn it, so dive in.

启动calc ,您可以开始输入方程式,如屏幕截图所示。 如果您需要一些帮助来学习使用哪些字符,只需键入help intro并阅读生成的教程。 一旦您学习了该程序,它就会非常强大,因此请深入研究。

使用dockutil自定义您的Dock (Customize Your Dock With dockutil)

dockutil-working-mac

We’ve shown you ways to customize your dock, but dockutil goes just a little bit further, and is quick to install.

我们已经向您展示了自定义码头的方法 ,但是dockutil稍微更进了一步,并且可以快速安装。

brew install dockutil

brew install dockutil

The tool can do many things, including add a dock icon for any website. Here’s how that command looks for Facebook:

该工具可以做很多事情,包括为任何网站添加停靠图标。 这是该命令在Facebook中的外观:

dockutil --add http://www.facebook.com --label Facebook

dockutil --add http://www.facebook.com --label Facebook

A quick breakdown for you:

为您快速分解:

  • dockutil is the name of the program

    dockutil是程序的名称

  • --add tells the program to add an icon. The URL following this tells the program which website I’d like to point to; you can also point to applications or folders.

    --add告诉程序添加图标。 此后的URL告诉程序我要指向哪个网站; 您也可以指向应用程序或文件夹。

  • --label lets me name the dock icon, which I’ve opted to call Facebook.

    --label让我命名停靠--label图标,我选择将其命名为Facebook。

You’ll need to reset your dock for the new icon to show up:

您需要重置码头,以显示新图标:

killall Dock

killall Dock

Just like that, you’ll see a Dock icon for launching Facebook.

这样,您将看到用于启动Facebook的Dock图标。

facebook-dock-icon

You can also add applications, folders, and blank spaces. For information on all this and more, check out the dockutil page on Github.

您还可以添加应用程序,文件夹和空格。 有关所有这些以及更多信息,请查看Github上dockutil页面

使用ImageMagick转换图像 (Convert Images With ImageMagick)

imagemagick-conversion

We’ve already explained how to convert and resize images with imagemagick in Linux, and everything works the same way for Mac users. First, install imagemagick using Homebrew:

我们已经说明了如何在Linux中使用imagemagick转换图像和调整图像大小 ,并且Mac用户的工作方式相同。 首先,使用Homebrew安装imagemagick:

brew install imagemagick

brew install imagemagick

Now you can start using the application to do all sorts of things. For example, if you wanted to convert a file from a PNG to a JPG, you’d run:

现在,您可以开始使用该应用程序执行各种操作。 例如,如果要将文件从PNG转换为JPG,则可以运行:

convert example.png example.jpg

convert example.png example.jpg

You can do a lot more than just convert files, too. Here at How-To Geek, for example, put a 1 pixel black border on our images, and I do it with this command:

您不仅可以转换文件,还可以做更多的事情。 例如,在“ How-To Geek”中,在我们的图像上放置一个1像素的黑色边框,我使用以下命令进行操作:

convert -border 1x1 -bordercolor black testing.png result.png

convert -border 1x1 -bordercolor black testing.png result.png

There’s a lot of power to unpack here, so feel free to dive in–check out our original guide for tons of useful info.

这里有很多强大的功能可解压,所以请随时潜入- 查看我们的原始指南以获取大量有用信息。

用Pianobar收听Pandora (Listen To Pandora With pianobar)

pianobar-terminal-mac

Using the terminal to listen to music may seem like a gimmick, but it’s actually awesome. Pianobar streams Pandora to your computer with great keyboard shortcuts, without the big Flash-y site, and without commercials. Again, you can install with one command.

使用终端听音乐可能看起来很花哨,但实际上很棒。 Pianobar通过出色的键盘快捷键将Pandora流式传输到您的计算机,而没有大型Flash-y网站,也没有广告。 同样,您可以使用一个命令进行安装。

brew install pianobar

brew install pianobar

Launch pianobar and you’ll be asked for your Pandora account info, then you’re ready to rock. You can pick from among your stations using numbers, and keyboard shortcuts let you do things like skip tracks and love songs. Press “?” to see a full list of shortcuts.

启动pianobar ,将要求您提供Pandora帐户信息,然后就可以pianobar 。 您可以使用数字从电台中进行选择,键盘快捷键可让您执行诸如跳过曲目和爱情歌曲之类的操作。 按 ”?” 查看快捷方式的完整列表。

使用darkmode切换Dark Mode (Toggle Dark Mode With darkmode)

Mac users have been able to turn their menu bar black for a while now, a feature called “Dark Mode”. This Terminal application lets you toggle that mode one and off quickly from the Terminal. Installation, again, is easy:

Mac用户现在已经能够将其菜单栏变黑一段时间了,该功能称为“黑暗模式”。 该终端应用程序使您可以在终端上快速切换一种模式或关闭该模式。 再次,安装很容易:

brew install darkmode

brew install darkmode

Once installed, you can toggle your menu bar between dark mode and light mode with a simple command: dark-mode. Run that, and your menu bar will switch color schemes. It’s a quick thing, sure, but someone with some scripting experience could put it to good use.

安装完成后,您可以使用简单的命令: dark-mode在黑暗模式和明亮模式之间切换菜单栏。 运行该命令,菜单栏将切换配色方案。 当然,这是一件快速的事情,但是具有一定脚本经验的人可以很好地利用它。

玩强制性的cowsay (Play With cowsay, Which Is Mandatory)

cowsay-hello

For some reason, no roundup of command prompt tools for beginners is complete without mention of cowsay. Type cowsay, followed by any sentence, and an ascii cow will say it back to you. Magical. Installing, once again, is easy with Homebrew.

出于某种原因,不提Cowsay,就没有完整的针对初学者的命令提示符工具综述。 输入Cowsay,然后加上任何句子,然后ascii cow会说出来。 神奇。 再次使用Homebrew轻松安装。

brew install cowsay

brew install cowsay

You can actually get so much more than cows from this. Here’s how to get a list of all supported creatures:

从中您实际上可以获得比母牛更多的东西。 以下是获取所有受支持生物的列表的方法:

cowsay -l

cowsay -l

You can make any of these creatures say your words by using the -f variable. For example, if you want a dragon to say “hello”, you can do that:

您可以使用-f变量使这些生物中的任何一个说出您的话。 例如,如果您想让一条龙说“你好”,您可以这样做:

cowsay -f dragon hello

cowsay -f dragon hello

dragon-hello

You know what? That’s actually a fairly decent tutorial for learning the command line. No wonder every list like this seems to include this otherwise useless tool. Enjoy!

你知道吗? 这实际上是学习命令行的相当不错的教程。 难怪像这样的每个列表似乎都包含了这个原本无用的工具。 请享用!

翻译自: https://www.howtogeek.com/275381/the-best-command-line-tools-you-can-get-on-your-mac-with-homebrew/

在mac homebrew

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
### 回答1: 在 Mac 上安装 Homebrew 的方法如下: 1. 打开终端 (Terminal)。 2. 输入以下命令并按回车键:`/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/main/install.sh)"` 3. 按照提示输入密码,并等待安装过程结束。 如果安装成功,终端会显示 "Installation successful!" 的提示。 您可以使用 `brew -v` 检查 Homebrew 版本。 ### 回答2: 在Mac上安装Homebrew非常简单。请按照以下步骤进行操作: 1. 打开终端应用程序,它可以在“应用程序”文件夹的“实用工具”文件夹中找到。 2. 在终端中输入以下命令,并按下Enter键来安装Homebrew: ``` /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" ``` 3. 终端会显示安装进度,并且需要您输入密码以完成安装过程。输入密码时,您不会看到任何反馈,所以请确保准确输入,并按下Enter键。 4. 安装完成后,终端会显示Homebrew的相关信息以及安装成功的提示。 5. 现在,您可以使用Homebrew来安装各种软件包。只需在终端中输入`brew install <package-name>`,其中`<package-name>`是您想要安装的软件包的名称。 6. 您还可以使用`brew search <keyword>`来搜索特定关键词相关的软件包。 7. 要升级已安装的软件包,请使用`brew upgrade`命令。要查看已安装的软件包列表,请使用`brew list`命令。 8. 要卸载软件包,可以使用`brew uninstall <package-name>`命令。 以上就是在Mac上安装和使用Homebrew的步骤。Homebrew是一个非常方便的包管理工具,它可以帮助您轻松地安装和管理各种应用和工具,提高您的工作效率和便利性。 ### 回答3: 在Mac上安装Homebrew是相对简单的过程,只需按照以下步骤操作即可: 1. 打开终端:点击顶部菜单栏中的“应用程序”,然后进入“实用工具”文件夹并打开“终端”。 2. 安装Xcode命令行工具:在终端中输入以下命令并按下回车键: xcode-select --install 这将提示你安装Xcode命令行工具,若你已安装,会有提示信息显示。 3. 安装Homebrew:在终端中粘贴以下命令并按下回车键: /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" 这会自动下载并安装Homebrew。 4. 安装完成后,Homebrew会输出一些指导信息。确保按照提示进行任何额外的设置或操作。 5. 验证安装:输入以下命令验证Homebrew是否正确安装: brew doctor 这将检查你的安装并提供任何必要的建议或提示。 现在,你已成功在Mac上安装了Homebrew。你可以使用Homebrew来安装和管理各种软件包,只需在终端中输入相应的命令,比如: - brew install packageName:安装名为"packageName"的软件包。 - brew search packageName:搜索名为"packageName"的软件包。 - brew update:更新Homebrew软件包列表。 - brew upgrade:升级已安装的软件包。 希望以上步骤对你有所帮助!
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值