macOS终端中隐藏的最佳“娱乐性”技巧

tetris-featured

Some people find the macOS Terminal scary, and that makes sense. Commands can feel alienating, and learning to use them takes time. It’s hard to find a starting point.

有些人发现macOS Terminal令人恐惧,这是有道理的。 命令可能会感到疏远,学习使用命令需要时间。 很难找到起点。

We’ve shown you how to navigate using the Terminal, and a bunch of cool Terminal tricks, but it can all seem a little stale when you’re getting started. Isn’t there anything fun you can do with this text box?

我们已经向您展示了如何使用Terminal进行导航 ,以及一系列不错的Terminal技巧 ,但是当您开始使用时,它们似乎都有些陈旧。 使用此文本框没有任何乐趣吗?

Yes there is. Here are a few highlights to get started with.

就在这里。 以下是一些入门要点。

让Mac大声说出一切(用Siri的声音!) (Make Your Mac Say Anything Out Loud (In Siri’s Voice!))

Here’s a fun place to start: you can make your Mac say anything, out loud, with a quick Terminal command. Just type say followed by whatever phrase you want your computer to say.

这是一个有趣的起点:您可以使用快速的Terminal命令使Mac大声说出来。 只需键入say然后输入您想让计算机说的任何短语即可。

mac-talking-horray

The voice used depends on what you’ve chosen as the default voice in System Preferences > Accessibility > Speech. If you want it to sound like Siri’s iconic American voice, pick “Samantha.”

使用的语音取决于您在系统偏好设置>辅助功能>语音中选择作为默认语音的语言。 如果您希望它听起来像Siri的标志性美国声音,请选择“ Samantha”。

mac-voice

You can also specify which voice the command should use without changing the default, if you want to get fancy, by using the -voice option. For example, if you wanted to hear some text sung like a bell ringing, run say -v bells followed by your text. Note that you’ll have to install voices you want to use in System Preferences.

如果您想花哨的话,还可以使用-voice选项指定命令应使用哪种声音而不更改默认值。 例如,如果您想听到一些像铃声一样的文字,请运行say -v bells然后再输入文字。 请注意,您必须在系统偏好设置中安装要使用的声音。

Finally, if you’re good with the Terminal, you can pipe the output of another command into say. Here’s a command that will get your Mac to state the current time, out loud:

最后,如果您对Terminal感到满意,则可以将另一个命令的输出通过管道传递到say 。 这是一个命令,可使您的Mac大声说出当前时间:

date "+The time is %H:%M" | say

Neat, isn’t it? Have fun thinking of other things to do with this.

整洁,不是吗? 乐于思考与此有关的其他事情。

玩简单的游戏,例如俄罗斯方块,傍和蛇 (Play Simple Games Like Tetris, Pong, and Snake)

First, type emacs. This is going to launch the famous open source text editor, which you can learn to use if you’ve got a few years spare time.

首先,键入emacs 。 这将启动著名的开源文本编辑器,如果您有几年的业余时间 ,可以学习使用。

emacs-launch

For now we’re going to press Escape, followed by “X.” This will enable a text field for commands at the bottom on the screen.

现在,我们要按Escape键,然后按“ X”。 这将在屏幕底部为命令启用文本字段。

emacs-escape-x

Type tetris and hit Return. The game will launch.

键入tetris并单击Return。 游戏将启动。

emacs-terminal-tetris

Move the pieces with your arrow keys, and drop them with Space. It’s clumsy, but it’s a version of Tetris that came with your Mac.

使用箭头键移动片段,并使用空格将其放下。 这很笨拙,但这是Mac随附的Tetris版本。

You can launch other games from Emacs, too. Repeat the steps above, then type these words instead of tetris to launch alternative games:

您也可以从Emacs启动其他游戏。 重复上述步骤,然后输入以下单词而不是俄罗斯方块来启动其他游戏:

  • pong: the classic line and pixel tennis game.

    pong :经典的线条和像素网球游戏。

  • snake: eat to become bigger, but don’t hit your tail.

    snake :进食变大,但不要撞到尾巴。

  • solitaire: not the card game. Instead, you need to hold Shift to jump pegs over each other. Can you win cleanly?

    solitaire :不是纸牌游戏。 相反,您需要按住Shift键才能将钉子彼此跳过。 你能干净利落吗?

  • dunnet: a simple text adventure game.

    dunnet :一个简单的文字冒险游戏。

These are the main highlights, but there are a few more diversions. Here’s the official list, from the Emacs wiki. Let’s highlight one more in its own section.

这些是主要亮点,但还有更多转移。 这是 Emacs Wiki 上的官方列表 。 让我们在其自己的部分中再强调一个。

与虚拟治疗师交谈 (Talk to a Virtual Therapist)

This is technically an extension of the diversions above, but it’s too fun to skip. Follow the steps above, launching emacs then hitting Escape and X, then type “doctor.” Your computer will now play the role of a psychoanalyst.

从技术上讲,这是上述转换的扩展,但是跳过实在太有趣了。 请按照上述步骤操作,启动emacs,然后按Escape和X,然后键入“ doctor”。 您的计算机现在将扮演心理分析家的角色。

emacs-terminal-doctor

It took a bit of conversation, but I eventually found the source of most of my problems in life.

进行了一些交谈,但最终我找到了生活中大多数问题的根源。

doctor-followup

Needless to say, your Mac is not a medical professional. Do not take medical advice from your Mac.

不用说,您的Mac不是医学专家。 请勿从Mac接受医疗建议。

其他一些命令 (A Few More Commands)

There are a few more things that, while not exactly “fun,” are neat for first-time Terminal users to discover. Here’s a quick list:

还有一些东西,虽然不完全是“有趣”,但对于初次使用终端的用户来说却是整洁的。 快速清单:

There’s a whole lot more we could dig into, but the really fun stuff involves installing third party software. Our advice: set up Homebrew to install command line tools on your Mac, then check out our list of best command line tools you can get with Homebrew. You can do crazy things like listening to Pandora in your Terminal, so it’s well worth the effort.

我们还有很多可以挖掘的东西,但是真正有趣的东西包括安装第三方软件。 我们的建议: 设置Homebrew在Mac上安装命令行工具 ,然后查看我们可以从Homebrew获得最佳命令行工具列表。 您可以做一些疯狂的事情,例如在终端机中收听Pandora,因此值得付出努力。

pianobar-terminal-mac

翻译自: https://www.howtogeek.com/291940/the-best-just-for-fun-tricks-hidden-in-macos-terminal/

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值