Index |
Windows and tabs Settings Colors Keyboard shortcuts Hints for working with the Terminal Bash customization |
终端
桌面栏: | ||
位置: | /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 的命令行程序。在本文中,我们重点关注终端本身的使用。
窗口与标签
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.
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 the Terminal window's title can be edited in a similar way.
右键点击标签将会出现一个右键菜单:
, 或者,如双击,则显示 。终端的窗口和其他窗口一样可以调整尺寸,或者使用 ALT ENTER 组合键将会切换到全屏模式。
菜单中的预置尺寸。All the settings you change directly through the
menu, like , , or are only kept for the current session. If you want to make permanent changes, you have to either invoke or apply them in the panel.设置
打开一个面板,用于配置终端的标准设置。
Most of the offered settings speak for themselves. Not entirely obvious though, the font size is set in the submenu of the
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
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 and you'll be warned when trying to close a Terminal window while an app is still being executed.
让您可以将不同的设置保存为独立文件,基于此,双击之后可以打看对应配置文件的终端窗口。 | ||
撤销设置为最近打开设置面板时的状态。 | ||
重置所有设置未默认值。 |
Colors
opens a panel to configure the colors used by Terminal.
From the top menu, you can choose a pre-defined
like or or create a one by selecting the color you want to change ( , , 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 ~/config/settings/Terminal/Themes (or its system equivalent /boot/system/settings/Terminal/Themes). | menu at the top, if you put it in the default location||
brings back the colors that were active when you opened the colors panel. | ||
重置所有设置未默认值。 |
键盘快捷键
您可以在 快捷键和组合键 主题中找到非常有用的快捷键的列表。
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 or . 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 按键,那么只有鼠标移动起始位置之间的部分会被高亮显示。
提示一下,右键点击终端窗口,将会插入剪贴板内容。通过和拷贝高亮路径部分组合,该方法可用于快速导航到深层次目录。
关于终端的提醒
从文件浏览器窗口中拖拽文件或者文件夹到终端将会在光标的位置插入它的路径。而使用右键拖拽将会弹出一个右键菜单,显示附加的操作:
插入一个文件的路径,与左键拖拽文件到终端类似。 切换到所拖拽文件所在的文件夹。 在终端当前工作的目录为拖拽的文件创建链接。 移动拖拽的文件到终端当前工作的目录。 复制拖拽的文件到终端当期工作的目录。 You can open any file with its preferred application with the command open [filename]. This also works with the representation of the current (".") and parent ("..") folder which then open in a Tracker window. So, to open the current working directory, you type:
open .
If a command generates lots of output, things scroll by rapidly. Use a few of those commands and it gets difficult to scroll back and find the start of the last output. With ALT L you can clear the scroll back buffer before issuing your command. Presto, a pristine empty scroll back buffer, you can just scroll back right to the top to catch the beginning of your output.
or
Bash的定制
bash 来自于 Unix,它具有无数的可定制的方式。对于用户来讲,有两个文件至关重要: profile 和 inputrc 。
这两个文件可以在 /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 的命令行读取库 。