mirror of
https://github.com/fankes/termux-app.git
synced 2025-09-06 02:35:19 +08:00
Remove bundled help in favour of online help
This commit is contained in:
@@ -39,7 +39,9 @@
|
||||
<activity
|
||||
android:name="com.termux.app.TermuxHelpActivity"
|
||||
android:exported="false"
|
||||
android:label="@string/application_help" />
|
||||
android:theme="@android:style/Theme.Material.Light.DarkActionBar"
|
||||
android:parentActivityName=".app.TermuxActivity"
|
||||
android:label="@string/application_name" />
|
||||
|
||||
<activity
|
||||
android:name="com.termux.filepicker.TermuxFilePickerActivity"
|
||||
|
@@ -1,229 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<meta name="viewport" content="width=device-width, user-scalable=no" />
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
|
||||
<title>Termux Help</title>
|
||||
|
||||
<style>
|
||||
html { font-family: 'sans-serif-light', sans-serif; height: 100%; margin: auto; padding: 0; color: black; background-color: white; }
|
||||
.page { max-width: 820px; margin: auto; padding: 0 1em; }
|
||||
body { margin-left: auto; margin-right: auto; margin-top: 0; padding: 0; width: 100%; }
|
||||
p { font-size: 16px; line-height: 1.3em; }
|
||||
ul.index { padding-left: 0; }
|
||||
.index li { list-style-type: none; line-height: 1.8em; }
|
||||
dt { margin-left: 1em; list-style-type: bullet; }
|
||||
a, a:visited { color: #0000EE }
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class="page help">
|
||||
<h1 id="index">Termux Help</h1>
|
||||
|
||||
<ul class="index">
|
||||
<li><a href="#introduction">Introduction</a></li>
|
||||
<li><a href="#user_interface">User interface</a></li>
|
||||
<li><a href="#touch_keyboard">Using a touch keyboard</a></li>
|
||||
<li><a href="#hardware_keyboard">Using a hardware keyboard</a></li>
|
||||
<li><a href="#package_management">Package management</a></li>
|
||||
<li><a href="#text_editing">Text editing</a></li>
|
||||
<li><a href="#using_ssh">Using SSH</a></li>
|
||||
<li><a href="#interactive_shells">Interactive shells</a></li>
|
||||
<li><a href="#termux_android">Termux and Android</a></li>
|
||||
<li><a href="#add_on_api">Add-on: API</a></li>
|
||||
<li><a href="#add_on_float">Add-on: Float</a></li>
|
||||
<li><a href="#add_on_styling">Add-on: Styling</a></li>
|
||||
<li><a href="#add_on_widget">Add-on: Widget</a></li>
|
||||
<li><a href="#source_and_licenses">Source and licenses</a>
|
||||
</ul>
|
||||
|
||||
<h2 id="introduction">Introduction</h2>
|
||||
<p>Termux is a terminal emulator for Android combined with a collection of packages for command line software. This help
|
||||
explains both the terminal interface and the packaging tool available from inside the terminal.</p>
|
||||
<p>Want to ask a question, report a bug or have an idea for a new package or feature?
|
||||
Visit the <a href="https://plus.google.com/communities/101692629528551299417">Google+ Termux Community</a>!</p>
|
||||
|
||||
<h2 id="user_interface">User interface</h2>
|
||||
<p>At launch Termux shows a terminal interface, whose text size can be adjusted by pinch zooming or double tapping
|
||||
and pulling the content towards or from you.</p>
|
||||
<p>Besides the terminal (with keyboard shortcuts explained below) there are three additional interface elements available:
|
||||
A <strong>context menu</strong>, <strong>navigation drawer</strong>
|
||||
and <strong>notification</strong>.</p>
|
||||
<p>The <strong>context menu</strong> can be shown by long pressing anywhere on the terminal. It provides menu entries for:</p>
|
||||
<ul>
|
||||
<li>Selecting and pasting text.</li>
|
||||
<li>Sharing text from the terminal to other apps (e.g. email or SMS)</li>
|
||||
<li>Resetting the terminal if it gets stuck.</li>
|
||||
<li>Switching the terminal to full-screen.</li>
|
||||
<li>Hangup (exiting the current terminal session).</li>
|
||||
<li>Styling the terminal by selecting a font and a color scheme.</li>
|
||||
<li>Showing this help page.</li>
|
||||
</ul>
|
||||
<p>The <strong>navigation drawer</strong> is revealed by swiping from the left part of the screen. It has three
|
||||
elements:</p>
|
||||
<ul>
|
||||
<li>A list of sessions. Clicking on a session shows it in the terminal while long pressing allows you to specify a session title.</li>
|
||||
<li>A button to toggle visibility of the touch keyboard.</li>
|
||||
<li>A button to create new terminal sessions (long press for creating a named session or a fail-safe one).</li>
|
||||
</ul>
|
||||
<p>The <strong>notification</strong>, available when a terminal session is running, is available by pulling down the notification menu.
|
||||
Pressing the notification leads to the most current terminal session. The notification may also be expanded
|
||||
(by pinch-zooming or performing a single-finger glide) to expose three actions:</p>
|
||||
<ul>
|
||||
<li>Exiting all running terminal sessions.</li>
|
||||
<li>Use a wake lock to avoid entering sleep mode.</li>
|
||||
<li>Use a high performance wifi lock to maximize wifi performance.</li>
|
||||
</ul>
|
||||
<p>With a wake or wifi lock held the notification and Termux background processes will be available even if no terminal
|
||||
session is running, which allows server and other background processes to run more reliably.</p>
|
||||
|
||||
<h2 id="touch_keyboard">Using a touch keyboard</h2>
|
||||
<p>Using the Ctrl key is necessary for working with a terminal - but most touch keyboards
|
||||
does not include one. For that purpose Termux uses the <em>Volume down</em> button to emulate
|
||||
the Ctrl key. For example, pressing <em>Volume down+L</em> on a touch keyboard sends the same input as
|
||||
pressing <em>Ctrl+L</em> on a hardware keyboard. The result of using Ctrl in combination
|
||||
with a key depends on which program is used, but for many command line tools the following
|
||||
shortcuts works:</p>
|
||||
<ul>
|
||||
<li>Ctrl+A → Move cursor to the beginning of line.</li>
|
||||
<li>Ctrl+C → Abort (send SIGINT to) current process.</li>
|
||||
<li>Ctrl+D → Logout of a terminal session.</li>
|
||||
<li>Ctrl+E → Move cursor to the end of line.</li>
|
||||
<li>Ctrl+K → Delete from cursor to the end of line.</li>
|
||||
<li>Ctrl+L → Clear the terminal.</li>
|
||||
<li>Ctrl+Z → Suspend (send SIGTSTP to) current process.</li>
|
||||
</ul>
|
||||
<p>The <em>Volume up</em> key also serves as a special key to produce certain input:</p>
|
||||
<ul>
|
||||
<li>Volume Up+L → | (the pipe character).</li>
|
||||
<li>Volume Up+E → Escape key.</li>
|
||||
<li>Volume Up+T → Tab key.</li>
|
||||
<li>Volume Up+1 → F1 (and Volume Up+2 → F2, etc).</li>
|
||||
<li>Volume Up+B → Alt+B, back a word when using readline.</li>
|
||||
<li>Volume Up+F → Alt+F, forward a word when using readline.</li>
|
||||
<li>Volume Up+W → Up arrow key.</li>
|
||||
<li>Volume Up+A → Left arrow key.</li>
|
||||
<li>Volume Up+S → Down arrow key.</li>
|
||||
<li>Volume Up+D → Right arrow key.</li>
|
||||
</ul>
|
||||
|
||||
<h2 id="hardware_keyboard">Using a hardware keyboard</h2>
|
||||
<p>The following shortcuts are available when using Termux with a hardware (e.g. bluetooth) keyboard by combining them with <em>Ctrl+Shift</em>:</p>
|
||||
<ul>
|
||||
<li>'C' → Create new session</li>
|
||||
<li>'R' → Rename current session</li>
|
||||
<li>Down arrow (or 'N') → Next session</li>
|
||||
<li>Up arrow (or 'P') → Previous session</li>
|
||||
<li>Right arrow → Open drawer</li>
|
||||
<li>Left arrow → Close drawer</li>
|
||||
<li>'F' → Toggle full screen</li>
|
||||
<li>'M' → Show menu</li>
|
||||
<li>'V' → Paste</li>
|
||||
<li>+/- → Adjust text size</li>
|
||||
<li>1-9 → Go to numbered session</li>
|
||||
</ul>
|
||||
|
||||
<h2 id="package_management">Package management</h2>
|
||||
<p>A minimal base system consisting of the Apt package manager and the busybox collection of system utilities
|
||||
is installed when first starting Termux. Additional packages are available using the apt command:</p>
|
||||
<dl>
|
||||
<dt>apt update</dt><dd>Updates the list of available packages. This commands needs to be run initially directly after installation
|
||||
and regularly afterwards to receive updates.</dd>
|
||||
<dt>apt search <query></dt><dd>Search among available packages.</dd>
|
||||
<dt>apt install <package></dt><dd>Install a new package.</dd>
|
||||
<dt>apt upgrade</dt><dd>Upgrade outdated packages. For Apt to know about newer packages you will need to update the package index, so you will normally want to run <em>apt update</em> before upgrading.</dd>
|
||||
<dt>apt show <package></dt><dd>Show information about a package.</dd>
|
||||
<dt>apt list</dt><dd>List all available packages.</dd>
|
||||
<dt>apt list --installed</dt><dd>List all installed packages.</dd>
|
||||
<dt>apt remove <package></dt><dd>Remove an installed package.</dd>
|
||||
</dl>
|
||||
|
||||
<p>Apt as a package manager uses a package format named <em>dpkg</em>. Normally direct use of dpkg is not necessary, but the
|
||||
following two commands may be of use:</p>
|
||||
<dl>
|
||||
<dt>dpkg -L <package></dt>
|
||||
<dd>List installed files of a package.</dd>
|
||||
<dt>dpkg --verify</dt>
|
||||
<dd>Verify the integrity of installed packages.</dd>
|
||||
</dl>
|
||||
<p>View the apt manual page (execute <em>apt install man</em> to install a man page viewer first) for more information.</p>
|
||||
|
||||
<h2 id="text_editing">Text editing</h2>
|
||||
<p>By default the busybox version of <em>vi</em> is available. This is a barebone and somewhat unfriendly editor -
|
||||
install <a href="http://www.nano-editor.org/dist/v2.2/nano.html">nano</a> for a more straight-forward editor and
|
||||
<a href="http://vimdoc.sourceforge.net/htmldoc/usr_toc.html">vim</a> for a more powerful one.</p>
|
||||
|
||||
<h2 id="using_ssh">Using SSH</h2>
|
||||
<p>By installing the <strong>openssh</strong> package (by executing <em>apt install openssh</em>) you may SSH into remote systems,
|
||||
optionally putting private keys or configuration under $HOME/.ssh/.</p>
|
||||
<p>If you wish to use an SSH agent to avoid entering passwords, the Termux openssh package provides
|
||||
a wrapper script named <strong>ssha</strong> (note the 'a' at the end) for ssh which:</p>
|
||||
<ol>
|
||||
<li>Starts the ssh agent if necessary (or connect to it if already running).</li>
|
||||
<li>Runs <strong>ssh-add</strong> if necessary.</li>
|
||||
<li>Runs <strong>ssh</strong> with the provided arguments.</li>
|
||||
</ol>
|
||||
<p>This means that the agent will prompt for a key password at first run, but remember the authorization for subsequent ones.</p>
|
||||
|
||||
<h2 id="interactive_shells">Interactive shells</h2>
|
||||
<p>The base system that is installed when first starting Termux uses the <em>bash</em> shell while zsh is available as
|
||||
an installable alternative:</p>
|
||||
<ul>
|
||||
<li>bash - the default shell on most Linux distributions, with resources such as
|
||||
<a href="http://www.tldp.org/LDP/Bash-Beginners-Guide/html/">Bash Guide for Beginners</a>,
|
||||
the <a href="https://www.gnu.org/software/bash/manual/bash.html">Bash Reference Manual</a>
|
||||
or the <a href="http://www.tldp.org/LDP/abs/html/">Advanced Bash-Scripting Guide</a> available.</li>
|
||||
<li>zsh - a powerful shell with information available at
|
||||
<a href="http://zsh.sourceforge.net/Guide/zshguide.html">A User's Guide to the Z-Shell</a>, the
|
||||
<a href="http://zsh.sourceforge.net/Doc/Release/zsh_toc.html">Z Shell Manual</a> or
|
||||
<a href="http://www.rayninfo.co.uk/tips/zshtips.html">ZSH Tips by ZZapper</a>.
|
||||
After installing zsh through <em>apt install zsh</em>, execute <em>chsh -s zsh</em> to set it as the default login shell when starting Termux
|
||||
(and change back with <em>chsh -s bash</em> if necessary).</li>
|
||||
</ul>
|
||||
|
||||
<h2 id="termux_android">Termux and Android</h2>
|
||||
<p>Termux is designed to cope with the restrictions of running as an ordinary Android app without requiring root, which
|
||||
leads to several differences between Termux and a traditional desktop system. The file system layout is drastically different:</p>
|
||||
<ul>
|
||||
<li>Common folders such as /bin, /usr/, /var and /etc does not exist.</li>
|
||||
<li>The Android system provides a basic non-standard file system hierarchy, where e.g. /system/bin contains some system binaries.</li>
|
||||
<li>The user folder $HOME is inside the private file area exposed to Termux as an ordinary Android app.
|
||||
Uninstalling Termux will cause this file area to be wiped - so save important files outside this area such as in /sdcard
|
||||
or use a version control system such as <em>git</em>.</li>
|
||||
<li>Termux installs its packages in a folder exposed through the $PREFIX environment variable (with e.g. binaries in $PREFIX/bin,
|
||||
and configuration in $PREFIX/etc).</li>
|
||||
<li>Shared libraries are installed in $PREFIX/lib, which are available from binaries due to Termux setting the $LD_LIBRARY_PATH
|
||||
environment variable. These may clash with Android system binaries in /system/bin, which may force LD_LIBRARY_PATH to be
|
||||
cleared before running system binaries.</li>
|
||||
</ul>
|
||||
<p>Besides the file system being different, Termux is running as a single-user system without root - each Android app is running as
|
||||
its own Linux user, so running commands inside Termux may not interfere with other installed applications.</p>
|
||||
<p>Running as non-root implies that ports below 1024 cannot be bound to. Many packages have been configured to have compatible
|
||||
default values - the ftpd, httpd, and sshd servers default to 8021, 8080 and 8022, respectively.</p>
|
||||
|
||||
<h2 id="add_on_api">Add-on: API</h2>
|
||||
<p>The API add-on exposes Android system functionality such as SMS messages, GPS location or the Text-to-speech functionality through command line tools.</p>
|
||||
<ul><li><a href="http://play.google.com/store/apps/details?id=com.termux.api">See more and install from Google Play</a></li></ul>
|
||||
|
||||
<h2 id="add_on_float">Add-on: Float</h2>
|
||||
<p>The Float add-on consists of a floating terminal window visible while running other apps.</p>
|
||||
<ul><li><a href="http://play.google.com/store/apps/details?id=com.termux.window">See more and install from Google Play</a></li></ul>
|
||||
|
||||
<h2 id="add_on_styling">Add-on: Styling</h2>
|
||||
<p>The Styling add-on provides color schemes and fonts to beabeautify and customize the appearance of the Termux terminal.</p>
|
||||
<ul><li><a href="http://play.google.com/store/apps/details?id=com.termux.styling">See more and install from Google Play</a></li></ul>
|
||||
|
||||
<h2 id="add_on_widget">Add-on: Widget</h2>
|
||||
<p>The Widget add-on brings a widget to your homescreen, providing links to run scripts in your $HOME/.shortcuts/ folder.</p>
|
||||
<ul><li><a href="http://play.google.com/store/apps/details?id=com.termux.widget">See more and install from Google Play</a></li></ul>
|
||||
|
||||
<h2 id="source_and_licenses">Source and licenses</h2>
|
||||
<p>Termux uses terminal emulation code from <a href="https://github.com/jackpal/Android-Terminal-Emulator">Terminal Emulator for Android</a>
|
||||
which is under the <a href="https://raw.githubusercontent.com/jackpal/Android-Terminal-Emulator/master/NOTICE">Apache License, Version 2.0</a>.
|
||||
Packages available through Termux are distributed under their respective licenses with scripts and patches used to build them
|
||||
<a href="https://github.com/termux/termux-packages">available on github</a>.</p>
|
||||
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
@@ -5,33 +5,63 @@ import android.content.ActivityNotFoundException;
|
||||
import android.content.Intent;
|
||||
import android.net.Uri;
|
||||
import android.os.Bundle;
|
||||
import android.view.ViewGroup;
|
||||
import android.webkit.WebSettings;
|
||||
import android.webkit.WebView;
|
||||
import android.webkit.WebViewClient;
|
||||
import android.widget.ProgressBar;
|
||||
import android.widget.RelativeLayout;
|
||||
|
||||
/** Basic embedded browser for viewing the bundled help page. */
|
||||
/** Basic embedded browser for viewing help pages. */
|
||||
public final class TermuxHelpActivity extends Activity {
|
||||
|
||||
private WebView mWebView;
|
||||
private ProgressBar mProgressBar;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
final RelativeLayout progressLayout = new RelativeLayout(this);
|
||||
RelativeLayout.LayoutParams lParams = new RelativeLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
|
||||
lParams.addRule(RelativeLayout.CENTER_IN_PARENT);
|
||||
mProgressBar = new ProgressBar(this);
|
||||
mProgressBar.setIndeterminate(true);
|
||||
mProgressBar.setLayoutParams(lParams);
|
||||
progressLayout.addView(mProgressBar);
|
||||
|
||||
mWebView = new WebView(this);
|
||||
setContentView(mWebView);
|
||||
WebSettings settings = mWebView.getSettings();
|
||||
settings.setCacheMode(WebSettings.LOAD_NO_CACHE);
|
||||
settings.setAppCacheEnabled(false);
|
||||
setContentView(progressLayout);
|
||||
mWebView.clearCache(true);
|
||||
|
||||
mWebView.setWebViewClient(new WebViewClient() {
|
||||
@Override
|
||||
public boolean shouldOverrideUrlLoading(WebView view, String url) {
|
||||
if (url.startsWith("https://termux.com")) {
|
||||
// Inline help.
|
||||
setContentView(progressLayout);
|
||||
return false;
|
||||
}
|
||||
|
||||
try {
|
||||
startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(url)).addFlags(Intent.FLAG_ACTIVITY_NEW_TASK));
|
||||
} catch (ActivityNotFoundException e) {
|
||||
// TODO: Android TV does not have a system browser - but needs better method of getting back
|
||||
// than navigating deep here.
|
||||
// Android TV does not have a system browser.
|
||||
setContentView(progressLayout);
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPageFinished(WebView view, String url) {
|
||||
setContentView(mWebView);
|
||||
}
|
||||
});
|
||||
mWebView.loadUrl("file:///android_asset/help.html");
|
||||
mWebView.loadUrl("https://termux.com/help.html");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@@ -1,7 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<string name="application_name">Termux</string>
|
||||
<string name="application_help">Termux help</string>
|
||||
<string name="shared_user_label">Termux user</string>
|
||||
<string name="new_session">New session</string>
|
||||
<string name="new_session_normal_unnamed">Normal - unnamed</string>
|
||||
|
Reference in New Issue
Block a user