Built-in Terminal
Relevant source files
The following files were used as context for generating this wiki page:
The built-in terminal provides a complete Linux environment within Acode using proot and Alpine Linux. It functions as an integrated editor tab, allowing you to execute shell commands, manage packages, and interact with the Android filesystem directly while coding.
Sources: user-guide/terminal.md:9-13, user-guide/index.md:55-58
System Architecture
The terminal operates as a foreground service to prevent the operating system from terminating the process during background tasks. It uses Alpine Linux as its base distribution, managed through the apk package manager.
Core Components
- proot: Provides the virtualization layer to run the Linux environment.
- Alpine Linux: The guest operating system providing the shell and utilities.
- Acode CLI: A specialized bridge tool for terminal-to-editor communication.
The following diagram illustrates the interaction between the Android host, the Acode app, and the terminal environment:
This diagram shows the relationship between the Android service lifecycle and the virtualized Linux environment.
Sources: user-guide/terminal.md:15-18, user-guide/terminal.md:41-45, user-guide/terminal.md:60-64
Shell Configuration and Initialization
Every terminal session initializes via the /initrc script. This script defines the environment variables, shell aliases, and the appearance of the command prompt.
Initialization Sequence
- The terminal session starts.
- The
/initrcscript executes. - Environment variables (e.g.,
EDITOR) are exported. - Shell aliases are defined.
- Standard configuration files like
~/.bashrcor/etc/profileare sourced.
Sources: user-guide/terminal.md:79-88, user-guide/terminal.md:105-110
Integrated CLI Tool
The acode command allows the terminal to send instructions back to the main editor interface.
| Command | Action |
|---|---|
acode <file> | Opens the specified file in an editor tab. |
acode . | Opens the current working directory in the file browser. |
acode --help | Displays usage instructions. |
Sources: user-guide/terminal.md:63-75
Filesystem Access and Permissions
The terminal's ability to access files depends on the directory location and the app's permission state.
| Directory | Access Level | Requirement |
|---|---|---|
/home | Always Accessible | None |
| Public Folders | Always Accessible | None |
| Internal Storage | Restricted | All Files Access permission; Android 10+; Non-Play Store version |
Sources: user-guide/terminal.md:25-33, user-guide/settings/terminal-settings.md:8-10
Configuration and Management
Terminal behavior is managed through Terminal Settings and App Settings.
Terminal Settings Options
Users can modify the visual and functional aspects of the emulator.
This flowchart categorizes the available configuration domains for the terminal.
Sources: user-guide/settings/terminal-settings.md:15-53
Lifecycle Management
The terminal supports persistent sessions and data safety through management actions:
- Backup: Saves the current installation state and configuration.
- Restore: Reverts the environment to a previous backup.
- Uninstall: Purges the Alpine Linux installation from the device.
Sources: user-guide/terminal.md:129-135, user-guide/settings/terminal-settings.md:46-53
Language Runtime Support
The terminal enables the execution of various programming languages on Android. For example, running Java requires installing the OpenJDK package via apk or using the official Runner plugin which interfaces with the built-in terminal.
Java Execution Flow
The sequence shows the process of preparing and running a Java application within the terminal environment.
Sources: tutorials/how-to-run-java.md:12-16, tutorials/how-to-run-java.md:118-128
The built-in terminal is a core utility that transforms Acode from a text editor into a comprehensive development environment by providing a standardized Linux shell for package management, script execution, and advanced filesystem interaction.