27

am start -a android.intent.action.MAIN -c android.intent.category.HOME More info about shell commands: an archived version of the AndroidWiki page


22

Vol Down + C is functionally equivalent to Ctrl + C.


21

From within Termux itself, you can change the current directory to the internal storage, by means of cd /storage/emulated/0 or cd /sdcard followed by enter. After that, create a new directory by using mkdir Directory and replace Directory with a name of your choice. You'll then have a new directory in your device's internal storage, whose data you'll ...


17

I assume that you used adb push for uploading your executable to the sd-card. Unfortunately the sd-card is always mounted with "noexec" which means that you can't execute anything from here. Therefore you have to copy the executable to the local filesystem, e.g. to /data/local. In case the device is not rooted or you don't have BusyBox installed there will ...


15

For Android 6.0 To Enable use : For GPS : adb shell settings put secure location_providers_allowed +gps For Network : adb shell settings put secure location_providers_allowed +network To Disable : GPS : adb shell settings put secure location_providers_allowed -gps For Network : adb shell settings put secure location_providers_allowed -network


15

The default su from Termux is simple. When run it brings /system/bin/sh for you instead of Termux's shell (typically bash). To solve this issue, you can install the custom su wrapper for Termux by apt install tsu And then you can run tsu so that your bash and everything is now under root privilege. Further information: Use an editor (like vim) to see /...


14

You can use Android Debug Bridge (ADB) shell to issue basic Linux commands on your phone, just like you would in a terminal emulator app. To install you'll need to do the following: On the phone go to Settings -> About phone, and tap on "Build number" seven times. This enabled Developer tools. Go back to the main Settings screen and you should now see ...


13

Summing up from the comments: First you need to understand that updating apps works different on Android than it does on a "normal" Linux distro: There is no such thing as "apt". Though Android has its own package manager (listening to the pm command), installs/updates are usually dealt with by services/apps like google-play-store or other alternative-...


13

Termux does provide the openssh package, which contains both the ssh client and the sshd server. Install the package with: apt install openssh, then start the server with sshd - it will run on port 8022 by default, so connect to it with ssh -p 8022 DEVICE_IP, and you can find the device wifi ip using ip addr list wlan0. Password authentication is not ...


12

Actually you can just push the "home" button adb shell input keyevent KEYCODE_HOME


12

Use this: am start -a android.intent.action.MAIN -n <package_name>/<full_class_name> To control an app, you'll have to put correct values of <package_name> and <full_class_name> in the command. For example, you can use com.google.gmail/com.google.gmail.check_mail (Hypothetical names) as last part of command. Obtaining package name ...


12

As I wrote in my comment, there are some special characters needing extra care when working at the shell prompt (or in shell scripts). One of them is the $ sign, which usually indicates a variable. If that should be taken literally, you need to escape it (or enclose the entire string by single quotes). Similar rules for quotation marks. How your command ...


12

First, you have to push it into a directory, such as /data/local/tmp. Then, you have to set permission for that using chmod 755 executable. After that, you can run it as ./executable. Complete steps are as follows: adb push executable /data/local/tmp adb shell cd /data/local/tmp chmod 755 executable ./executable Alternatively, if you want to run it from ...


12

Following the Termux wiki to run termux-setup-storage fixed it for me, as suggested by fornwall. then restart Termux.


10

Addressing Revision 4 You're still doing things incorrectly even though I noted in revision 1 of my answer that you would need adb in PC for once and once alone as long as no reboot or disabling of USB debugging occurs. Regarding your attempt: u0_a192@klimtwifi:/ $ adb connect localhost:9999 * daemon not running. starting it now on port 5038 * * daemon ...


9

Like Sachin Shekhar said, you must use the following command : am start -a android.intent.action.MAIN -n <package_name>/<full_class_name> See a concrete example : getting the apk file from your Android device or any Market places running this command : aapt dump xmltree com.android.settings*.apk AndroidManifest.xml I would like to start "...


9

You can enter getprop to get info about device. Or, you can do cat /system/build.prop If you've root access then you can enter su and then dumpsys | less to get the name of the services which can give more info about some specific things such as battery. See this answer to know more. On a non-rooted device, you can do adb shell dumpsys | less provided ...


8

See the Termux help page for how to input arrow keys using the VolumeUp button, VolumeDown for Ctrl and some additional shortcuts! Volume Up+W → Up arrow key


7

Consider taking at look at the following link: http://developer.android.com/reference/android/view/KeyEvent.html input keyevent KEYCODE_HOME


7

From the terminal, you can use svc to control several elements of your device. For mobile data, it would be: To disable: svc data disable To enable: svc data enable You can simply type svc help for a list of available commands, or svc help [command] for a list of subcommands. For example: To get the list of subcommands for controlling mobile data: svc ...


6

in android.bluetooth.IBluetoothManager, there some parameters TRANSACTION_registerAdapter = (android.os.IBinder.FIRST_CALL_TRANSACTION + 0); TRANSACTION_unregisterAdapter = (android.os.IBinder.FIRST_CALL_TRANSACTION + 1); TRANSACTION_registerStateChangeCallback = (android.os.IBinder.FIRST_CALL_TRANSACTION + 2); ...


6

Query the system service battery (possibly requires root access) dumpsys battery Output would be like Current Battery Service state: AC powered: false USB powered: true Wireless powered: false status: 2 health: 2 present: true level: 70 scale: 100 voltage:3950 temperature: 260 technology: Li-ion level: 70 is the battery percentage ...


6

There are two ways of doing this, depending on if you have root or not on your device. If you use root If you have rooted, run: su input keyevent 26 In any good terminal emulator. If you have not rooted If you haven't rooted, either root, or: Install ADB (Instructions vary between windows, Mac and Linux) Enable "USB Debugging in settings > developer ...


5

Escape the $ in the sub-class name and it should work: shell@android:/ # am start -S com.android.settings/.Settings\$PowerUsageSummaryActivity Starting: Intent { cmp=com.android.settings/.Settings$PowerUsageSummaryActivity } shell@android:/ # Another option is to instead send the intent that the Power Usage screen listens for: shell@android:/ # am start -...


5

Try reboot recovery, though it doesn't work on all devices. You might also need root for this, so first try su.


5

Alternatively to the ADB variant described by Chahk (which requires at least a minal installation of ADB on your computer), you can install a SSH server app on your device (examples include, but are not restricted to, SSH Server, DigiSSHD, Servers Ultimate). Then you can use the ssh command on Linux/Mac, or a tool like PuTTY on Windows, to connect to your ...


5

Yes, this is by design. You can't execute binaries from the SD card without system or superuser privileges (and remounting it without the noexec option) because otherwise apps could just download and execute malicious code at will. In older versions of Android the SD card also did not have emulated permissions so chmod would naturally fail. Some devices/...


5

Android, just as Linux, prevents any user but root, to change the permission bits of any file not owned by such user. That said, chmod is ineffective, unless you have root privileges. By the way, even if you had such privileges, you wouldn't have been able to change permissions, as long as the target path is /storage/sdcard0 or /storage/emulated/0. This ...


5

Newer versions of Android require apps to ask for permission during runtime. You may have noticed this already. One example is Chrome asking for the Storage permission when you try to download something for the first time. For Termux, this is a problem. Permissions default to "not allowed," so when Termux needs a permission for a task, because Termux hasn't ...


Only top voted, non community-wiki answers of a minimum length are eligible