macos终端命令_M-cli为初学者简化了macOS的最佳终端命令

macos终端命令

macos终端命令

m-wifi

You can do a lot with the macOS Terminal, but the commands tend to be obtuse. A free program called m-cli bills itself a Swiss Army Knife for macOS, and it makes a lot of these hidden commands a lot easier to learn and discover.

您可以使用macOS Terminal进行很多操作,但是这些命令往往比较笨拙。 一个名为m-cli的免费程序本身就为macOS买了一把瑞士军刀,它使很多这些隐藏的命令更容易学习和发现。

Terminal commands are rarely intuitive. For example, if you want to add a recent items folder to your dock, this is the command:

终端命令很少直观。 例如,如果要将最新的项目文件夹添加到扩展坞,请使用以下命令:

defaults write com.apple.dock persistent-others -array-add '{ "tile-data" = {"list-type" = 1; }; "tile-type" = "recents-tile";}' && \killall Dock

defaults write com.apple.dock persistent-others -array-add '{ "tile-data" = {"list-type" = 1; }; "tile-type" = "recents-tile";}' && \killall Dock

Stare at this long enough and you can kind of figure out what it all means, but it’s hard to imagine many users discovering it on their own. With m-cli installed, however, the command is much easier:

凝视足够长的时间,您就可以弄清楚这意味着什么,但是很难想象有很多用户会自己发现它。 但是,安装了m-cli后,该命令将变得更加容易:

m dock addrecentitems

m dock addrecentitems

M-cli makes hundreds of similar functions easy to discover and execute. Here’s how to set it up, and what else you can do.

M-cli使数百种相似的功能易于发现和执行。 这是设置方法以及您还能执行的其他操作。

在macOS中安装M-CLI (Installing m-cli in macOS)

We’ve shown you how to install packages using Homebrew, and that’s the easiest way to install m-cli. Once you have Homebrew set up, open the Terminal (Applications > Utilities > Terminal), then run the following command:

我们已经向您展示了如何使用Homebrew安装软件包 ,这是安装m-cli的最简单方法。 设置Homebrew后,打开终端(应用程序>实用程序>终端),然后运行以下命令:

brew install m-cli

brew install m-cli

If you don’t have Homebrew set up, head to the m-cli page on Github for alternative installation instructions. Homebrew is going to be easier for you, however, and will also help keep everything up-to-date easily. (Not to mention it has a bunch of other useful tools.)

如果您没有设置Homebrew,请访问Github上m-cli页面以获取替代安装说明。 但是,自制软件将使您更轻松,并且也将帮助您轻松地使所有内容保持最新。 (更不用说它还有很多其他有用的工具。)

如何使用m-cli (How to Use m-cli)

The number of functions m-cli offers can be intimidating, but it’s ultimately quite simple. Most commands are just three words: m, followed by a two word command. To get started, type m help. This will give you a list of functions, which I also outline in the section below.

m-cli提供的功能数量可能令人生畏,但最终非常简单。 大多数命令只有三个单词: m ,后跟两个单词命令。 要开始使用,请输入m help 。 这将为您提供功能列表,我也在下面的部分中概述了这些功能。

m-help

Each of these commands can trigger at least one functionality. To find them, type m subcommand help. For example, here’s me exploring what dock can do:

这些命令中的每一个都可以触发至少一个功能。 要找到它们,请键入m subcommand help 。 例如,这是我在探索dock可以做什么:

m-dock

As you can see, dock offers several tweaks. In the above example I turned magnification on and off.

如您所见, dock提供了一些调整。 在上面的示例中,我打开和关闭了放大功能。

To learn a bit more, here’s a look at the bluetooth command.

要了解更多信息,请看一下bluetooth命令。

m-bluetooth

As you can see, I can quickly turn Bluetooth on and off, and check the current status.

如您所见,我可以快速打开和关闭蓝牙,并检查当前状态。

Finally, here’s the wifi command:

最后,这是wifi命令:

m-wifi

As you can see, I can turn the Wi-Fi on and offer, but also recover passwords for any network or scan all networks that are nearby.

如您所见,我可以打开Wi-Fi并提供服务,但是还可以恢复任何网络的密码或扫描附近的所有网络。

一切m-cli提供 (Everything m-cli Offers)

As we’ve said, there are 30 commands, all of which offer at least one sub-command. Here’s a quick outline of what all of these commands can do:

正如我们已经说过的,有30条命令,所有命令至少提供一个子命令。 这是所有这些命令可以做什么的简要概述:

  • battery: See current battery status.

    battery :请参阅当前电池状态。

  • bluetooth: See current Bluetooth status, turn Bluetooth on and off.

    bluetooth :查看当前的蓝牙状态,打开和关闭蓝牙。

  • dir: View trees of folders, quickly delete empty folders.

    dir :查看文件夹树,快速删除空文件夹。

  • disk: See information about connected drives, format drives, repair permissions.

    disk :查看有关已连接驱动器,格式化驱动器,修复权限的信息。

  • dns: Flush your DNS cache.

    dns :刷新您的DNS缓存。

  • dock: Change your Dock’s settings, or add a recent items folder.

    dock :更改Dock的设置,或添加一个最近的项目文件夹

  • finder: Toggle hidden files, extensions, and the desktop.

    finder :切换隐藏的文件,扩展名和桌面。

  • firewall: Disable or enable the macOS firewall.

    firewall :禁用或启用macOS防火墙。

  • gatekeeper: Disable or enable Gatekeeper.

    gatekeeper :禁用或启用Gatekeeper

  • group: View or change groups of users on your Mac.

    group :在Mac上查看或更改用户组。

  • hostname: View or change your Mac’s hostname

    hostname :查看或更改Mac的主机名

  • info: See what version of macOS you’re running.

    info :查看您正在运行的macOS版本。

  • lock: Lock your Mac.

    lock :锁定您的Mac。

  • network: See or change your current location.

    network :查看或更改您的当前位置。

  • nosleep: Stop your Mac from going to sleep, for a set number of seconds or until a particular command finishes.

    nosleep :在设定的秒数内或直到特定命令完成之前,停止Mac进入睡眠状态。

  • ntp: Toggle whether your Mac syncs its clock with a time server.

    ntp :切换Mac是否将其时钟与时间服务器同步。

  • restart: Tell your Mac to restart.

    restart :告诉Mac重新启动。

  • safeboot: Tell your Mac to restart in Safe Boot.

    safeboot :告诉您的Mac以安全启动方式重新启动

  • screensaver: Start the current default screensaver.

    screensaver :启动当前的默认屏幕保护程序。

  • service: See and monitor all currently running services.

    service :查看并监视所有当前正在运行的服务。

  • shutdown: Tell your Mac to shut down.

    shutdown :告诉您的Mac关闭。

  • sleep: Tell your Mac to go to sleep.

    sleep :告诉Mac进入睡眠状态。

  • timezone: Change your Mac’s timezone.

    timezone :更改Mac的时区。

  • trash: Empty your Mac’s Trash folder.

    trash :清空Mac的垃圾箱文件夹。

  • update: Update Mac App Store software without launching the App Store

    update :在不启动App Store的情况下更新Mac App Store软件

  • user: Manage users on your Mac.

    user :在Mac上管理用户。

  • volume: Change the volume on your Mac.

    volume :在Mac上更改音量。

  • vpn: Manage VPN connections.

    vpn :管理VPN连接。

  • wallpaper: Set your Mac’s wallpaper.

    wallpaper :设置Mac的墙纸。

  • wifi: Turn Wi-Fi on and off, retrieve your current Wi-Fi password, or scan all nearby networks.

    wifi :打开和关闭Wi-Fi,获取当前的Wi-Fi密码或扫描附近的所有网络。

Most of these things were possible to do from the command line before, but m-cli makes them a lot easier to discover and execute. If you’re a command line junkie, there’s no reason not to install it. And while you’re at it, check out these other command line tools for Mac users.

所有这些事情以前都可以从命令行完成,但是m-cli使它们更容易发现和执行。 如果您是命令行迷,则没有理由不安装它。 同时,请查看Mac用户的其他命令行工具

翻译自: https://www.howtogeek.com/281432/m-cli-simplifies-macos-best-terminal-commands-for-beginners/

macos终端命令

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值