Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

Version 1 Next »

Description

 How to add action

Through the context menu Add Action → Android → Utils

Or use smart search.

Action allows you to perform built-in Android console Linux commands (this is available for the reason that Android is based on the Linux core).

Approximately the same as execution of commands in the Terminal Emulator for Android

This action is not the ADB command! It is worth perceiving as a console or an emulator terminal.

All commands are entered without ADB Shell in the beginning!

How to debug commands in cmd.exe

To train and debug commands using action is not very convenient, it is much better suitable for cmd.exe.

adb shell does not support Cyrillic when working through cmd.exe.
When working through action, this problem is absent!

Running the command line

You need to run the command line on behalf of the administrator!

In the Windows Search panel, enter cmd.exe(1), Right click on the command line (2) and select Run as administrator (3):

 Screenshot

Enter the commands

To execute the commands, the virtual machine (VM) must be launched.

There are two options:

  • The first: can be connected to the emulator console and all subsequent commands will be performed in the context of the emulator console.

    • format - <path_to_the_file_memuc.exe> -i <index_bested_VM> adb shell, after that, all commands will be performed inside the emulator console.

 Example

"D:\Program Files\Microvirt\MEmu\memuc.exe" -i 0 adb shell

Quotes around the path are mandatory because there are gaps in it.

After that, you can only enter commands:

To exit, type the command exit

  • Second: perform one command at a time without going into the context of the emulator console

    • format - <path_to_the_file_memuc.exe> -i <index_bested_VM> adb shell ”<text_command>” (quotes around the command are required!)

 Example

"D:\Program Files\Microvirt\MEmu\memuc.exe" -i 0 adb shell ”ls -la /sdcarcd/Download”

The result of execution will be immediately displayed in the window, after which you will still be in the context of the Windows command line.

How to find out the index of interest to VM?

This information can be found in the Multi-Memu window, in the left column.

 Screenshot

Commands

All sorts of commands a large number and to describe each of them, you need a separate reference. Here I will try to describe the most common of them.

Displays all available commands

To see the list of available commands enter in the console busybox

 Example busybox command output
root@x86:/ # busybox
BusyBox v1.22.1 bionic (2018-09-25 14:13 +0800) multi-call binary.
BusyBox is copyrighted by many authors between 1998-2012.
Licensed under GPLv2. See source distribution for detailed
copyright notices. Merged for bionic by tpruvot@github

Usage: busybox [function [arguments]...]
   or: busybox --list[-full]
   or: busybox --install [-s] [DIR]
   or: function [arguments]...

        BusyBox is a multi-call binary that combines many common Unix
        utilities into a single executable.  Most people will create a
        link to busybox for each function they wish to use and BusyBox
        will act like whatever it was invoked as.

Currently defined functions:
        [, [[, adjtimex, arp, ash, awk, base64, basename, bbconfig, blkid,
        blockdev, brctl, bunzip2, bzcat, bzip2, cal, cat, catv, chattr, chcon,
        chgrp, chmod, chown, chroot, chvt, clear, cmp, comm, cp, cpio, crond,
        crontab, cut, date, dc, dd, deallocvt, depmod, devmem, df, diff,
        dirname, dmesg, dnsd, dos2unix, du, echo, ed, egrep, env, expand, expr,
        false, fbsplash, fdisk, fgconsole, fgrep, find, findfs, flash_lock,
        flash_unlock, flashcp, flock, fold, free, freeramdisk, fstrim, fsync,
        ftpget, ftpput, fuser, getenforce, getopt, getsebool, grep, groups,
        gunzip, gzip, halt, head, hexdump, hwclock, id, ifconfig, inetd,
        insmod, install, ionice, iostat, ip, kill, killall, killall5, less, ln,
        losetup, ls, lsattr, lsmod, lsof, lspci, lsusb, lzcat, lzma, lzop,
        lzopcat, man, matchpathcon, md5sum, mesg, mkdir, mkdosfs, mke2fs,
        mkfifo, mkfs.ext2, mkfs.vfat, mknod, mkswap, mktemp, modinfo, modprobe,
        more, mount, mountpoint, mpstat, mv, nanddump, nandwrite, nbd-client,
        nc, netstat, nice, nmeter, nohup, nslookup, ntpd, od, openvt, patch,
        pgrep, pidof, ping, pipe_progress, pkill, pmap, poweroff, printenv,
        printf, ps, pstree, pwd, pwdx, rdate, rdev, readlink, realpath, reboot,
        renice, reset, resize, restorecon, rev, rm, rmdir, rmmod, route,
        run-parts, runcon, rx, sed, selinuxenabled, seq, sestatus, setconsole,
        setenforce, setfiles, setkeycodes, setsebool, setserial, setsid, sh,
        sha1sum, sha256sum, sha3sum, sha512sum, sleep, smemcap, sort, split,
        stat, strings, stty, sum, swapoff, swapon, switch_root, sync, sysctl,
        tac, tail, tar, taskset, tee, telnet, telnetd, test, tftp, tftpd, time,
        timeout, top, touch, tr, traceroute, true, ttysize, tune2fs, umount,
        uname, uncompress, unexpand, uniq, unix2dos, unlzma, unlzop, unxz,
        unzip, uptime, usleep, uudecode, uuencode, vi, watch, wc, wget, which,
        whoami, xargs, xz, xzcat, yes, zcat

BusyBox - a set of unix-utilities of the command line. More details you can read in Wikipedia.

Almost every command has additional arguments that can be as negligible and dramatically influence it work.
For information, it is worth referring to the documentation of the relevant command.

Getting tips on commands

In order to get a hint on working with a command enter <command_name> --help, where <command_name> - the name of the command (may not work with all commands).

 Example

mkdir --help

Because All this is the basic Linux commands, then on the Internet a huge amount of information, instructions and explanations to work with them.
Just enter a species request in the search string linux <command_name> примерor linux команда <command_name> пример , where <command_name> - the name of the required command.

List of popular commands

Команда

Описание

Пример

clear

Clear console window

clear

exit

Exit from the console of the emulator

exit

cp

Copy files

cp /path/where/copy/file.txt /where/file.txt

ls

Displays the contents of the directory on the specified path

ls /path/to/directory

mv

Moving files and directories

mv /source/path/file.txt /finite/file.txt

rm

Deleting files

rm /path/to/file.txt

rmdir

Removal of an empty directory

rmdir /path/to/directory/

touch

Creating a file

touch /sdcard/Alarms/alarm.txt

mkdir

Creating a directory

mkdir /sdcard/newFolder

pwd

Path of the current directory

pwd

date

Displays the current date and time

date

du

File size

du /путь/к/файлу.txt

service list

List of working services

service list

Specific Android commands - am and pm

am

This subsection is based on the article How Android works, part 3

Official documentation of the am command - Call activity manager

Command am- this wrapper over the class ActivityManager.

Activity

The main type of application components under Android — is activity. Activity — this is one "screen" of application. Activity can be compared with the page on the web and with the application window in the traditional window interface. Most often, the Activity window is deployed on the entire available screen.
For example, in an application for email (email client) can be such Activity as Inbox Activity (list of incoming letters), Email Activity (reading one letter), Compose Activity (writing a letter) and Settings Activity (settings).

 Call examples
  • Running a file manager - am start com.cyanogenmod.filemanager/com.cyanogenmod.filemanager.activities.NavigationActivity

  • Opening settings - am start -n com.android.settings/.Settings

  • Run browser am start -n com.android.browser/.BrowserActivity

Intent

Like pages on one site, activities of one application can be run both from each other and independently of each other (by other applications). If on the web another page is accessed by a URL (link), then in Android activities are run through intents.

Intent — it is a message that tells the system what to "do" (for example, open a given URL, write an email to a given address, call a given phone number, or take a photo).

An application can create such an intent and pass it to the system, and the system decides which activity (or other component) will handle it. This activity is launched by the system (in an existing application process or in a new one if it is not already started), this intent is passed to it, and it executes it.

 Call examples

Open URL- am start -a android.intent.action.VIEW -d https://zennolab.com

Browser search am start -a android.intent.action.WEB_SEARCH -n com.android.browser/.BrowserActivity --es query 'Hello, world!'(the browser must be running at this moment, how to do this can be seen in the examples of the previous paragraph - Activity)

pm

Official documentation for the team pm - Call package manager

This command allows you to install and uninstall applications, interact with packages of installed applications (delete data, enable / disable an application), get a list of installed applications, etc.

 Examples
  • Delete application - pm uninstall com.example.MyApp

  • Get a list of all applications - pm list packages (this list can also be obtained using the Installed Applications tool )

    • list of third party applications - pm list packages -3

    • list of system applications - pm list packages -s


  • No labels