Index |
Windows and tabs Settings Colors Keyboard shortcuts Hints for working with the Terminal Bash customization |
Terminal
Deskbar: | ||
Lokasi: | /boot/system/apps/Terminal | |
Pengaturan: | ~/config/settings/Terminal ~/config/settings/profile - menambah/menimpa setting bawaan di /boot/system/settings/etc/profile ~/config/settings/inputrc - menambah/menimpa setting bawaan di /boot/system/settings/etc/inputrc |
The Terminal is Haiku's interface to the shell, by default that's bash, the Bourne Again Shell.
Silakan merujuk ke topik tentang Scripting untuk beberapa tautan ke tutorial online tentang cara bekerja di shell dan lihat juga aplikasi commandline Haiku. Di sini, kita akan berkonsentrasi pada aplikasi Terminal itu sendiri.
Windows dan tab
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.
Right-clicking a tab shows a context menu to
, or, like double-clicking,A Terminal window can be resized like any other window or you use the presets from the ALT ENTER toggles fullscreen mode.
menu.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.Settings
opens a panel to configure the standard settings of a Terminal.
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.
let's you save different settings as separate profiles, which on double-click open an accordingly configured Terminal. | ||
brings back the settings that were active when you opened the settings panel. | ||
mengatur ulang semuanya ke nilai bawaan. |
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. | ||
mengatur ulang semuanya ke nilai bawaan. |
Pintasan Keyboard
You'll find a list of useful shortcuts in Shortcuts and key combinations.
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.
If you hold down ALT SHIFT, only the path from beginning to where your mouse pointer sits will be highlighted.
By the way, right-clicking into the Terminal window will insert the clipboard. In combination with copying parts of highlighted paths, this can be used for speedy navigation of deep folder hierarchies.
Hints for working with the Terminal
Dragging a file or folder from a Tracker window into the Terminal will insert its path at the location of the cursor. Dragging with the right mouse button offers additional actions in a context menu:
Inserts the location of the file, same as drag & dropping with the left mouse button. Changes to the folder of the dragged file. Creates a link to the dragged file in the current working directory of the Terminal. Moves the dragged file into the current working directory of the Terminal. Copies the dragged file into the current working directory of the Terminal. 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 customization
Coming from Unix, there are countless possibilities to customize the bash itself. There are two files that are especially important to the user: profile and inputrc
Both files can be created in the /boot/home/config/settings/ folder and add or override the system defaults that are defined in /boot/system/settings/etc/.
profile
The profile is loaded every time you open a new Terminal. It sets all kinds of aliases and variables that will affect bash's behavior and appearance. You'll find many online resources that will detail all possibilities.
The Haiku/BeOS Tip Server has quite a few tips to get you started, for example:
There are more, have a look.
inputrc
The inputrc deals with keybindings. Since Haiku provides useful defaults, you probably don't have to mess with these more involved settings. If you do have special needs here, consult one of the many online resources, e.g. The GNU Readline Library.