Description
Launch activity:
am start -n <package/.activity_name>
am start -n com.example.app/.MainActivity
Run shell script from a file:
sh <file_path>
sh /storage/emulated/0/script.sh
Run the shell script from the file. Stop execution of the shell script if an error occurs during execution:
sh -e <file_path>
sh -e /storage/emulated/0/script.sh
Change permissions to access a file or folder:
chmod <permissions> <path_to_file_or_folder>
chmod 777 /storage/emulated/0
Where
The first digit is the owner
The second digit is the normal users
Third digit - guests
0 - access denied
4 - read only
5 - read and execute
6 - read and write
7 - all allowed (read, execute, write)
Screencap <file_path/file_name.png>
- take a screenshot and save it in the path
For example: screencap /storage/emulated/0/Test.png
, saves a screenshot at the path /storage/emulated/0 with the file name Test.png. Basically you need to use PNG and not another format.
Execute the command after a period of time:
sh -c "sleep <time>; <shell_command>"
sh -c "sleep 5; echo 'hi'"
Unzip the archive:
unzip <path_to_archive> -d <path_to_unzip>
unzip /storage/emulated/0/test.zip -d /storage/emulated/0
settings get <tаble> <setting_name>
- get the setting value for the current user
settings put <tаble> <setting_name> "<settings_vаlue>"
- set the value of the setting for the current user
settings delete <tаble> <setting_name>
- delete the setting for the current user
settings list <table>
- list of settings and values in the table
after get/delete/put/list you can specify user id --user
where <tаble> is the name of one of the system tables (system, global, secure)
am get-current-user
- get current user id
dumpsys package <pаckage>
- package information
grep -l
— sort excluding lines that include this text
grep
— sort including only lines that include this text
grep -x
— sort including only those strings that match this text completely
Text encryption/encoding:
echo "<tехt>" | <crypt_arguments>
sha256sum, sha512sum, sha224sum, sha384sum, base64, base64 -d (decrypt).
stat <path_to_file_or_folder>
- print file or folder stats
appops get <package>
- get package permissions
appops set <package> <permission> <status>
- set package permission
Status:
allow - allow
deny - deny
ignore - the application will think that it has been granted permission, but when trying to use it nothing will happen
And maybe some commands should have a detailed description added to them when they are pressed, like chmod.