The translation of this page isn't yet complete. Until it is, unfinished parts use the English original.

cli-app-icon_64.pngCommandline applications(命令行程序)

位置:/boot/system/bin
/boot/common/bin
~/config/bin


所有Haiku附带的命令行程序都放置在 /boot/system/bin 或者 /boot/common/bin 目录。您自己的或另行安装的命令行程序应该放置在 ~/config/bin 目录。所有这些位置都是 PATH 变量的一部分,而且是自动查询的。
下面给出的列表并没有包含所有的用于 Haiku 的命令行程序,它只是给出了最常用的几个以方便您的尝试使用。您需要勇敢地去探索 bin/ 文件夹中的命令。以 --help 参数来运行命令行程序,这样会给出该命令的用途和相应的参数选项。

index 关于文件属性的命令: listattr, catattr, addattr, rmattr, copyattr

这些命令用于显示,读取,添加和删除文件的属性;需要注意的是,这些元数据仅仅可用于BFS格式的磁盘和分区,而且移动文件到其他的文件系统将会把其相关的属性移除!
上面的命令在 Attributes in Terminal 会有相关的描述。

index 关于文件索引的命令:lsindex, mkindex, reindex, rmindex

利用这些命令,您可以 list, make, reindex and remove attributes to BFS' index. 每个卷都有自己的索引,所以在不同的卷之间拷贝文件时尤其要注意。
上述这些命令在 Index 主题中会有详细的描述。

index 有用的脚本命令

下面是一些非常有用的命令行工具,尤其适用于撰写脚本(详情请参阅 Bash and Scripting)。

alert

alert conjures up the typical alert window with a pre-defined icon, explanatory text and up to three buttons. It will return the title of the pressed button and an exit status (starting with 0). For example, this is made of the line:

alert --idea "FantasticApp(tm) installed successfully!
Would you like a link to it?" "On Desktop" "In Deskbar" "No thanks"

cli-alert.png

filepanel

filepanel displays a load or save file panel and lets the user choose a file or location. As a return value you'll get the chosen file or folder's path. There are several parameters available, for example to set a starting directory, a window title, a default name when saving or restrictions to the allowed types of files. This is an example of

filepanel -s -t "Save your logfile" -d ~/config/settings -n Fantastic.log

cli-alert.png

waitfor

waitfor is a nice way to wait for a particular application or thread to be started or to have ended.

query

query is the commandline version of the Find panel. In fact, a quick way to generate the search term is to build a query in the Find panel, switch to by formula, add double quotes (") in front and back and paste the whole string after your query command in Terminal or your script.

index Other commands

checkfs

checkfs is an important tool to check for errors in your file system. Simply add the volume or device name and it'll run through every file and correct inconsistencies where possible.

open

open is a very handy little tool. With it you open any file with its preferred application, or start a specific application by its signature without the need to know its exact path. It also works with URLs and even with the "virtual" directories . for the current directory and .. for the parent, opening the folder in Tracker.

desklink

desklink can install an icon for any file, folder, query or application in the Deskbar tray. It also offers the option to provide a context menu when right-clicking an icon to execute special actions. As an example, try this to add Screenshot with various options (the "\" in the first line is just for the line break in Terminal):

desklink "cmd=Active window (2s):/boot/system/apps/Screenshot --window --border --delay 2" \
"cmd=Remove replicant:desklink --remove=Screenshot" /boot/system/apps/Screenshot

cli-alert.png