os x 终端 删除命令
Using the Terminal in OS X is probably the most powerful and immediate way to affect deep changes on your Mac. If you’re a fan of using the command line, then it’s always nice to learn a new trick.
在OS X中使用终端可能是影响Mac上的深层更改的最强大,最直接的方法。 如果您喜欢使用命令行,那么学习新技巧总是很高兴的。
We’re never opposed to learning new ways to “hack” OS X through the Terminal. For example, we know we can prevent our Mac from sleeping using the “Caffeinate” command. Another great trick is to change where OS X automatically saves screenshots.
我们从不反对学习通过终端“入侵” OS X的新方法。 例如, 我们知道可以使用“ Caffeinate”命令阻止Mac进入睡眠状态。 另一个很棒的技巧是更改OS X自动保存屏幕截图的位置 。
Today’s trick comes in the form of marks. Marks work much like bookmarks in that they allow you to execute commands and mark positions that you can come back to later in time.
今天的把戏以标记的形式出现。 标记的工作方式与书签非常相似,因为它们使您可以执行命令并标记可以稍后返回的位置。
However, bookmarks are different in that they persist from Terminal window/tab to Terminal window/tab. Marks only apply to a single window or tab. Neither will last however, after you exit out of Terminal.
但是,书签的不同之处在于它们从“终端”窗口/选项卡保留到“终端”窗口/选项卡。 标记仅适用于单个窗口或选项卡。 但是,退出终端之后,两者都不会持续。
标记的工作方式 (How Marks Work)
Every time you press “Enter” in a Terminal window, the line will be marked by inserting a bracket at the beginning of a command.
每次在“终端”窗口中按“ Enter”时,将在命令开头插入方括号来标记该行。
You can then jump through marks by using “Command+Up” or “Command+Down”.
然后,您可以使用“ Command +向上”或“ Command +向下”跳过标记。
So that’s pretty easy and straightforward, how then do you configure marks behavior?
因此,这非常简单明了,那么如何配置标记行为呢?
If you want to outright disable marks, then you can do so from the Terminal’s Edit menu, Edit > Marks > Automatically Mark Prompt Lines. However, you can still mark a command by using the keyboard combination Command+Enter.
如果要彻底禁用标记,则可以从终端的“编辑”菜单,依次单击“编辑”>“标记”>“自动标记提示行”。 但是,您仍然可以使用组合键Command + Enter标记命令。
Alternatively, if you want to leave automatic marking enabled, but skip a line, then you can use Command+Shift+Enter.
或者,如果要保留自动标记功能,但跳过一行,则可以使用Command + Shift + Enter。
Of course, you may want to retain all the power that marks have to offer, but simply wish not to see them. In that case, go to the View menu and select “Hide Marks”.
当然,您可能希望保留商标必须提供的所有功能,但只是希望不要看到它们。 在这种情况下,请转到“查看”菜单,然后选择“隐藏标记”。
Let’s say you have automatic marking disabled and you forget to mark an important line as you’re flying through your commands. You can still manually mark a line by selecting in the Terminal window with the mouse and then using Edit > Marks > Mark as Prompt, or through the keyboard shortcut Command+U.
假设您禁用了自动标记,并且在浏览命令时忘记标记重要的行。 您仍然可以通过以下方法手动标记一条线:用鼠标在“终端”窗口中选择,然后使用“编辑”>“标记”>“标记为提示”,或通过键盘快捷键Command + U。
Finally, there’s one more really useful command you can glean from this newfound Terminal power. To select content automatically, add Shift. In other words, if there’s a particularly command you want to copy and use again or you want to copy log output or something of that nature, use Command+Shift+Up or Command+Shift+Down.
最后,您可以从这个新发现的终端功能中收集到一个更有用的命令。 要自动选择内容,请添加Shift。 换句话说,如果有一个特别的命令要复制并再次使用,或者要复制日志输出或类似性质的命令,请使用Command + Shift + Up或Command + Shift + Down。
Now, you can simply copy the output to the clipboard for pasting into something else, such as if diagnosing a problem or demonstrating a point.
现在,您可以简单地将输出复制到剪贴板以粘贴到其他内容中,例如诊断问题或演示要点。
Adding marks to your Terminal skills is a powerful way to breeze through multiple screens of output with great ease. Better still, you can pick and choose your way by deciding whether or not you want to use marks or when you use them.
在终端技能中添加标记是一种轻松轻松地通过多个输出屏幕轻而易举的有效方法。 更好的是,您可以通过选择是否要使用标记或何时使用标记来选择方式。
In this way, you’ll never lose your place, or you do, you’ll be able to find it again quickly and easily.
这样,您将永远不会丢失自己的位置,否则,您将能够快速,轻松地再次找到它。
翻译自: https://www.howtogeek.com/256548/how-to-use-marks-in-os-xs-terminal-for-easier-navigation/
os x 终端 删除命令