Sample Header Ad - 728x90

Android Enthusiasts

Q&A for enthusiasts and power users of the Android operating system

Latest Questions

0 votes
3 answers
20740 views
Trying to delete a folder with Termux
I'm trying to delete a file Android will not let me delete it. Trying to use Termux, I can't seem to find the file. I used termux-setup-storage, and per the instructions entered: cd /storage/sdcard0/FilesAndFolders And get bash: cd: /storage/sdcard0/FilesAndFolders: No such file or directory I'm wor...
I'm trying to delete a file Android will not let me delete it. Trying to use Termux, I can't seem to find the file. I used termux-setup-storage, and per the instructions entered: cd /storage/sdcard0/FilesAndFolders And get bash: cd: /storage/sdcard0/FilesAndFolders: No such file or directory I'm working with Android 11, and I am a real novice at this. I can't figure out what file path they want. Suggestions? Even though I'm using: rm -rf [directory name] it still comes back saying the Directory is not empty. No command I try deletes this file. The file name at the end of the string has a black diamond with a question mark on it. I tried SD Maid to no avail, Termux didn't work. I'm considering a factory reset as my only option. The file is a .mp4. I tried *.MP4, but no luck. I've tried deleting the folder and the file in every way I could find. I traced the file from the tree, sometimes it tells me the file doesn't exist when I can see it in the tree. Is there any way to delete this file?
Jimmy B (11 rep)
Aug 13, 2023, 12:59 PM • Last activity: Jan 12, 2025, 07:00 PM
0 votes
0 answers
89 views
Want to purge all .nomedia files on my phone
It is a flaw in my opinion that Google Photos backup to Drive won't pick up items in folders with a .nomedia file in them. For example, WhatsApp sent images or videos. I've got a bash shell command to find and delete .nomedia files anywhere in my user-accessible part of the filesystem, of the form:...
It is a flaw in my opinion that Google Photos backup to Drive won't pick up items in folders with a .nomedia file in them. For example, WhatsApp sent images or videos. I've got a bash shell command to find and delete .nomedia files anywhere in my user-accessible part of the filesystem, of the form:
/ -name .nomedia -type f -delete
I've tried to set up a daily run job executing this command using Tasker, but I simply cannot get it to work.
smithmeister (9 rep)
Jan 7, 2025, 10:08 PM
1 votes
1 answers
205 views
Termux Running easyrsa as `sudo -u root` gives me No such file or directory
I'm trying to run a sh script (easyrsa) while being in `sudo -u root` environment. sudo -u root sh /data/data/com.termux/files/home/openvpn/easy-rsa/easyrsa3/easyrsa This gives me an error telling me that OpenSSL is not present (I assume because I'm running it in a different environment) And when I...
I'm trying to run a sh script (easyrsa) while being in sudo -u root environment. sudo -u root sh /data/data/com.termux/files/home/openvpn/easy-rsa/easyrsa3/easyrsa This gives me an error telling me that OpenSSL is not present (I assume because I'm running it in a different environment) And when I try sudo -u root /data/data/com.termux/files/home/openvpn/easy-rsa/easyrsa3/easyrsa It gives me "No such file or directory". I tried every possible combination of commands but just can't seem to get it right. The main issue is I'm trying to run easyrsa from a web dashboard for generating certificates, and this dashboard is running as sudo -u root and for some strange reason, it just can't find the files in termux home. /data/data/com.termux/files/home/openvpn/easy-rsa/easyrsa3/easyrsa is my location of the easyrsa shell file
xMidNight-. (21 rep)
Dec 18, 2024, 10:14 PM • Last activity: Dec 20, 2024, 03:38 AM
1 votes
0 answers
41 views
Files inside random directories are not readable by ls or any binary in linux
This is from my Android mobile. I am using a terminal app similar to ubuntu which is installed in my mobile. I am doing copy of my files to laptop and some are being skipped randomly. When doing `ls dir` on few directories, files are not listed though I can see those are there and accessible via fil...
This is from my Android mobile. I am using a terminal app similar to ubuntu which is installed in my mobile. I am doing copy of my files to laptop and some are being skipped randomly. When doing ls dir on few directories, files are not listed though I can see those are there and accessible via file manager. I checked the permission of the directory, all normal. Other files inside another directories are being read by ls and other binaries. All these are present in my home directory. --- For example **HDoc** is a directory inside **Download** directory inside sdcard/internal-storage. Files are there inside HDoc but not being read by ls or any other binary. Even tried with sudo though my phone is not rooted so it is not real root.
$ cd sdcard

----- Other working directory permission -----

localhost:/sdcard$ ls -l Download/ | grep -i MAG
drwxrwx--- 2 root 9997    8192 Jun 17 18:49 MAG

localhost:/sdcard$ ls -l Download/MAG/
total 0
-rw-rw---- 1 root 9997   5562037 Feb 16  2021  1.jpg
-rw-rw---- 1 root 9997   2133364 May 29  2023  2.m4a
-rw-rw---- 1 root 9997   1019910 Aug  9  2023  3.png
-rw-rw---- 1 root 9997 671989652 Sep 25  2022  4.mp4


----- Non-readable directory (have files inside)-----

localhost:/sdcard$ ls -l Download/ | grep HDoc
drwxrwx--- 2 root 9997    4096 Jul  8  2023 HDoc

localhost:/sdcard$ ls -l Download/HDoc/
total 0

localhost:/sdcard$ lsattr Download/HDoc/
localhost:/sdcard$

localhost:/sdcard$ sudo su -
root@localhost:~#
root@localhost:~# whoami
root
root@localhost:~#
root@localhost:~# ls /sdcard/Download/HDoc/
root@localhost:~#
root@localhost:~# chmod 600 /sdcard/Download/HDoc/*
chmod: cannot access '/sdcard/Download/HDoc/*': No such file or directory
root@localhost:~#
What could be the reason of not able to read the files inside some directories? Is it 000 permission on those files? And how come file manager is able to access? I already tried another terminal too, same issue.
iamsmith41 (111 rep)
Aug 18, 2024, 09:40 AM • Last activity: Aug 18, 2024, 12:14 PM
0 votes
0 answers
150 views
Can't root ADB Daemon
I have a rooted MediaTek Infinix Hot 5 (X559C). It was **Android 7.0 Nougat** before. And I don't remember correctly, but I think `adb root` was working. But after installing custom Android 8.1 Oreo XOS ROM and rooting with [Magisk][1], the ADB shell works as root correctly. I can execute C:\Users\u...
I have a rooted MediaTek Infinix Hot 5 (X559C). It was **Android 7.0 Nougat** before. And I don't remember correctly, but I think adb root was working. But after installing custom Android 8.1 Oreo XOS ROM and rooting with Magisk , the ADB shell works as root correctly. I can execute C:\Users\user> ADB Shell Infinix-X559C:/ $ su Infinix-X559C:/ # and it gives me # and no problem with that. But when I try adb push/pull, it gives me an error with permission denied. When I execute adb root, it gives me this output adbd cannot run as root in production builds I tried Adbd Insecure , but nothing changed. I also tried adb-root Magisk modules, but they run with arm64 and aarch64 only, and my phone is 32-bit armeabi-v7a, so they corrupt. Connection with PC makes my phone unreadable on PC until I remove them from Magisk Manager. And I really want to know what **production builds** is and how to patch adb daemon.
SavciSV (21 rep)
Nov 24, 2023, 07:23 PM • Last activity: Nov 25, 2023, 02:12 PM
1 votes
1 answers
291 views
How to auto switch on/off precise location automatically, programmatically for Google Maps?
Is there an `am` command line or similar that permits do turn off/on Google Maps precise location? Ideally, could be a wrapper script in shell to enable precise mode, then when quitting maps, setting back to disabled mode. Or maybe an `am` command to save settings states before/after use. Any hint p...
Is there an am command line or similar that permits do turn off/on Google Maps precise location? Ideally, could be a wrapper script in shell to enable precise mode, then when quitting maps, setting back to disabled mode. Or maybe an am command to save settings states before/after use. Any hint please? Open to alternatives way. Searched web + here with no good answer.
Gilles Quénot (735 rep)
Oct 28, 2023, 12:50 PM • Last activity: Oct 30, 2023, 12:48 AM
0 votes
1 answers
2175 views
Addon.d bash script for removing apks after nightly reflash on Android 5.1 CM12.1 not working
I'm trying to have a bash script in /system/addon.d/ that removes unwanted apks from a nightly Android 5.1 (CM12.1) install for my Galaxy Nexus phone. Each new nightly reflash will reinstall some system apps so that is why I want a script to reverse this action so I do not have to do it manually. Th...
I'm trying to have a bash script in /system/addon.d/ that removes unwanted apks from a nightly Android 5.1 (CM12.1) install for my Galaxy Nexus phone. Each new nightly reflash will reinstall some system apps so that is why I want a script to reverse this action so I do not have to do it manually. There are some backup scripts that run fine (SU, GApps) but my own script does not work. It can be found below. I placed the script in /system/addon.d/ with permissions -rwxr-xr-x (same permissions set as other scripts in addon.d). When flashing I do not see the echo and the apps are not removed. I have tried google and researched other scripts but I cannot figure out what I am doing wrong here. Help is appreciated! #!/sbin/sh # # /system/addon.d/80-autoclean.sh # . /tmp/backuptool.functions list_files() { cat <
YouKnowNothingJohn (1 rep)
Apr 3, 2016, 10:34 AM • Last activity: Feb 21, 2022, 01:06 PM
0 votes
0 answers
259 views
Create and edit a bash script in an USB connected smartphone
The question explains it all. I am using Ubuntu 20.04 LTS. I have connected an android smartphone to pc using USB. Changed directory to internal storage using: cd /run/user/*/gvfs/*/'Internal Shared Storage' And now I wanna create a bash script. Did this: touch test.sh But it says: touch: setting ti...
The question explains it all. I am using Ubuntu 20.04 LTS. I have connected an android smartphone to pc using USB. Changed directory to internal storage using: cd /run/user/*/gvfs/*/'Internal Shared Storage' And now I wanna create a bash script. Did this: touch test.sh But it says: touch: setting times of 'test.sh': Operation not supported But if I 'ls' again, I see 'test.sh' actually got created. So whatever, I do this to edit 'test.sh' using vim: vim test.sh But got this: cannot open path of the current working directory: Permission denied Doing sudo outputs the same error. Is it possible to do what I am trying to do? Android version is 8.
SuperNoob (1 rep)
Sep 15, 2021, 12:55 PM
6 votes
2 answers
28596 views
How do I open a text file from a terminal window from within the Android GUI?
I'm trying to open a text file from within a terminal window emulator -- but not so it opens in the actual terminal but more like I've just clicked on it. So my question is: What command can I use to open `/mnt/sdcard/textfile.txt` from a terminal window emulator from ROM Toolbox Lite within the And...
I'm trying to open a text file from within a terminal window emulator -- but not so it opens in the actual terminal but more like I've just clicked on it. So my question is: What command can I use to open /mnt/sdcard/textfile.txt from a terminal window emulator from ROM Toolbox Lite within the Android GUI so that it will open with any one of my text editing applications? Will I need to run su before I can run what ever command? I'd prefer not to, but the device is rooted so I can run su. I'm using Android version 4.0.4.
Richard Lalaz (61 rep)
Apr 20, 2013, 10:25 PM • Last activity: Sep 10, 2021, 02:32 AM
0 votes
0 answers
654 views
Problem in installation of PrimeOS
When I want to install PrimeOS, I see a black page with a bash like command line instead of choices for choosing. Is it normal? If it is normal, what should I do and type in the page? In all PrimeOS install guides, there is choice for choosing not a place for typing. I make USB bootable with ventoy....
When I want to install PrimeOS, I see a black page with a bash like command line instead of choices for choosing. Is it normal? If it is normal, what should I do and type in the page? In all PrimeOS install guides, there is choice for choosing not a place for typing. I make USB bootable with ventoy. My OS is LinuxMint. > Excuse me for my poor english enter image description here
Reza Hosseinzadeh (33 rep)
Jul 1, 2021, 02:48 PM • Last activity: Jul 1, 2021, 03:31 PM
13 votes
5 answers
13860 views
How to set bash as default shell?
When I adb into a device with Cyanogenmod, I'm presented with a nice bash shell, color prompt, and bashrc. I don't see a symlink from /system/xbin/bash to /system/bin/sh. How do they set the default shell to bash instead of sh? I looked through rc files, but didn't find anything. I'd like to do the...
When I adb into a device with Cyanogenmod, I'm presented with a nice bash shell, color prompt, and bashrc. I don't see a symlink from /system/xbin/bash to /system/bin/sh. How do they set the default shell to bash instead of sh? I looked through rc files, but didn't find anything. I'd like to do the same on my Android build, which isn't Cyanogenmod. **Update** After re-installing from scratch with CM7, I'm taken to sh instead of bash. Now the question is how to set bash as default.
Ravi (231 rep)
Feb 10, 2012, 12:46 AM • Last activity: Jan 4, 2021, 12:07 PM
1 votes
1 answers
238 views
Is there a workaround to use of bash via adb on LineageOS17?
I try to login in my device directly vith adb shell bash -i It kind of partially works, because I'm logged with [tag:bash], but the terminal loose completion. The error I get: $ adb shell bash -i bash: cannot set terminal process group (-1): Not a typewriter bash: no job control in this shell mydevi...
I try to login in my device directly vith adb shell bash -i It kind of partially works, because I'm logged with [tag:bash], but the terminal loose completion. The error I get: $ adb shell bash -i bash: cannot set terminal process group (-1): Not a typewriter bash: no job control in this shell mydevice / # Is there something possible to do it properly without errors ? I don't have su installed.
Gilles Qu&#233;not (735 rep)
Jan 3, 2021, 05:15 AM • Last activity: Jan 3, 2021, 04:22 PM
1 votes
2 answers
2472 views
Backup all apks from device using adb: why this loop in bash script doesn't work?
You can do `adb shell pm list packages`, and after reading through the list, do an `adb shell pm path "com.yourpackage"` to get the full path and do a simply `adb pull`. Fact is: I want to automate this. I thought about a really simple bash script: for apk in $(adb shell pm list packages | sed 's/pa...
You can do adb shell pm list packages, and after reading through the list, do an adb shell pm path "com.yourpackage" to get the full path and do a simply adb pull. Fact is: I want to automate this. I thought about a really simple bash script: for apk in $(adb shell pm list packages | sed 's/package://g' | sort); do # If you just do an echo, IT WORKS # echo $apk # But here it doesn't work adb shell pm path $apk done But that simply doesn't work. It seems that "$apk" becomes *lost* or something and nothing is shown in that snippet. I don't know if it's a subshell problem, or some peculiarity when using variables that got through an adb shell. Should I create a script apks.sh just using pm list, for and such, push it to my device, run adb shell only once and execute apks.sh?
Somebody still uses you MS-DOS (727 rep)
Mar 8, 2016, 04:30 AM • Last activity: Jan 2, 2021, 01:46 PM
3 votes
1 answers
260 views
Android execute script at logout
I would like to execute a script at logout with my GS7 android 9 (Resurrection Remix). I see that it is advised to use tasker. I guess it is possible to do that without installing a graphical application. I connect to the smartphone through adb and have a shell. Where can I write a file in the file...
I would like to execute a script at logout with my GS7 android 9 (Resurrection Remix). I see that it is advised to use tasker. I guess it is possible to do that without installing a graphical application. I connect to the smartphone through adb and have a shell. Where can I write a file in the file system with bash or python commands that will be executed at logout ? Also, how should I manage the bash or python environment in order to have it working ? Thanks for your time.
yoarch (31 rep)
Dec 18, 2020, 10:55 AM • Last activity: Dec 20, 2020, 10:22 AM
1 votes
0 answers
365 views
Getting "CANNOT LINK EXECUTABLE "inotifywait": library "libnotifytools.so" not found. " when tyring to run a script that uses the inotifywait binary
The script is here: https://github.com/Magisk-Modules-Repo/com.piyushgarg.rclone/blob/master/binary/syncd.sh The code that I do not believe is working is this: ``` while true; do if [[ ! -e ${SYNC_PENDING} ]]; then ${HOME}/inotifywait "/storage/emulated/${PROFILE}/${SYNCDIR}" -e modify,create,moved_...
The script is here: https://github.com/Magisk-Modules-Repo/com.piyushgarg.rclone/blob/master/binary/syncd.sh The code that I do not believe is working is this:
while true; do
    if [[ ! -e ${SYNC_PENDING} ]]; then
        ${HOME}/inotifywait "/storage/emulated/${PROFILE}/${SYNCDIR}" -e modify,create,moved_to,close_write -q >> /dev/null 2>&1 && touch ${SYNC_PENDING}
    fi
When I execute the inotifywait binary as a standalone, I get this message: > CANNOT LINK EXECUTABLE "inotifywait": library "libnotifytools.so" not found. Does this indicate that I am missing a library? How can I solve the issue?
ioo (11 rep)
Nov 15, 2020, 09:20 PM • Last activity: Nov 16, 2020, 02:05 AM
0 votes
0 answers
83 views
How to Create batch SYMLinks
I'm installing legacy Termux on an Android 6.0 device. I downloaded the legacy app- and the legacy packages. There is a txt file with all the symlinks that need to be created. I'm looking for a way to make all the links in one batch run. Either with bash or some other way. This is the format that th...
I'm installing legacy Termux on an Android 6.0 device. I downloaded the legacy app- and the legacy packages. There is a txt file with all the symlinks that need to be created. I'm looking for a way to make all the links in one batch run. Either with bash or some other way. This is the format that the file is in
-open←./bin/xdg-open
gawk←./bin/awk
dash←./bin/sh
xzgrep←./bin/xzfgrep
xzdiff←./bin/lzdiff
xzgrep←./bin/lzgrep
xzgrep←./bin/lzegrep
xz←./bin/unxz
xzmore←./bin/lzmore
/data/data/com.termux/files/usr/bin/bzdiff←./bin/bzcmp
/data/data/com.termux/files/usr/bin/bzmore←./bin/bzless
I searched around on the net and have only found a way to make links from one folder with many files to another folder with the same names of the files. but as you can see from the sample above I need different names and also different folders. Thank You
Sruly (1028 rep)
Aug 6, 2020, 09:56 PM • Last activity: Aug 9, 2020, 02:43 PM
8 votes
3 answers
11344 views
How to access and modify previous commands (bash history) in Termux
I use Termux on my Fairphone 2 and I want to speed up working with it. What slows me down is not having an up arrow key that I can use to access the last command in my bash history. I can do `!!` `!7` and so on, but most of the time I don't want to actually repeat the commands, I just want to do som...
I use Termux on my Fairphone 2 and I want to speed up working with it. What slows me down is not having an up arrow key that I can use to access the last command in my bash history. I can do !! !7 and so on, but most of the time I don't want to actually repeat the commands, I just want to do something similar. I know some keyboard shortcuts to work with my bash history but they require a ctrl key, which none of my keyboards have. I use - AnySoftKeyboard - Hacker's Keyboard - AOSP Keyboard None of them have up arrow or ctrl keys At the moment, I select and copy text by touching, but this is still slow. How can I access my previous commands more quickly?
Zanna (257 rep)
Oct 2, 2016, 06:52 AM • Last activity: Jul 11, 2020, 10:11 PM
1 votes
1 answers
383 views
How to keep an ODROID device connectable via adb?
I'm using an [Odroid][1] (rooted) device running Android 5.1.1 on a local network and I'd like to be able to control it via `adb`. Currently I'm running this at startup: setprop service.adb.tcp.port 5555 stop adbd start adbd This works initially, but I've noticed if works with one connection at a ti...
I'm using an Odroid (rooted) device running Android 5.1.1 on a local network and I'd like to be able to control it via adb. Currently I'm running this at startup: setprop service.adb.tcp.port 5555 stop adbd start adbd This works initially, but I've noticed if works with one connection at a time. If a connection is left open, a second connection won't work. Even though adb says I'm connected, whenever I try to run any command I get an error: > adb connect 192.168.0.33 connected to 192.168.0.33:5555 > adb shell date error: device offline What's the easiest to ensure adbd is accessible, even if a connection is left open/hanging by accident ? I'm thinking about running a script that periodically restarts adbd but having a short interval will be very frustrating as I'd need to constantly reconnect. Is there a way to check if a connection is open, but hanging ? (no data has been received in a while ?) Alternatively, would it be possible to close the previous connection if a new one is made automatically ? How would one keep an odroid connectible via adb constantly (regardless of open connections ?)
George Profenza (275 rep)
Oct 4, 2016, 09:23 PM • Last activity: Apr 11, 2020, 05:30 PM
2 votes
1 answers
904 views
Android stops/pauses execution of my background script?
# Short version: **Why is my bash script (running in the background, started via SSHD) not running every ~30 seconds when it should?** (NOTE: SSHD and the script are running as **root**!) ---------- I have a script that I start using `nohup bash script.sh &` so that it runs in the background. The sc...
# Short version: **Why is my bash script (running in the background, started via SSHD) not running every ~30 seconds when it should?** (NOTE: SSHD and the script are running as **root**!) ---------- I have a script that I start using nohup bash script.sh & so that it runs in the background. The script is supposed to check whether a specific app is connected using netstat and if not it automatically reconnects using am start and input keyevent. (This turns out to be irrelevant though). I've noticed that even though the script should check every 30 seconds (roughly of course), sometimes it takes minutes to check. I couldn't really figure out why and it seemed completely random (note that the phone's screen is off most of the time and everything is running in the background.), so I made a testscript which is what the question should focus on for simplicity: #!/bin/sh while : ; do echo "$(date +'%Y-%m-%d %H:%M:%S')" sleep 30 done That's it. Started via nohup bash script.sh & using SSHD. The script does nothing but print the current datetime and thanks to nohup writes it to a file. I left this running for a while and then wrote another script to check on the results and print the amount of seconds whenever it's above 30. Result: 134 127 115 127 88 113 116 99 110 116 54 44 70 75 62 82 94 68 429 62 81 126 144 39 467 71 62 This is from the output of a script that ran for only 4:20 hours, so quite a lot of times where execution must have been delayed, the sleep was longer than 30 seconds, or whatever is going on.... Can someone explain this? And is there a solution to this? I suspect this might have something to do with memory or power management pausing the script but really it shouldn't happen and I would like my script to run in the background and to sleep for exactly 30 seconds and not be paused or delayed. In this testrun, the highest was 467 seconds, but the highest I've seen with the main script so far was a little over **20 minutes**. This is rare, but 5-10 minutes of a delay happens a few times a day.
confetti (622 rep)
Feb 20, 2020, 04:49 PM • Last activity: Feb 21, 2020, 02:00 AM
2 votes
1 answers
1208 views
SHELL Command works fine as a standalone command, but fails when put into a shell script?
Android 8.1 PIXEL 2 with root access. I have seen this asked here once before but the only solution didn't help me at all. I am going to try and make this as simple as I can for the example. If I run the following command in terminal emulator or adb shell: am force-stop com.myapp.frustrated It will...
Android 8.1 PIXEL 2 with root access. I have seen this asked here once before but the only solution didn't help me at all. I am going to try and make this as simple as I can for the example. If I run the following command in terminal emulator or adb shell: am force-stop com.myapp.frustrated It will quit the app just fine. But when I run it in this shell script: #!/bin/sh am force-stop com.myapp.frustrated Nothing happens. It is odd to me that I can do many other commands just fine in a script, but a handful of them do not work. Any suggestions you have are much appreciated.
Jason Waltz (175 rep)
Feb 11, 2020, 11:05 PM • Last activity: Feb 11, 2020, 11:26 PM
Showing page 1 of 20 total questions