Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

If Termux is Linux can I ask a question how to simplify a batch command?

325 views
Skip to first unread message

Scott Lurndal

unread,
Sep 24, 2021, 3:37:04 PM9/24/21
to
If Termux is Linux can I ask a question how to simplify a command?

This brings up any named Android Activity at the Windows command line.
C:\> adb shell am start -n com.google.android.gms/.ads.settings.AdsSettingsActivity

If the named Activity has special characters, a backslash escapes them.
C:\> adb shell am start -n com.android.settings/.Settings\$AppMemoryUsageActivity

To bring up the Activity page by name only on Android I installed Termux.
<https://play.google.com/store/apps/details?id=com.termux>

When I ran this inside of Termux, it popped up the Android setting Activity.
$ am start -n com.google.android.gms/.ads.settings.AdsSettingsActivity

Which was the first time I was able to bring up an Activity on Android
from just the name of the Activity (and not from an app's inside GUI).

The syntax works even for Activities whose name have a dollar sign in them.
$ am start -n com.android.settings/.Settings$AppMemoryUsageActivity

So now we know it can be done to bring up an Activity from just the name.
But _typing_ that command more than once inside of Termux is a pain.

Remembering the full command is even worse! :(
$ am start -n com.android.settings/.Settings
$ am start -n com.android.settings/.applications.ManageApplications
$ am start -n com.android.settings/.network.telephony.MobileNetworkActivity
$ am start -n com.android.settings/.Settings\$AppAndNotificationDashboardActivity
$ am start -n com.android.settings/.Settings\$AppMemoryUsageActivity
$ am start -n com.android.settings/.Settings\$NotificationAppListActivity
$ am start -n com.android.settings/.Settings\$PowerUsageSummaryActivity
$ am start -n com.android.settings/.Settings\$SecDisabledAppsActivity
$ am start -n com.google.android.gms/.ads.settings.AdsSettingsActivity
$ am start -n com.google.android.gms/.app.settings.GoogleSettingsIALink
$ am start -n com.google.android.gms/.app.settings.GoogleSettingsLink
$ am start -n com.google.android.gms/.gcm.GcmDiagnostics
$ am start -n com.google.android.gms/.location.settings.LocationAccuracyActivity
$ am start -n com.google.android.gms/.mdm.settings.AdmSettingsActivity
$ am start -n com.google.android.gms/.nearby.exposurenotification.settings.SettingsActivity
$ am start -n com.google.android.gms/.nearby.sharing.ContactSelectActivity
$ am start -n com.google.android.gms/.update.SystemUpdateActivity
$ am start -n com.google.android.gms/co.g.Space
$ am start -n com.samsung.android.secsoundpicker/.SecSoundPickerActivity

Is Termux like Linux?

Is there a good method to make running that command easier outside Termux?
(Can a Termux command create a link to add a homescreen icon for instance?)

Can we run some kind of Linux batch command inside of Termux this way?
Can we manually create a homescreen icon that executes that command?

Stefen Carroll - fretwizzen

unread,
Sep 24, 2021, 4:59:42 PM9/24/21
to
Are you being stupid on purpose? Snit sock Snit Michael Glasser continues
to reference the doxing accusation he wrote about me, even though Peeler
admitted that he KNOWS HE LIED about it.
What an amazing search:
<https://www.google.com/search?q=dustin+cook%3A+functionally+illiterate+fraud>
or <https://duckduckgo.com/?q=dustin+cook+the+functionally+illiterate+fraud>

You can do even just this <https://www.bing.com/search?q=%22functionally%20illiterate%20fraud%22>
From what I've seen (which is none of it lately), it looks like the
trolling nonsense needs more and more resources.


--
This broke the Internet
https://gibiru.com/results.html?q=Steve+Petruzzellis+%22NARCISSISTIC+BIGOT%22
https://duckduckgo.com/?q=%22NARCISSISTIC+BIGOT%22
Dustin Cook is a functional illiterate fraud

David W. Hodgins

unread,
Sep 24, 2021, 5:26:08 PM9/24/21
to
I have no experience with android. Wikipedia states that termux is running
a linux environment. Does it support the alias command and use of a user's start
up script? If so, an alias could be created for each of the above command lines. If
not, does it support creating an executable script for the user? If so, each command
line could be put into a script file that the user could then run by typing the name
of the script file as a command.

Regards, Dave Hodgins

--
Change dwho...@nomail.afraid.org to davidw...@teksavvy.com for
email replies.

J.O. Aho

unread,
Sep 24, 2021, 5:42:24 PM9/24/21
to
On 24/09/2021 21.37, Scott Lurndal wrote:
> If Termux is Linux can I ask a question how to simplify a command?

No Termux isn't Linux, it's a terminal which runs on Android, which is a
Linux.


> The syntax works even for Activities whose name have a dollar sign in them.
> $ am start -n com.android.settings/.Settings$AppMemoryUsageActivity
>
> So now we know it can be done to bring up an Activity from just the name.
> But _typing_ that command more than once inside of Termux is a pain.

Termux uses some form of bash and supports ~/.bashrc and
~/.bash_profile, so you can use alias to create a simpler to remember
command

say you add the following line into your ~/.bashrc

alias run-settings="am start -n com.android.settings/.Settings"

then next time you start Termux you can type:

run-settings


> Is there a good method to make running that command easier outside Termux?
> (Can a Termux command create a link to add a homescreen icon for instance?)

Did you bother to check the Termux homepage/wiki?
https://wiki.termux.com/wiki/Termux:Widget


> Can we run some kind of Linux batch command inside of Termux this way?
> Can we manually create a homescreen icon that executes that command?

No, Linux don't have batch files, you have shell scripts which have some
differences depending on which shell you use, Termux uses bash by
default, so you would make a script like the following 2 line script:

--- file ---
#!/bin/bash
am start -n com.android.settings/.Settings$AppMemoryUsageActivity
--- eof ---

afterwards you need to run the following command to make it executable:
chmod +x thenameofthefile

When you run it, you need to know the path to the file, either full path
or relative from where you are, if it's in the directory where you are
in Termux then you run it like:

./thenameofthefile


--

//Aho

Scott Lurndal

unread,
Sep 24, 2021, 9:07:49 PM9/24/21
to
"David W. Hodgins" <dwho...@nomail.afraid.org> asked
> I have no experience with android.

I have no experience with Linux so we're kind of even. :)

> Wikipedia states that termux is running a linux environment.

Thanks for checking.
The Termux command line sure _looks_ like Linux to me too!
https://www.learntermux.tech/2020/01/basic-commands-in-termux.html

But I see J.O. Aho said it's Android that is Linux (which is good enough).

> Does it support the alias command and use of a user's start
> up script?

I googled for "linux alias example" to find these.
https://www.computerhope.com/unix/ualias.htm

In Termux, the "alias --help" spits out the documentation.
Termux$ alias --help

A quick test was this (which required the equal sign & escape characters).
Termux$ alias x="ls -l"
Termux$ x (this did the "ls -l" command)

> If so, an alias could be created for each of the above command lines.

Here's what I tried on the simplest example of the Android Activity
(an "Activity", AFAICT, is just a "page" or "screen" inside any app).
Each "Activity" (AFAIK) has a unique name to that Activity.

Termux$ alias adid="am start -n com.google.android.gms/.ads.settings.AdsSettingsActivity"
Then "adid" in Termux popped up the "reset advertising id" Activity.

Now I just need to make it persistent which I see J.O. Aho suggested
saving into a "~/.bashrc" file.

Termux% cat ~/.bashrc
cat /data/data/com.termux/files/home/.bashrc
No such file or directory
Termux$ alias > ~/.bashrc
Termux% cat ~/.bashrc
alias adid='am start -n com.google.android.gms/.ads.settings.AdsSettingsActivity'
(Note it somehow changed my doublequotes to singlequotes.)
Termux$ unalias adid
Termux$ adid (this failed)
Termux$ source ~/.bashrc
Termux$ adid (this worked)

I killed & restarted Termux and it was persistent.
I will need to reboot the phone now to see if it's persistent.

> If
> not, does it support creating an executable script for the user? If so, each command
> line could be put into a script file that the user could then run by typing the name
> of the script file as a command.

I saw the answer to that question by J.O. Aho so I'll respond there.
The end goal is a shortcut on the homescreen that runs the command.

Scott Lurndal

unread,
Sep 24, 2021, 9:33:17 PM9/24/21
to
> I will need to reboot the phone now to see if it's persistent.

When I rebooted the Android phone, and then opened up Termux,
Termux must have used the previously created ~/.bashrc file
because when I typed "adid" in the Termux command line, the Android
Activity page to "reset advertiser id" came up on my phone.

Following J.O. Aho's instructions I looked up what native editor Termux uses
(nano) and created this bash file "adid.exe" in the current directory.\
<https://www.learntermux.tech/2020/01/basic-commands-in-termux.html>

From that I was able to run the following.
Termux$ cp ~/.bashrc adid.exe
Termux$ nano adid.exe
-- this is the result of my edits --
#!/bin/bash
alias adid='am start -n com.google.android.gms/.ads.settings.AdsSettingsActivity'
--- eof ---

Termux$ chmod +x adid.exe

But when I ran that, it didn't do anything:
Termux$ adid.exe (command not found)
Termux$ ./adid.exe (it didn't do anything)
Termux$ ls /bin/bash (No such file or directory)

There isn't anything in the FAQ suggested in the bash file syntax
which I assume is my problem above.
https://wiki.termux.com/wiki/FAQ

Scott Lurndal

unread,
Sep 24, 2021, 10:07:46 PM9/24/21
to
Looks like Termux bash isn't where it is on a Linux system.
https://android.stackexchange.com/questions/185682/path-for-bash-in-android-termux

-- this is the latest result of my edits --
#!/data/data/com.termux/files/usr/bin/bash
alias adid='am start -n com.google.android.gms/.ads.settings.AdsSettingsActivity'
--- eof ---

But it still did nothing when I ran that command
$ chmod +x ./adid.exe
$ ./adid.exe
(that did nothing)

I even tried these two suggested workarounds, but nothing changed.
$ pkg install termux-exec
$ termux-fix-shebang ./adid.exe

In that help page I see I should have named it "adid.sh"
so I will fix that.

Scott Lurndal

unread,
Sep 24, 2021, 10:51:19 PM9/24/21
to
J.O. Aho writes:
"J.O. Aho" <us...@example.net> asked
> Termux uses bash by default

Success!
I got what you suggested to work, thanks to you.

A. Alias
$ alias adid="am start -n com.google.android.gms/.ads.settings.AdsSettingsActivity"
Then "adid" in Termux popped up the "reset advertising id" Activity.

$ cat ~/.bashrc
cat /data/data/com.termux/files/home/.bashrc
No such file or directory
$ alias > ~/.bashrc
$ cat ~/.bashrc
alias adid='am start -n com.google.android.gms/.ads.settings.AdsSettingsActivity'
(Note it somehow changed my doublequotes to singlequotes.)
$ unalias adid
$ adid (this failed)
$ source ~/.bashrc
$ adid (this worked, which means it pops up the "reset ad id" gui)
I rebooted the phone and it still worked, so the alias is done.

I just need to get the alias to work from the homescreen somehow.

B. Bash
$ nano ./adid.sh
-- begin file below --
#!/data/data/com.termux/files/usr/bin/bash
am start -n com.google.android.gms/.ads.settings.AdsSettingsActivity
--- the file is just two lines ---

$ chmod +x ./adid.sh
$ ./adid.sh (at first that did nothing)

I then tried these suggested workarounds (one or more of which worked).
https://android.stackexchange.com/questions/185682/path-for-bash-in-android-termux
$ pkg install termux-exec
$ termux-fix-shebang ./adid.sh
$ bash ./adid.sh (now it works!)

I haven't been able to get it in the path yet so I don't have to always type
the ./ but other than that, it works and survives an Android phone reboot.

Now I need to figure out how to get either one into a single tap shortcut on
the Android homescreen, but that might be a task for the android ng instead.

David W. Hodgins

unread,
Sep 24, 2021, 11:03:11 PM9/24/21
to
Does android support the man command? If so, "man bash" will have a very long
document that explains bash startup and usage. The linux version
https://man7.org/linux/man-pages/man1/bash.1.html#INVOCATION explains the files
bash uses during startup.

Put the alias commands in ~/.bash_profile, ~/.bash_login, or ~/.profile
Whichever one already exists. If none of those exist create any one of them
with the alias commands. The file does not need to be marked executable. It's
read by bash during startup.

Branimir Maksimovic

unread,
Sep 24, 2021, 11:50:31 PM9/24/21
to
write script shell, that is you can execute script as anything else?

--
7-77-777
\|/
---
/|\
Evil Sinner!

Scott Lurndal

unread,
Sep 25, 2021, 1:55:11 AM9/25/21
to
David W. Hodgins writes:
> Does android support the man command?

I don't know if there is a better command-line interface to Android but what
I'm using is Termux, so the question is whether Termux supports man...
<https://play.google.com/store/apps/details?id=com.termux>

I just tested and this is what happened when I tested as you suggested.
$ man bash
The program is not installed.
Install it by executing: pkg install man
$ pkg install man
Unable to locate package man

I'm sure that's just a configuration problem on my Android phone, so my
answer to your question is that, "yes", Termux seems to support man.

But that man support doesn't matter at this point because the Internet
supports man. And better yet, the problem of syntax has been solved.

a. The alias "adid" worked to bring up the Android Activity
b. The file "adid.sh" worked to bring up the Android Activity
(Where an "Activity" is simply a screen or page inside any given app.)

The question now is probably out of the realm of Linux per se.
The question is now how to make that a finger tap instead of a command.

I'm currently searching for how to run a command (or alias) from an Android
homescreen shortcut - which would solve the problem once and for all.

Scott Lurndal

unread,
Sep 25, 2021, 2:01:51 AM9/25/21
to
Branimir Maksimovic writes:
> write script shell, that is you can execute script as anything else?

This script worked to bring up an "Activity" at the command line.
-- begin file below --
#!/data/data/com.termux/files/usr/bin/bash
am start -n com.google.android.gms/.ads.settings.AdsSettingsActivity
--- the file is just two lines ---

To run that script at the Android Termux command line, I just type:
$ ./adid.sh

There is only one thing left which I'm googling for which is how
to attach that command to a homescreen shortcut for singleclick finger-tap access.

Some of the Android tools I'm testing out which may do that are these.
These are respected shortcut creators
Shortcut Maker, by Rushikesh Kamewar (free, ad free, gsf free, rated 4.4)
https://play.google.com/store/apps/details?id=rk.android.app.shortcutmaker

Shortcut Creator, by AlexTernHome (free, ad free, gsf free, rated 4.3)
https://play.google.com/store/apps/details?id=com.alextern.shortcuthelper

QuickShortcutMaker, by sika524 (free, ad free, gsf free, ratred 4.3)
https://play.google.com/store/apps/details?id=com.sika524.android.quickshortcut

Activity Launcher, by Adam Szalkowski (free, ad free, gsf free, rated 4.1)
https://play.google.com/store/apps/details?id=de.szalkowski.activitylauncher

Activities, by J. Cunningham (free, ad free, gsf free, rated 4.0)
https://play.google.com/store/apps/details?id=com.cunnj.activitylauncher

This is a respected shortcut inspector
Shortcut Widgets (+ Inspector), by Hamed Nikbakht (free, ad free, gsf free, rated 3.7)
https://play.google.com/store/apps/details?id=com.cemique.shortcutwidgets

These are respected intent launchers

Instant Intent, by TrianguloY (free, ad free, gsf free, rated 4.7)
https://play.google.com/store/apps/details?id=com.trianguloy.instantintent

Intent Launcher, by Ville Valta (free, ad free, gsf free, rated 4.3)
https://play.google.com/store/apps/details?id=com.villevalta.intentlauncher

Intent, by krow (free, ad free, gsf free, rated 4.3)
https://play.google.com/store/apps/details?id=krow.dev.scheme

IntentTask, by Marco Stornelli (free, ad free, gsf free, rated 4.3)
https://play.google.com/store/apps/details?id=com.balda.intenttask

Intent Viewer, by maigolab (free, ad free, gsf free, rated 2.1)
https://play.google.com/store/apps/details?id=info.maigo.lab.intentviewer

I'm hoping I can figure out, perhaps using one of those tools above,
how to attach the Termux script to a single-click homescreen icon.

Øyvind Røtvold

unread,
Sep 25, 2021, 4:05:44 AM9/25/21
to
Scott Lurndal <sc...@slp53.sl.home> writes:

[ ... ]
> Termux$ nano adid.exe
> -- this is the result of my edits --
> #!/bin/bash
> alias adid='am start -n com.google.android.gms/.ads.settings.AdsSettingsActivity'
> --- eof ---
>
> Termux$ chmod +x adid.exe
>
> But when I ran that, it didn't do anything:

What did you expect it to do? It starts in a bash, then defines an
alias, then exits so the alias disappears; it's essentially a NO-OP
script.

[ ... ]

To the OP:

Yes Termux is a linux system and you can do all kind of scripting on
it, as noted by Scott the file system is totally different and bash
does not reside at /bin/bash, but i assume this is handled for the
hashbang (#!/bin/bash) construct.

$ type bash
bash is /data/data/com.termux/files/usr/bin/bash

--
.. Ųyvind - soon to appear in a kill file near you.
.. Ignorance can be cured; stupidity is forever.

J.O. Aho

unread,
Sep 25, 2021, 4:20:00 AM9/25/21
to
On 25/09/2021 04.51, Scott Lurndal wrote:

> I just need to get the alias to work from the homescreen somehow.
> Now I need to figure out how to get either one into a single tap shortcut on
> the Android homescreen, but that might be a task for the android ng instead.

alias is only for the command line, what you want is described in the
Temux wiki, check the link I posted in my first response, it gives you
the possibility to have a widget on the home screen with those scripts
you want to execute.

--

//Aho

Jasen Betts

unread,
Sep 25, 2021, 7:30:52 AM9/25/21
to
On 2021-09-24, Scott Lurndal <sc...@slp53.sl.home> wrote:
> If Termux is Linux can I ask a question how to simplify a command?

Termux is mostly bash and a "terminal emulator", Android is already
Linux.

> So now we know it can be done to bring up an Activity from just the name.
> But _typing_ that command more than once inside of Termux is a pain.
>
> Remembering the full command is even worse! :(
> $ am start -n com.android.settings/.Settings
> $ am start -n com.android.settings/.applications.ManageApplications
> $ am start -n com.android.settings/.network.telephony.MobileNetworkActivity
> $ am start -n com.android.settings/.Settings\$AppAndNotificationDashboardActivity
> $ am start -n com.android.settings/.Settings\$AppMemoryUsageActivity
> $ am start -n com.android.settings/.Settings\$NotificationAppListActivity
> $ am start -n com.android.settings/.Settings\$PowerUsageSummaryActivity
> $ am start -n com.android.settings/.Settings\$SecDisabledAppsActivity
> $ am start -n com.google.android.gms/.ads.settings.AdsSettingsActivity
> $ am start -n com.google.android.gms/.app.settings.GoogleSettingsIALink
> $ am start -n com.google.android.gms/.app.settings.GoogleSettingsLink
> $ am start -n com.google.android.gms/.gcm.GcmDiagnostics
> $ am start -n com.google.android.gms/.location.settings.LocationAccuracyActivity
> $ am start -n com.google.android.gms/.mdm.settings.AdmSettingsActivity
> $ am start -n com.google.android.gms/.nearby.exposurenotification.settings.SettingsActivity
> $ am start -n com.google.android.gms/.nearby.sharing.ContactSelectActivity
> $ am start -n com.google.android.gms/.update.SystemUpdateActivity
> $ am start -n com.google.android.gms/co.g.Space
> $ am start -n com.samsung.android.secsoundpicker/.SecSoundPickerActivity
>
> Is Termux like Linux?

In what way?

> Is there a good method to make running that command easier outside Termux?
> (Can a Termux command create a link to add a homescreen icon for instance?)

this looks promising: https://wiki.termux.com/wiki/Termux:Widget

--
Jasen.

Branimir Maksimovic

unread,
Sep 25, 2021, 7:33:51 AM9/25/21
to
On 2021-09-25, Scott Lurndal <sc...@slp53.sl.home> wrote:
> There is only one thing left which I'm googling for which is how
> to attach that command to a homescreen shortcut for singleclick finger-tap access.
>

aha! take a search for starting command line commands from Android screen
or such...

--
7-77-777
Evil Sinner!

Stephen Carroll - frelwizzen

unread,
Sep 25, 2021, 10:36:05 AM9/25/21
to
Until or unless Slimer offers up his 'top-of-the-line' GNU/Linux system
for evaluation, there is no competition, just giddy claims. I want Slimer
to support his trolling accusation. Let's see the links Slimer. When
I accused Slimer of spamming as Snit I actually supported it with evidence.

I have a program I use as well, but it's better than yours. Slimer is
STILL focusing on exclusively himself, as I predicted, when it comes
to the business of hacking. And he completely snips the fact that his
"ally" has not only admitted to engaging in this against Snit but he
has said he considers it to be no huge deal... a joke.

Which regular knows C, is a programmer, has hacked Snit's ID, has an
obsession and is a huge whining loser who, when he is called out, posts
all kinds of ridiculous crap even when he's *not* flooding... AND...
who endeavors to pin everything HE is doing on "advocates" and has for
over a decade?

--
My Snoring Solution
<http://web.archive.org/web/20200909135108/https://www.truepeoplesearch.com/details?name=dustin+james+cook&citystatezip=Kingston%2C+TN&rid=0xl&Diesel=&Gremlin=&Raid=>
Dustin Cook the functionally illiterate fraud

Scott Lurndal

unread,
Sep 25, 2021, 1:46:47 PM9/25/21
to
<orot...@gmail.com> writes:
> What did you expect it to do? It starts in a bash, then defines an
> alias, then exits so the alias disappears; it's essentially a NO-OP
> script.

Yup. Thanks. You are correct. That was an initial boo boo since corrected.
There are only two steps missing now - but the solution may not be in Linux?

SOLVED: (thanks to the advice on this linux newsgroup!)
a. We can now bring up the "Reset Ad ID" Activity from inside of Termux.
b. Either by using the "adid" ~/.bashrc alias or by the "adid.sh" script\

This is the one-line "adid" alias:
$ alias adid="am start -n com.google.android.gms/.ads.settings.AdsSettingsActivity"

This is the two-line "adid.sh" shell script:
#!/data/data/com.termux/files/usr/bin/bash
am start -n com.google.android.gms/.ads.settings.AdsSettingsActivity

UNSOLVED:
c. But we can't yet hit the damn "reset" button automatically
d. We have to actually press the button, manually (aurgh!)

WORSE:
e. We haven't figured out how to run the "adid.sh" script from a shortcut
f. Where that shortcut would reside on the homescreen to run "adid.sh"

We don't yet know the Linux syntax to _hit_ the "reset" button yet.
But J.O. Aho suggested that Termux scripts can be turned into a widget.
So I'll try that next... <https://wiki.termux.com/wiki/Termux:Widget>

> Yes Termux is a linux system and you can do all kind of scripting on
> it, as noted by Scott the file system is totally different and bash
> does not reside at /bin/bash, but i assume this is handled for the
> hashbang (#!/bin/bash) construct.
> $ type bash
> bash is /data/data/com.termux/files/usr/bin/bash

It's actually _worse_ than that, I found out (by trial and error).

I don't know exactly what I did that made the "adid.sh" finally work but the
script didn't work until I tried the multiple workarounds as shown below.

$ nano ./adid.sh
-- begin file below --
#!/data/data/com.termux/files/usr/bin/bash
am start -n com.google.android.gms/.ads.settings.AdsSettingsActivity
--- the file is just two lines ---

$ chmod +x ./adid.sh
$ ./adid.sh (at first that did nothing)

I then tried these workarounds (I'm not sure which one made it work).
<https://android.stackexchange.com/questions/185682/path-for-bash-in-android-termux>
$ pkg install termux-exec
$ termux-fix-shebang ./adid.sh
$ bash ./adid.sh (now it works!)

I haven't been able to get it in the path yet so I don't have to always type
the ./ but other than that, it works and survives an Android phone reboot.

What is left to do is a few things that may not be linux solutions.
1. We need the "adid.sh" script to actually _press_ the damn "reset" button.
2. Then we need to put it inside a shortcut on the home screen (somehow).

That way, any time you want to reset the Ad ID, you just press the shortcut.
(Later we can automate it to happen on events, such as upon screen unlock).

But baby steps first...

I see that J.O. Aho says there's a way to run a widget that will run that
command which he says is explained in the Termux Wiki so that's what's next.
<https://wiki.termux.com/wiki/Termux:Widget>

David W. Hodgins

unread,
Sep 25, 2021, 1:54:46 PM9/25/21
to
On Sat, 25 Sep 2021 01:55:17 -0400, Scott Lurndal <sc...@slp53.sl.home> wrote:
> $ pkg install man
> Unable to locate package man

On my Mageia linux installation, there are two packages for man.
man-db - Tools for searching and reading man pages
man-pages - English man (manual) pages from the Linux Documentation Project

John Robertson

unread,
Sep 27, 2021, 1:13:32 AM9/27/21
to
https://andronix.app/

Run full-fledged Linux Distros right on your Android device without rooting
--
"Old pinballers never die, they just flip out."

Scott Lurndal

unread,
Sep 27, 2021, 3:03:54 AM9/27/21
to
J.O. Aho writes:
> alias is only for the command line, what you want is described in the
> Temux wiki, check the link I posted in my first response, it gives you
> the possibility to have a widget on the home screen with those scripts
> you want to execute.

Turns out the Google Termux sucks compared to the F-Droid Termux.
<https://www.xda-developers.com/termux-terminal-linux-google-play-updates-stopped/>

If you installed the Google Play Termux, you need to migrate it to F-Droid.
<https://docs.andronix.app/termux/migrating-to-f-droid/>

Then you can follow the two-line instructions found here:
<https://wiki.termux.com/wiki/Termux:Widget>

Using Termux:Widget I got (almost) what I wanted working at a single tap.

For the first time ever...
a. Tapping the homescreen icon now brings up the "Reset Ad Id" form.
b. But it's not a shortcut but a widget (don't know if/how that matters).
c. Now I only have to figure out how to make it _press_ the "Reset" button!

Here are cut and paste instructions anyone can follow.
1. Install F-droid <https://f-droid.org/>
<https://f-droid.org/F-Droid.apk>
2. Install F-Droid Termux <https://f-droid.org/en/packages/com.termux/>
<https://f-droid.org/repo/com.termux_117.apk>
3. Add F-Droid Termux Widget <https://f-droid.org/en/packages/com.termux.widget/>
<https://f-droid.org/repo/com.termux.widget_12.apk>
4. Run the F-Droid Termux and create an alias we'll name "rad" for reset ad id.
$ rad
(This should report: No command rad found)
$ alias rad 'am start -n com.google.android.gms/.ads.settings.AdsSettingsActivity'
$ rad
(this should pop up the "Reset Advertising ID" Activity on your phone
(manually close that Activity for now - we can programmatically close it later)
$ cat ~/.bashrc
cat /data/data/com.termux/files/home/.bashrc
No such file or directory
$ alias > ~/.bashrc
$ cat !$
alias rad='am start -n com.google.android.gms/.ads.settings.AdsSettingsActivity'
$ unalias rad
$ rad
(This should report: No command rad found)
$ source ~/.bashrc
$ rad
(this should pop up the "Reset Advertising ID" Activity on your phone
(manually close that Activity for now - we can programatically close it later)
5. Run the F-Droid Termux and create two directories for the shortcut widget
$ mkdir -p $HOME/.shortcuts (we will put our shell script here)
$ mkdir -p $HOME/.shortcuts/tasks (we didn't use this directory yet)
6. Create a shell script to open up the reset ad id Activity.
$ cd $HOME/.shortcuts
$ nano ./rad.sh
Edit the result to look like this:
#!/data/data/com.termux/files/usr/bin/bash
am start -n com.google.android.gms/.ads.settings.AdsSettingsActivity
$ chmod +x ./rad.sh
$ ./rad.sh
(nothing will happen)
7. Modify termux to be able to execute user shell scripts on Android.
$ pkg install termux-exec
8. Test your shell script.
$ ./rad.sh
(this should pop up the "Reset Advertising ID" Activity on your phone
(manually close that Activity for now - we can programmatically close it later)
9. Add the Termux Widget to your homescreen.
Long press your Android homescreen.
Select "Widgets" & then "Termux:Widget" & place it on your Android homescreen.
It will ask: Create widget and allow access? to which you press "Yes"
Then press the "rad.sh" entry showing up in that Termux Widget.
"Termux requires "Display over other apps" permission
to start terminal sessions from background on Android >=10."
"Grants it from Settings -> Apps -> Termux -> Advanced"
10. Grant Termux permission to display over other apps:
Android11:Settings > Apps > Your apps > Termux > Appear on top = (change off to on)
11. Now press the Termux Widget entry named "rad.sh"
(this should pop up the "Reset Advertising ID" Activity on your phone
(manually close that Activity for now - we can programmatically close it later)
12. Reboot the phone & ensure everything is persistent.

What's left?
Figure out how to add the step to actually _press_ the "Reset" button!

Øyvind Røtvold

unread,
Sep 27, 2021, 5:21:02 AM9/27/21
to
Scott Lurndal <sc...@slp53.sl.home> writes:

[...]
>
> For the first time ever...
> a. Tapping the homescreen icon now brings up the "Reset Ad Id" form.
> b. But it's not a shortcut but a widget (don't know if/how that matters).
> c. Now I only have to figure out how to make it _press_ the "Reset" button!

I doubt that you will find anything to do step c in Termux, you should
do a wider search for this kind of feature.

I know this kind of thing existed for MS-Windows some decades ago, and
it would be straightforward in X-Windows, but with increased security
for GUIs it may not be that easy to achieve.

>
> Here are cut and paste instructions anyone can follow.
[ ... ]
> 4. Run the F-Droid Termux and create an alias we'll name "rad" for reset ad id.

This step is superfluous.

[ ... ]

> 6. Create a shell script to open up the reset ad id Activity.
> $ cd $HOME/.shortcuts
> $ nano ./rad.sh
> Edit the result to look like this:
> #!/data/data/com.termux/files/usr/bin/bash
> am start -n com.google.android.gms/.ads.settings.AdsSettingsActivity
> $ chmod +x ./rad.sh
> $ ./rad.sh
> (nothing will happen)

You're using bash for scripting where sh would suffice, this is a bad
habit - I know that may not be relevant to you now, but for further
endeavours into scripting this should be kept in mind.


Also 'am' is not a Termux command, it's built into android and can
also be called from adb (but that lacks the widget option).

In fact this command:

$ adb shell 'while true ; do sleep 10 ; am start -n com.google.android.gms/.ads.settings.AdsSettingsActivity ; done &'

Provided more fun than I was prepared to handle.

[ ... ]

Snit Michael Glasser

unread,
Sep 27, 2021, 12:06:32 PM9/27/21
to
Until John Gohde offers up his 'better' GNU/Linux application for review,
there is no threat, just unsupported contentions.

John Gohde's legendary "technical support skills" made it so he could
not find a plugin he wants that everyone else is already using with ClamXav.

Helping John Gohde and helping Theo is not the same thing. Nobody should
knowingly help John Gohde do anything - except for sitting on train tracks,
poking your eyes out, or successfully decapitating himself.

John Gohde wants to punish everyone here: If he can't get attention here
then no one will.

Are people still debating this?

--
Curious how these posts are made? Email: use...@gallopinginsanity.com

Scott Lurndal

unread,
Sep 27, 2021, 2:53:19 PM9/27/21
to
> I doubt that you will find anything to do step c in Termux, you should
> do a wider search for this kind of feature.

My goal is a universal solution for anyone, even noobs, where Linux seems to
be the most powerful approach (but if I could find _anything_ that works,
I'd use it - but if I have to _build_ the approach, I'll try Linux first).

Besides, I've run scores of searches already seeking a tutorial, where the
ability to run any Android Activity from a single tap on an icon (or
automatically upon events such as homescreen wakeup) certainly exists in
automation tools such as typical payware Tasker solutions.
<https://play.google.com/store/apps/details?id=net.dinglisch.android.taskerm>

They may even exist in freeware tasker-replacement solutions but most appear
to be "fremium" tools which just annoy the hell out of me in every way.
<https://www.maketecheasier.com/tasker-alternatives-for-android/>

Even so, there aren't any extent tutorials (AFAIK) for how to bring up any
given Android Activity just from knowing the name of the Activity.

Or, maybe it exists, but I've asked on the Android newsgroup, and we have
never found a tutorial that works where you have to keep in mind syntax is
atrociously delicate when working with named Android activities.

> I know this kind of thing existed for MS-Windows some decades ago, and
> it would be straightforward in X-Windows, but with increased security
> for GUIs it may not be that easy to achieve.

The goal is to bring up _any_ Android Activity at a single tap - not just
the one simple reset-ad-id Activity we chose as the first test.

That means we need to bring up the Android Activity by name alone.

If we eliminate that strict requirement of only knowing the name and nothing
else, we already long ago solved the problem of bringing up an Activity by
searching for it in any of a number of free Android Shortcut Creator apps
(all previously cited in this thread).
a. We can run a free "Inspector" to find the name of the Activity
b. We can run a free "Shortcut Creator" to create a shortcut to it
c. But we still can't (yet) press buttons on that Activity (such as "reset")

The main reason for latching on to Linux scripting is done in the faith that
"Linux can do anything you want it to do), where I always knew that we'd
want to _interact_ with the Activity after we brought it up on the phone.'
A. We want a one-tap shortcut inside a desktop folder
B. You want that one-tap to bring up any Activity by name
C. And then you want it to auto interact with that Activity (& close it)

With your help I resolved A & B above with shell scripting inside Termux.
What I'm working on now is the shell command to press that "reset" button.

Bear in mind this is just the simplest Activity that I know of.
The goal is to be able to interact with _any_ Activity.

>> Here are cut and paste instructions anyone can follow.
> [ ... ]
>> 4. Run the F-Droid Termux and create an alias we'll name "rad" for reset ad id.
>
> This step is superfluous.

The _syntax_ on bringing up an Android Activity by name is unforgiving.
The alias is the simplest way I know to doublecheck the name is correct.

I agree the alias creation is superfluous, however, I'm writing up the steps
for newbies to follow in a tutorial that allows them to bring up _any_
Android Activity by name, where the alias is a simple and reliable "baby
step" for them to check the syntax that doesn't involve shell scripting.

> You're using bash for scripting where sh would suffice, this is a bad
> habit - I know that may not be relevant to you now, but for further
> endeavours into scripting this should be kept in mind.

As what tends to happen with solutions that are being worked out for the
first time, we take the _first_ solution that works (not necessarily the
best solution). Thank you for letting me know bash isn't the best shell.

Right now I'm focusing solely on the survival of the solution...
(we can hone it later)

It's much like evolution...

> Also 'am' is not a Termux command, it's built into android and can
> also be called from adb (but that lacks the widget option).

Oh! The adb command is on Android? Good. That may give us options.
<https://play.google.com/store/search?q=adb%20android%20debug%20bridge&c=apps>

Yikes. There are so many adb tools on Google Play I'm not sure which is the
right one (as I always strive to use the canonical tool in every tutorial).

> In fact this command:
> $ adb shell 'while true ; do sleep 10 ; am start -n com.google.android.gms/.ads.settings.AdsSettingsActivity ; done &'

As with all this Activity stuff, syntax is the bitch.
(Which is why a step-by-step tested working tutorial is what is needed.)
(And that is what I'll write when I get this to finally work.)

I test all viable suggestions before responding to them.

Hence I ran that (verbatim) Linux command on Windows over a USB tether to
the phone. Predictably it had minor syntax errors which I show only by way
of example of how nicely linux-like the Android phones' response was.
* daemon not running; starting now at tcp:5037
* daemon started successfully
/system/bin/sh: no closing quote
''' is not recognized as an internal or external command,
operable program or batch file.
C:\> adb shell "'while true ; do sleep 10 ; am start -n com.google.android.gms/.ads.settings.AdsSettingsActivity ; done &'"
inaccessible or not found
C:\> adb shell \'while true ; do sleep 10 ; am start -n com.google.android.gms/.ads.settings.AdsSettingsActivity ; done &\'
/system/bin/sh: syntax error: unexpected 'do'
'\'' is not recognized as an internal or external command,
operable program or batch file.

C:\> adb shell "'while true ; do sleep 10 ; am start -n com.google.android.gms/.ads.settings.AdsSettingsActivity ; done \&'"
inaccessible or not found

C:\> adb shell ''while true ; do sleep 10 ; am start -n com.google.android.gms/.ads.settings.AdsSettingsActivity ; done &''
'''' is not recognized as an internal or external command,
operable program or batch file.

C:\> adb shell "while true ; do sleep 10 ; am start -n com.google.android.gms/.ads.settings.AdsSettingsActivity ; done \&"
/system/bin/sh: syntax error: unexpected '\&'

Finally this worked (normally I'd omit the errors but it shows how Android
is very linux like in its responses to syntax errors - which is good).
C:\> adb shell "while true ; do sleep 10 ; am start -n com.google.android.gms/.ads.settings.AdsSettingsActivity ; done &"

BTW, to close just one Activity, this command works fine normally:
C:\> adb shell am force-stop com.google.android.gms
C:\> adb shell am force-stop com.android.settings

But in your infinite loop above, it only killed one instance at a time.

> Provided more fun than I was prepared to handle.

Yes, I saw why you said I'd see all kinds of fun thereafter! :)

That popped up the "reset ad id" Activity on the phone in an infinite loop
of sorts, where I get the all kinds of fun only after having run it. :)

Even after a "control C" in the adb window, the fun kept going.
Also after closing the adb window in Windows, the fun kept going.

This adb infinite loop is a good example where the "kill -9" on Android
works to get rid of it without needing to restart the phone otherwise.

Notice even this failed to stop the infinite loop:
C:\> adb shell stop
Must be root

Of course, this always works to get back control of the phone! :)
C:\> adb reboot

Snit Michael Glasser

unread,
Sep 27, 2021, 3:04:55 PM9/27/21
to
I'm not fuming, just the opposite I'm laughing at him because Larry Washington's
nonsense is so juvenile. He actively did not speak of all the tasks that
he would inevitably mock... and we all know why, Larry Washington could
not hide it if he tried. At least he has his own socks in his corner.

BTW, I've already shown that his use of "cult-like" to describe true advocates
is not honorable, since he's likening them to pack of wolves.

Until or unless Larry Washington offers up his 'superior' FOSS application
for testing, there is no competition, just boisterous claims. Larry Washington's
indictment is misplaced to start with, and not accurate second of all.
Is Mike Easter seeking to be just as much of a fibbing liar as Larry Washington
is already known as being? You're like a school bus in a bike rack. We
all see you hiding there and thinking you are being clever. And you're
so brain-dead you keep failing to see it.

You are as clever as a gibber monkey.

--
Eight things to never feed your dog
<https://alt.computer.workshop.narkive.com/dCDisEHZ/dustin-cook-aka-diesel-
aka-gremlin-i-fucked-you-over-with-your-bank-account>
Steve Carroll the Narcissistic Bigot

Stephen - fretwizen 4005

unread,
Sep 28, 2021, 10:58:53 AM9/28/21
to
On Monday, September 27, 2021 at 11:53:19 AM UTC-7, Scott Lurndal wrote:
What is the Earth coming to when a Just Wondering troll can not get any
responses? Time to blame the Russians! Michael Glasser Snit teased Just
Wondering as much as he deserves, big fricking deal. No need to be a wailing
asshole about it?

Once Michael Glasser Snit understood how effective Just Wondering is at
playing 'injured party' he sees this isn't as unbelievable as it sounded.

--
E-commerce Simplified!
https://swisscows.com/web?query=dustin%20cook%20%22functionally%20illiterate%20fraud%22
https://www.youtube.com/watch?v=u4xD43Khhkw
0 new messages