本节的翻译还未完成。在未完成之前,所有的未完成部分都将使用英语原文。
Index
Windows and tabs
Settings
Colors
Keyboard shortcuts
Hints for working with the Terminal
Bash customization

terminal-icon_64.png终端

桌面栏:应用程序
位置:/boot/system/apps/Terminal
设置:~/config/settings/Terminal
~/config/settings/profile - 添加或者覆盖默认的 /boot/system/settings/etc/profile
~/config/settings/inputrc - 添加或者覆盖默认的 /boot/system/settings/etc/inputrc


The Terminal is Haiku's interface to the shell, by default that's bash, the Bourne Again Shell.

请参考 脚本 这一主题获取有关 Shel l的在线教程,同时也可以阅读 Haiku 的命令行程序。在本文中,我们重点关注终端本身的使用。

index 窗口与标签

You can open as many Terminals as needed, either each in its own window by simply launching more Terminals or with ALT N from an already running Terminal. Or you use Terminal's tabbed view and open more tabs with ALT T. You can switch to a specific tab with ALT and its number, e.g. ALT 2 switches to the second tab, ALT 4 to the fourth etc.

terminal.png

Double-clicking into the emtpy part of the tab bar opens a new tab; onto a tab opens a dialog to rename its title. There are several %-designated variables that are explained with a tooltip when you hover the mouse over the text field.
By default, %1d: %p, a tab shows the current directory and, separated by a :, the name of the currently running process (or -- if it's just bash running, probably idling). The screenshot above shows the first tab with a FTP session in the Desktop folder and a second tab idling at home.
Via Settings | Window title… the Terminal window's title can be edited in a similar way.

右键点击标签将会出现一个右键菜单:关闭标签关闭其他标签 或者,如双击,则显示 编辑标签主题...

终端的窗口和其他窗口一样可以调整尺寸,或者使用 设置 | 窗口大小 菜单中的预置尺寸。ALT ENTER 组合键将会切换到全屏模式。

All the settings you change directly through the Settings menu, like Window title, Window size, Text encoding or Font size are only kept for the current session. If you want to make permanent changes, you have to either invoke Save as default or apply them in the Settings… panel.

index 设置

Settings | Settings... 打开一个面板,用于配置终端的标准设置。

terminal-settings.png

Most of the offered settings speak for themselves. Not entirely obvious though, the font size is set in the submenu of the Font popup menu.
Hover your mouse over the "formulas" for naming tab and window titles to get tooltips for the available variables.

A few more options follow: you can have a Blinking cursor and choose to Allow bold text.
Use left Option as Meta key if you work with certain UNIX software that relies on accessing an extended portion of the ASCII character set, like e.g. GNU Emacs and the GNU readline library.
Activate the checkbox to Confirm exit if active programs exist and you'll be warned when trying to close a Terminal window while an app is still being executed.

保存为... 让您可以将不同的设置保存为独立文件,基于此,双击之后可以打看对应配置文件的终端窗口。
取消 撤销设置为最近打开设置面板时的状态。
Defaults 重置所有设置未默认值。

index Colors

Settings | Colors… opens a panel to configure the colors used by Terminal.

terminal-colors.png

From the top menu, you can choose a pre-defined Color scheme like Midnight or Retro or create a Custom one by selecting the color you want to change (Text, Background, Cursor etc.) and then use the color picker below.

You can also configure "ANSI colors", which are the first 8 named colors in the color palette of terminal applications. You choose a color, for example "ANSI red color", and then adjust it with the color picker below. The effect is visible live in the open Terminal and in the preview below. The exact colors used in various places are documented at Wikipedia.

保存为... let's you save your custom color scheme under a name that will appear in the Color scheme menu at the top, if you put it in the default location ~/config/settings/Terminal/Themes (or its system equivalent /boot/system/settings/Terminal/Themes).
取消 brings back the colors that were active when you opened the colors panel.
Defaults 重置所有设置未默认值。

index 键盘快捷键

您可以在 快捷键和组合键 主题中找到非常有用的快捷键的列表。

Another nice feature that is more a key & mouse combination: When holding ALT a path or URL under the mouse pointer gets highlighted. A left-click opens the file/folder or website. A right-click opens a context menu to either Copy path or Copy absolute path. Imagine you're in /MyData/source/haiku/ and have the path generated/objects/haiku/x86_gcc2/release/apps/stylededit/StyledEdit under the mouse pointer, the latter menu item will result in the combined, absolute path <deep breath>:
/MyData/source/haiku/generated/objects/haiku/x86_gcc2/release/apps/stylededit/StyledEdit.

如果您同时按下 ALT SHIFT 按键,那么只有鼠标移动起始位置之间的部分会被高亮显示。

提示一下,右键点击终端窗口,将会插入剪贴板内容。通过和拷贝高亮路径部分组合,该方法可用于快速导航到深层次目录。

index 关于终端的提醒

index Bash的定制

bash 来自于 Unix,它具有无数的可定制的方式。对于用户来讲,有两个文件至关重要: profileinputrc
这两个文件可以在 /boot/home/config/settings/ 文件夹中予以创建, 然后将会添加到或者覆盖在 /boot/system/settings/etc/ 中系统默认定义的配置文件。

profile

在您每次打开新的终端时, profile 都会被载入程序。在该文件中,设置了所有影响到 bash 行为和外观的各种类型的设备接口和变量。你可以在网络上找到许多资源,它们将会给出所有可能性的详细介绍。

Haiku/BeOS Tip Server 提供了许多入门的技巧,例如:

There are more, have a look.

inputrc

inputrc 用于处理键盘关联的配置。由于Haiku默认提供了非常有用的配置,您不需要修改相关的设置。如果您确实有特殊的需要,可以参考许多在线的资源,例如 GNU 的命令行读取库