25

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


16

In order to assign a drive letter to a removable device, that device must support UMS (USB Mass Storage) protocol. Unfortunately most newer Android phones, especially those without a removable SD Card, do not support UMS. Instead, they support MTP (Media Transfer Protocol) and PTP (Picture Transfer Protocol) protocols. In such devices it's not possible to ...


16

Yes there is. When the community discovered this feature in android 4.1 (the code was exist but has not been declared yet so Google did not open the feature in Settings), I remember playing with this in my Nexus 4. So, here are some commands that I remember for the android Terminal: Create new user: pm create-user User_Name To switch between users: am ...


14

Running the following command as root should enable USB tethering: service call connectivity 32 i32 1 on Ice Cream Sandwich (4.0) service call connectivity 33 i32 1 on Jelly Bean (4.1 to 4.3) service call connectivity 34 i32 1 on KitKat (4.4) service call connectivity 30 i32 1 on Lollipop (5.0) service call connectivity 31 i32 1 on Lollipop (5.1) according ...


14

From here: You might need to activate adb root from the developer settings menu. If you run adb root from the cmd line you can get: root access is disabled by system setting - enable in settings -> development options root access is disabled by system setting - enable in settings -> development options Once you activate the root option (ADB only or Apps ...


13

Have a look at simulating keyevents on Android and search for "KEYCODE_VOLUME_UP" and "KEYCODE_VOLUME_DOWN". Events can be generated by executing "input": #local shell: input keyevent 24 #vol up input keyevent 25 #vol down #remotely using ssh ssh your-phone input keyevent 24 #vol up ssh your-phone input keyevent 25 #vol down # 'su -c command' to make it ...


13

Simple, really: Android is safely shutting down vital parts of the runtime. The OS is also broadcasting intents to tell apps and services to gracefully close. These, in turn, flush their caches of all data and shared preferences, save what-nots to the sqlite database, et cetera. In other words, apps and services are given a chance to do their cleanup ...


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

What is the device doing exactly when I'm pushing the (hardware) power button? I guess that's the most friendly way. You get to see a dialog with an option to power off the device (stock Android doesn't offer reboot). It appears that ShutdownActivity is called upon when you long press Power button. Anyhow, this is what you can try, remotely or locally, ...


12

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-...


11

Android's shell will support a limited amount of Unix-style shell scripting. It specifically should have a shell at /system/bin/sh that you can use, however: The shell provided with Android has a severely restricted set of commands available to it. If you want to do anything even remotely complex you'll need a busybox install (or another shell). It's ...


11

Generally, reboot binary provides a recovery switch. After switching to root, execute this command: /system/bin/reboot recovery This may not work if your manufacturer doesn't support it. ROM Manager type apps uses API of Android which you can't access via Terminal Emulator directly.


10

Use one of those: cat /proc/mounts mount # free disk space of mounted fs' df # this shows you available devices cat /proc/partitions ps: Lines containing asec are moved-to-sdcard apps (it's each an encrypted volume per app for security reasons)


10

"Rooting" allows you access to the internal Android environment, which of course consists of more than just the Linux kernel. So you are running Linux, but you should consider it as though you are running under a different distribution than say Debian or Redhat. There's a different set of standard libraries and some files are in different locations. At ...


10

Most shell commands in Android are not GNU versions or a POSIX-compliant implementation, they are either from Toolbox or Busybox and mostly stripped down versions. A lot of commands in /system/bin are symlinks to /system/toolbox. I haven't found much documentation about it, just the source at https://android.googlesource.com/platform/system/core/+/jb-mr1-...


10

killall zygote This will kill the root zygote process and cause a Android system refresh. This does not restart your phone's hardware, only the Android processes. By default (in Linux), the kill/killall commands do give the processes a graceful way to shut down, though it depends on the zygote implementation whether this in turn gracefully shuts down your ...


10

Given enough privileges (ADB, root, system application) you can use simple terminal commands to install apps: On a PC: Run the simple command adb install <path to .apk file> and the app will be installed. This requires adb to be installed and debugging mode enabled. The file has to be located on the PC. In adb shell or a terminal on the device: ...


10

Add the path first C:\Users\{username}\AppData\Local\Android\Sdk\emulator Your path may be different update accordingly An then run the cmd emulator -avd "avd_name" Reference Android developers launch avd from cmd line


9

You should be able to call the messaging intent with am start -a android.intent.action.VIEW "sms:numberhere" -e "sms_body" "hello" Using the intent command as described here: http://learnandroid.blogspot.com/2008/01/run-android-application-from-command.html https://stackoverflow.com/questions/4967448/send-sms-in-android


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

Alas, the UsbStorageActivity doesn't use an intent to enable and disable USB mass storage, so there's no way to achieve this using am. It instead calls the functions StorageManager.enableUsbMassStorage and `StorageManager.disableUsbMassStorage to do its work. As these functions are hidden in the framework, it's not possible to write an app to do this, either....


9

Activity Manager among other things manage Screen pinning. You can invoke the am command to pin an app regardless of the Screen pinning being activated under Settings. However, know that the pinning wouldn't be fully automated this way i.e. you still would have to confirm on the screen whether to pin the app or not, although I provided a way to interact ...


9

If the question is simply "using the command-line" Let it be simple (root possibly[1] required): settings put global development_settings_enabled 1 settings put global adb_enabled 1 And then you need to echo "mtp,adb" > /data/property/persist.sys.usb.config If you want to do this without touching your phone Then I'm feeling interesting because you ...


8

You can see names and partitions at same time. If you have an eMMC internal storage : ls -l /dev/block/platform/msm_sdcc.1/by-name/ or for me : ls -l /dev/block/platform/7824900.sdhci/by-name It depends of your phone storage. So you can try to know in which folder you have to search. ls /dev/block/platform/ Last way to know it, if you have the parted ...


8

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


8

In Android versions equipped with wm tool, you can use the commands: adb shell wm size # shows the real size and current size adb shell wm density # shows the real density and current density (Click image to enlarge) I've tested successfully on stock Android 5.x and 6.x. Since wm tool comes with Android 4.3.x and 4.4.x as well, the solution may ...


8

I installed the Disk Info app and in the options, I enabled Expert mode and Unmounted partitions. It doesn't say "swap", but it shows clearly that it's the only other partition on the SD card and it's the right size, so /dev/block/mmcblk1p2 must be the one: Swapper 2 is configured to use /dev/block/mmcblk0p3 by default, so I'm glad I didn't go with the ...


8

fdisk -l works if you pass the whole disk device name explicitly (e.g., fdisk -l /dev/block/mmcblk1); what does not work is automatic discovery of block devices (apparently because Android places block device files under the /dev/block directory, but fdisk expects to see those files directly in /dev). Therefore one option is to collect the list of whole disk ...


8

I was looking for the same answer, i can't find a single command to do this, but i found few options that could be useful in such cases: A. download the .apk to your computer and install the apk from it (just google 'apk downloder' and find one suitable for you): adb install com.myapp.apk B. open playstore app from adb and point it to your package, this ...


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