# 使用命令行工具

AliOS Things 在命令行中使用 [aos-cube](/docs/documentation/tools/aos-cube.md) 工具完成系统编译构建，参数以 `app@board` 的形式组建出构建目标。

## 配置环境

您可以尝试一键安装脚本[Setup Script for Linux/Mac](http://p28phe5s5.bkt.clouddn.com/setup_linux_osx.sh), 或者按以下命令手动安装依赖的软件包 例：在一台 Ubuntu 16.04 LTS (Xenial Xerus) 64-bit PC 上

```bash
sudo apt-get install -y python
sudo apt-get install -y gcc-multilib
sudo apt-get install -y libssl-dev libssl-dev:i386
sudo apt-get install -y libncurses5-dev libncurses5-dev:i386
sudo apt-get install -y libreadline-dev libreadline-dev:i386
sudo apt-get install -y python-pip
sudo apt-get install -y minicom
```

## 安装 aos-cube

首先, 用 python 包管理器 `pip` 来安装 `aos-cube` 在全局环境，以便于后续使用 AliOS Things Studio 进行开发。

```bash
$ pip install setuptools
$ pip install wheel
$ pip install aos-cube
```

!> 请确认`pip`环境是基于 Python 2.7 的。如果遇到权限问题，可能需要 `sudo` 来执行。

## 下载代码并编译运行

```bash
git clone https://github.com/alibaba/AliOS-Things.git
cd AliOS-Things
aos make helloworld@linuxhost
./out/helloworld@linuxhost/binary/helloworld@linuxhost.elf
```

## 效果

可以看见 `app_delayed_action` 在1秒时启动，每5秒触发一次。

```bash
$ ./out/helloworld@linuxhost/binary/helloworld@linuxhost.elf
 [   1.000]<V> AOS [app_delayed_action#9] : app_delayed_action:9 app
 [   6.000]<V> AOS [app_delayed_action#9] : app_delayed_action:9 app
 [  11.000]<V> AOS [app_delayed_action#9] : app_delayed_action:9 app
 [  16.000]<V> AOS [app_delayed_action#9] : app_delayed_action:9 app
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://aliosthings.gitbook.io/docs/tutorial/quickstart/command-line.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
