haiku/docs/userguide/ru/applications/cli-apps.html
Automatic Committer 64b20c9e12 Update userguide and translations
(note from waddlesplash: fixed xml:lang tags, responsive viewport
everywhere, CSS tweaks.)
2017-10-01 13:21:40 +02:00

171 lines
18 KiB
HTML
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="ru" xml:lang="ru">
<head>
<!--
*
* Copyright 2010-2016, Haiku. All rights reserved.
* Distributed under the terms of the MIT License.
*
* Authors:
* Humdinger <humdingerb@gmail.com>
* Translators:
* Rodastahm Islamov
* mrNoisy
*
-->
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<meta http-equiv="Content-Style-Type" content="text/css" />
<meta name="robots" content="all" />
<title>Haiku-приложения для командной строки</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<link rel="stylesheet" type="text/css" href="../../Haiku-doc.css" />
</head>
<body>
<div id="banner">
<div><span>Руководство пользователя</span></div>
</div>
<div class="nav">
<div class="inner">
<ul class="lang-menu">
<li class="now"><img src="../../images/flags/ru.png" alt="" /> Русский</li>
<li><a href="../../ca/applications/cli-apps.html"><img src="../../images/flags/ca.png" alt="" />Català</a></li>
<li><a href="../../de/applications/cli-apps.html"><img src="../../images/flags/de.png" alt="" />Deutsch</a></li>
<li><a href="../../en/applications/cli-apps.html"><img src="../../images/flags/gb.png" alt="" />English</a></li>
<li><a href="../../es/applications/cli-apps.html"><img src="../../images/flags/es.png" alt="" />Español</a></li>
<li><a href="../../fr/applications/cli-apps.html"><img src="../../images/flags/fr.png" alt="" />Français</a></li>
<li><a href="../../it/applications/cli-apps.html"><img src="../../images/flags/it.png" alt="" />Italiano</a></li>
<li><a href="../../hu/applications/cli-apps.html"><img src="../../images/flags/hu.png" alt="" />Magyar</a></li>
<li><a href="../../pl/applications/cli-apps.html"><img src="../../images/flags/pl.png" alt="" />Polski</a></li>
<li><a href="../../pt_PT/applications/cli-apps.html"><img src="../../images/flags/pt_PT.png" alt="" />Português</a></li>
<li><a href="../../pt_BR/applications/cli-apps.html"><img src="../../images/flags/pt_BR.png" alt="" />Português (Brazil)</a></li>
<li><a href="../../ro/applications/cli-apps.html"><img src="../../images/flags/ro.png" alt="" />Română</a></li>
<li><a href="../../sk/applications/cli-apps.html"><img src="../../images/flags/sk.png" alt="" />Slovenčina</a></li>
<li><a href="../../fi/applications/cli-apps.html"><img src="../../images/flags/fi.png" alt="" />Suomi</a></li>
<li><a href="../../sv_SE/applications/cli-apps.html"><img src="../../images/flags/sv_SE.png" alt="" />Svenska</a></li>
<li><a href="../../zh_CN/applications/cli-apps.html"><img src="../../images/flags/zh_CN.png" alt="" /> 中文 [中文]</a></li>
<li><a href="../../uk/applications/cli-apps.html"><img src="../../images/flags/uk.png" alt="" />Українська</a></li>
<li><a href="../../jp/applications/cli-apps.html"><img src="../../images/flags/jp.png" alt="" />日本語</a></li>
</ul>
<span>
 «  <a href="list-cli-apps.html">List of commands</a> 
::  <a href="../applications.html#cli-apps" class="uplink">Applications</a> 
</span></div>
</div>
<div id="content">
<div>
<div class="box-info">Перевод этой страницы еще не завершен. Пока это не произойдет, незавершенные части будут на английском.</div>
<h2><img src="../../images/apps-images/cli-app-icon_64.png" alt="cli-app-icon_64.png" width="64" height="64" />Haiku-приложения для командной строки</h2>
<table summary="layout" border="0" cellspacing="0" cellpadding="2">
<tr><td>Расположение в Tracker:</td><td style="width:15px;"></td><td><span class="path">/boot/system/bin/</span><br />
<span class="path">/boot/system/non-packaged/bin/</span><br /><span class="path">~/config/bin/</span><br /><span class="path">~/config/non-packaged/bin/</span></td></tr>
</table>
<p><br /></p>
<p>All commandline applications shipped with Haiku are in <span class="path">/boot/system/bin/</span>. Your own or additionally installed commandline apps will appear there as well, or in <span class="path">~/config/bin/</span>, when installed from a .hpkg package. Otherwise you can put them into <span class="path">/boot/system/non-packaged/bin/</span> or <span class="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 <span class="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>
<h3><a href="#"><img src="../../images/up.png" style="border:none;float:right" alt="index" /></a>
<a id="cli-attributes" name="cli-attributes">Приложения для работы с атрибутами: <span class="cli">listattr</span>, <span class="cli">catattr</span>, <span class="cli">addattr</span>, <span class="cli">rmattr</span>, <span class="cli">copyattr</span></a></h3>
<p>Эти команды предназначены для отображения, извлечения, добавления и удаления атрибутов файлов. Помните, что в данный момент эти мета-данные доступны только на разделах, отформатированных в BFS. Перемещение файлов на другие файловые системы приведут к потере мета-данных!<br />
Перечисленные команды описаны в теме <a href="../attributes.html#attributes-terminal">Работа с атрибутами в Терминале</a>.</p>
<h3><a href="#"><img src="../../images/up.png" style="border:none;float:right" alt="index" /></a>
<a id="cli-index" name="cli-index">Приложения для работы с индексами: <span class="cli">lsindex</span>, <span class="cli">mkindex</span>, <span class="cli">reindex</span>, <span class="cli">rmindex</span></a></h3>
<p>С помощью этих команд вы можете получить список атрибутов BFS, произвести их переиндексацию или удаление. Каждый раздел имеет собственный индекс, сохраняющийся при копировании файлов между разделами.<br />
Эти команды описаны в теме <a href="../index.html">Индексация</a>.</p>
<h3><a href="#"><img src="../../images/up.png" style="border:none;float:right" alt="index" /></a>
<a id="cli-pkg" name="cli-pkg">Relating to package management: <span class="cli">package</span>, <span class="cli">pkgman</span></a></h3>
<p>The <span class="cli">package</span> command is used to manage HPKG packages. Have a look at the article <a href="https://www.haiku-os.org/guides/daily-tasks/install-applications">Installing applications</a> to learn the very basics. Usually the tool <a href="https://github.com/haikuports/haikuports/wiki">haikuporter</a> is used to create so-called recipes for automatic package building.</p>
<p><span class="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 />
For more details on a parameter, append "--help", e.g. <tt>pkgman search --help</tt>.</p>
<h3><a href="#"><img src="../../images/up.png" style="border:none;float:right" alt="index" /></a>
<a id="cli-scripting" name="cli-scripting">Полезные скриптовые команды</a></h3>
<p>Утилиты командной строки, приведенные ниже, особенно полезны для написания скриптов (смотрите тему <a href="../bash-scripting.html">Bash и скрипты</a>).</p>
<table summary="scripting cli tools" border="0" cellpadding="2" cellspacing="0">
<tr><td><p><span class="cli">alert</span></p></td><td style="width:10px;"> </td>
<td valign="top"><p><span class="cli">alert</span> вызывает обычное окно предупрежния с заранее опеределенными иконкой, пояснительным текстом и кнопками (до трех). Например, следующая строка выведет на экран:</p>
<pre class="terminal">alert --idea "FantasticApp(tm) installed successfully!
Would you like a link to it?" "On Desktop" "In Deskbar" "No thanks"</pre>
<p><img src="../images/apps-images/cli-alert.png" alt="cli-alert.png" /></p>
</td></tr>
<tr><td><p><span class="cli">filepanel</span></p></td><td style="width:10px;"> </td>
<td valign="top"><p><span class="cli">filepanel</span> отображает диалог загрузки или сохранения файла, позволяя пользователю выбрать файл или путь. В качестве возвращаемой величины будет передано имя файла или путь к папке. Для изменния доступны несколько параметров, таких как начальная папка, заголовок окна, имя для сохраняемого файла по умолчанию и ограничения на разрешенные типы файлов. Приведем пример: </p>
<pre class="terminal">filepanel -s -t "Save your logfile" -d ~/config/settings -n Fantastic.log</pre>
<p><img src="../images/apps-images/cli-filepanel.png" alt="cli-alert.png" /></p>
</td></tr>
<tr><td><p><span class="cli">hey</span></p></td><td style="width:10px;"> </td>
<td valign="top"><p><span class="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... Thanks to Scot Hacker's BeOS Bible, there's a nice <a href="http://www.birdhouse.org/beos/bible/bos/ch_scripting6.html">hey tutorial</a> by Chris Herborth.</p>
</td></tr>
<tr><td><p><span class="cli">query</span></p></td><td style="width:10px;"> </td>
<td valign="top"><p><span class="cli">query</span> является аналогом панели "Найти", выполненным для командной строки. Существует способ быстрого создания правила поиска: постройте запрос в панели "Найти", переключитесь в режим <span class="menu">по формуле</span>, добавьте двойные кавычки (<tt>"</tt>) в начале и в конце и вставьте строку после комманды <span class="cli">query</span> в Терминале или вашем скрипте.</p>
</td></tr>
<tr><td><p><span class="cli">waitfor</span></p></td><td style="width:10px;"> </td>
<td valign="top"><p><span class="cli">waitfor</span> удобный способ для ожидания запуска или завершения работы какого-либо приложения или нити.</p>
</td></tr></table>
<h3><a href="#"><img src="../../images/up.png" style="border:none;float:right" alt="index" /></a>
<a id="cli-other" name="cli-other">Другие команды</a></h3>
<table summary="scripting cli tools" border="0" cellpadding="2" cellspacing="0">
<tr><td><p><span class="cli">checkfs</span></p></td><td style="width:10px;"> </td>
<td><p><span class="cli">checkfs</span> is an important tool to check for errors in your file system. Simply add a volume name like <span class="path">/Haiku</span> or device path and it'll run through every file and correct inconsistencies where possible.</p>
</td></tr>
<tr><td><p><span class="cli">desklink</span></p></td><td style="width:10px;"> </td>
<td valign="top"><p><span class="cli">desklink</span> помещает иконку для любого файла, папки, запроса или приложения в трей Deskbar, и позволяет назначить контекстное меню, вызываемое правым кликом мыши по иконке для выполнения специальных действий. В качестве примера, попробуйте добавить приложение командной строки <span class="app">screenshot</span> с несколькими параметрами ("<tt>\</tt>" в первой строке используется для разрыва строки в Terminal):</p>
<pre class="terminal"> desklink "cmd=Active window (2s):/bin/screenshot --window --border --delay 2" \
"cmd=Remove replicant:desklink --remove=screenshot" /bin/screenshot
</pre>
<p><img src="../images/apps-images/cli-desklink.png" alt="cli-alert.png" /></p>
</td></tr>
<tr><td><p><span class="cli">diskimage</span></p></td><td style="width:10px;"> </td>
<td valign="top"><p><span class="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>
</td></tr>
<tr><td><p><span class="cli">launch_roster</span></p></td><td style="width:10px;"> </td>
<td valign="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 <span class="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. Without parameter, <span class="cli">launch_roster</span> lists all apps/services that are under its control.<br />
For example, this will stop the re-launching of the Deskbar:</p>
<pre class="terminal">launch_roster stop x-vnd.be-tskb</pre>
</td></tr>
<tr><td><p><span class="cli">mountvolume</span><br /><span class="cli">mount</span></p></td><td style="width:10px;"> </td>
<td valign="top"><p><span class="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><span class="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 <span class="path">/system/add-ons/kernel/file_system</span> (and corresponding file hierarchies under <span class="path">~/config</span> or "<span class="path">non-packaged</span>", of course). You also have to create a folder as mountpoint. Here's an example:</p>
<pre class="terminal">mkdir -p /DiskStation
mount -t nfs4 -p "192.168.178.3:volume1" /DiskStation</pre></td></tr>
<tr><td><p><span class="cli">open</span></p></td><td style="width:10px;"> </td>
<td valign="top"><p><span class="cli">open</span> очень полезный инструмент. С его помощью вы сможете открыть любой файл в предпочитаемом приложении, либо запустить приложение по его сигнатуре, не указывая точный путь до него. Это применимо к URL и "виртуальным" папкам <tt>.</tt> для текущей папки и <tt>..</tt> для родительской папки - они откроются в Tracker.</p>
</td></tr>
<tr><td><p><span class="cli">ramdisk</span></p></td><td style="width:10px;"> </td>
<td valign="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>
<pre class="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 <span class="cli">ramdisk</span> command prints out the path to it. If you create several disks, that path <span class="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>
<pre class="terminal">dd if=/dev/zero of=RAMimage bs=500M count=1
mkfs -q -t bfs /dev/disk/virtual/ram/0/raw RAMimage</pre>
<p>From now on, you start the ramdisk like this:</p>
<pre class="terminal">ramdisk create RAMimage
mountvolume RAMimage</pre>
<p>It's very important to always cleanly unmount you ramdisk, either from Tracker or with <span class="cli">unmount /RAMimage</span>, or the changes won't be written back to the image file!</p>
</td></tr>
</table>
</div>
</div>
<div class="nav">
<div class="inner"><span>
 «  <a href="list-cli-apps.html">Список команд</a> 
::  <a href="../applications.html#cli-apps" class="uplink">Приложения</a> 
</span></div>
</div>
</body>
</html>