<p>All commandline applications shipped with Haiku are in <spanclass="path">/boot/system/bin/</span>. Your own or additionally installed commandline apps will appear there as well, or in <spanclass="path">~/config/bin/</span>, when installed from a .hpkg package. Otherwise you can put them into <spanclass="path">/boot/system/non-packaged/bin/</span> or <spanclass="path">~/config/non-packaged/bin/</span>. All these locations are part of the PATH variable and are therefore automatically found.<br/>
The following isn't an exhaustive list of all Haiku-specific CLI apps, it serves just to highlight a few of the most useful to give you a taste. Feel encouraged to explore what's in the <spanclass="path">bin/</span> folders on your own a bit. Executing an app with the parameter <tt>--help</tt> shows the usage of the command and all its various options.</p>
<aid="cli-attributes"name="cli-attributes">Приложения для работы с атрибутами: <spanclass="cli">listattr</span>, <spanclass="cli">catattr</span>, <spanclass="cli">addattr</span>, <spanclass="cli">rmattr</span>, <spanclass="cli">copyattr</span></a></h3>
<p>Эти команды предназначены для отображения, извлечения, добавления и удаления атрибутов файлов. Помните, что в данный момент эти мета-данные доступны только на разделах, отформатированных в BFS. Перемещение файлов на другие файловые системы приведут к потере мета-данных!<br/>
<aid="cli-index"name="cli-index">Приложения для работы с индексами: <spanclass="cli">lsindex</span>, <spanclass="cli">mkindex</span>, <spanclass="cli">reindex</span>, <spanclass="cli">rmindex</span></a></h3>
<p>С помощью этих команд вы можете получить список атрибутов BFS, произвести их переиндексацию или удаление. Каждый раздел имеет собственный индекс, сохраняющийся при копировании файлов между разделами.<br/>
<p>The <spanclass="cli">package</span> command is used to manage HPKG packages. Have a look at the article <ahref="https://www.haiku-os.org/guides/daily-tasks/install-applications">Installing applications</a> to learn the very basics. Usually the tool <ahref="https://github.com/haikuports/haikuports/wiki">haikuporter</a> is used to automatically create packages from so-called recipes.</p>
<p><spanclass="cli">pkgman</span> is used to search, install, update and uninstall packages. Package repositories can be added, dropped and their package lists refreshed. A special kind of update is invoked with the parameter <tt>full-sync</tt>: it is more aggressive and also downgrades or removes packages, if necessary.<br/>
<p>Утилиты командной строки, приведенные ниже, особенно полезны для написания скриптов (смотрите тему <ahref="../bash-scripting.html">Bash и скрипты</a>).</p>
<tdvalign="top"><p><spanclass="cli">alert</span> вызывает обычное окно предупрежния с заранее опеределенными иконкой, пояснительным текстом и кнопками (до трех). Например, следующая строка выведет на экран:</p>
<tdvalign="top"><p><spanclass="cli">filepanel</span> отображает диалог загрузки или сохранения файла, позволяя пользователю выбрать файл или путь. В качестве возвращаемой величины будет передано имя файла или путь к папке. Для изменния доступны несколько параметров, таких как начальная папка, заголовок окна, имя для сохраняемого файла по умолчанию и ограничения на разрешенные типы файлов. Приведем пример: </p>
<tdvalign="top"><p><spanclass="cli">hey</span> is a littler helper tool that sends BMessages to applications and prints out their answer. It can be used for application scripting, i.e. "remote controlling" a program from a script or the command line. It's usage is a bit complex... <ahref="https://www.haiku-os.org/blog/humdinger/2017-11-05_scripting_the_gui_with_hey/">Humdinger's blog post</a> serves as a good introduction, and thanks to Scot Hacker's BeOS Bible, there is a much more comprehensive <ahref="http://www.birdhouse.org/beos/bible/bos/ch_scripting6.html">hey tutorial</a> by Chris Herborth.</p>
<tdvalign="top"><p><spanclass="cli">notify</span> shows a notification panel with a message. There are various parameters that are described when you call <spanclass="cli">notify --help</span>. A notification can also be used to show the progress of some action. When doing that, it's important to set a <i>messageID</i> and always use it when you update the progress (a float between 0.0 and 1.0 that's printed as percent). Otherwise you'll see several notification panels if you update quicker then the set timeout.<br/>
<tdvalign="top"><p><spanclass="cli">query</span> является аналогом панели "Найти", выполненным для командной строки. Существует способ быстрого создания правила поиска: постройте запрос в панели "Найти", переключитесь в режим <spanclass="menu">по формуле</span>, добавьте двойные кавычки (<tt>"</tt>) в начале и в конце и вставьте строку после комманды <spanclass="cli">query</span> в Терминале или вашем скрипте.</p>
<td><p><spanclass="cli">checkfs</span> is an important tool to check for errors in your file system. Simply add a volume name like <spanclass="path">/Haiku</span> or device path and it'll run through every file and correct inconsistencies where possible.</p>
<tdvalign="top"><p><spanclass="cli">desklink</span> помещает иконку для любого файла, папки, запроса или приложения в трей Deskbar, и позволяет назначить контекстное меню, вызываемое правым кликом мыши по иконке для выполнения специальных действий. В качестве примера, попробуйте добавить приложение командной строки <spanclass="app">screenshot</span>с несколькими параметрами ("<tt>\\</tt>" в первой строке используется для разрыва строки в Terminal):</p>
<tdvalign="top"><p><spanclass="cli">diskimage</span> lets you register a regular file as disk device. For example, you can register a Haiku anyboot image, mount it in Tracker and copy, edit or remove files there before using it as source in the Installer.</p>
<tdvalign="top"><p>The launch_daemon starts all sorts of services and applications at boot-up. For some it was instructed to re-start them if they were quit. If you don't want that – maybe you'd like to test a modified Tracker, for example – you use <spanclass="cli">launch_roster</span> to <tt>stop</tt> the re-starting of the application before quitting it. Similarly, you can <tt>start</tt> it again or get <tt>info</tt> about it.c The parameter <tt>log</tt> prints out a log of all launch_daemon related events.<br/>
Without parameter, <spanclass="cli">launch_roster</span> lists all apps/services that are under its control.<br/>
<tdvalign="top"><p><spanclass="cli">mountvolume</span> is preferred by many to mount local partitions and disks, because its usage is so easy: just call it with the name of the partition and you're done. Try <tt>--help</tt> for more options.</p>
<p><spanclass="cli">mount</span> can additionally mount remote disks by using a network filesystem, like NFS4. You specify the used filesystem with the <tt>-t</tt> parameter and the remote location with the <tt>-p</tt> parameter. As filesystem parameter you can use anything you find in <spanclass="path">/system/add-ons/kernel/file_system</span> (and corresponding file hierarchies under <spanclass="path">~/config</span> or "<spanclass="path">non-packaged</span>", of course). You also have to create a folder as mountpoint. Here's an example:</p>
<preclass="terminal">mkdir -p /DiskStation
mount -t nfs4 -p "192.168.178.3:volume1" /DiskStation</pre></td></tr>
<tdvalign="top"><p><spanclass="cli">open</span> очень полезный инструмент. Сего помощью вы сможете открыть любой файл в предпочитаемом приложении, либо запустить приложение по его сигнатуре, не указывая точный путь до него. Это применимо к URL и "виртуальным" папкам <tt>.</tt> для текущей папки и <tt>..</tt> для родительской папки - они откроются в Tracker.</p>
<tdvalign="top"><p>A ramdisk is like a harddisk running only in the computer's memory. That makes it very fast but also volatile, because its contents vanishes when you shut down the computer, or it crashes or you experience a blackout.<br/>
To create a ramdisk of 1 GiB, format to the name "RAMses" and mount it, you enter this in Terminal or create a script of it:</p>
<preclass="terminal">ramdisk create -s 1gb
mkfs -q -t bfs /dev/disk/virtual/ram/0/raw RAMses
mountvolume RAMses</pre>
<p>Note: When creating a ramdisk, the <spanclass="cli">ramdisk</span> command prints out the path to it. If you create several disks, that path <spanclass="path">/dev/disk/virtual/ram/0/raw</span> will change!</p>
<p>To preserve the contents, at least if no calamity like a blackout etc. strikes, a ramdisk can be set up to read/write an image on the harddisk. For that, you need to supply a file of the desired size that will be read from every time you start your ramdisk, and written to when you unmount it. To create an image file "RAMimage" of 500MiB and format it, do this:</p>
<p>From now on, you start the ramdisk like this:</p>
<preclass="terminal">ramdisk create RAMimage
mountvolume RAMimage</pre>
<p>It's very important to always cleanly unmount you ramdisk, either from Tracker or with <spanclass="cli">unmount /RAMimage</span>, or the changes won't be written back to the image file!</p>