Live data from Hacker News

Termux is an Android terminal emulator and Linux environment app

termux.dev

41–50 of 174 posts

Re: Termux is an Android terminal emulator and Linux environment app

#41
post #39

Earlier quoted context omitted.

I really wish Android would properly enable containers like they've done for Chrome OS. It's silly we run little Linux machines and can't pop a fully isolated container shell on them!

I think it hasn't happened because much of the sandboxing of Android is part of the Android runtime, thereby only sandboxing code compiled for the Android runtime. If you could spawn a native Linux executable (that hasn't been compiled for Android the way the Termux executables have) from an Android application, then that process can escape the application's sandbox and do stuff it shouldn't be able to do given the p…

Android 13+ includes a crosvm based virtulization setup: https://source.android.com/docs/core/virtualization

> ...then that process can escape the application's sandbox and do stuff it shouldn't be able to do given the permissions granted to the Android application.

Android's sandboxing is not limited to ART and has multiple layers [0]. Native apps cannot bypass sandboxing, I don't think.

[0] https://hernan.de/blog/tailoring-cve-2019-2215-to-achieve-ro...

Re: Termux is an Android terminal emulator and Linux environment app

#42
post #9

Termux singlehandedly makes me feel like I'm living my childhood dream of having a full computer in my pocket. I use git to blog from my phone, I have ffmpeg and yt-dlp installed to download videos for when I am going to be away from internet access for a while, and I even have some home automation scripts setup that control the lights over the local network. But I am concerned about the direction Android is headed,…

Why would I want to install termux? You basically need a keyboard to use it; at which point you might as well grab a laptop.

You do not! You can use volume down as a Ctrl key, and volume up also unlocks other keys (volume up + wasd for example gives you arrows.) It also gives you an extra row above the touch keyboard with escape, tab, and some other keys, and a text input for pasting/IME/swiping/etc.

And even if that sounds uncomfortable there's still plenty of useful things you can do with minimal typing! For example... You could run Tailscale as a normal Android app, then use SSH forwarding in Termux to get a local port that goes to a web server on another computer in your tailnet, and browse to that locally on the phone using Fennec F-Droid (Firefox). All of that works just fine. If I leave one of my computers on and I'm in bed or away from home I can ssh in and run systemctl suspend. Wayland/X server locked up? You can use your magic sysrq keys of course, OR you can ssh in with termux and kill it, which doesn't depend on magic sysrq being enabled (or remembering how to get it on your keyboard.) You could also run yt-dlp to download some video or audio content from the internet; everyone hates the Reddit video player, so why not just get the MP4 out of it? Admittedly, there's a better solution here: you can get an app called Seal on F-Droid which is a pretty good yt-dlp frontend. But, the fact that you can easily do it in Termux using their package manager is testament to just how useful Termux is.

I honestly only want one thing; an SSH Agent implementation built into the app, so I can import SSH keys and not have to enter the passphrase constantly. Not a huge deal really, but having a built-in agent would be super convenient.

Re: Termux is an Android terminal emulator and Linux environment app

#43
post #9

Termux singlehandedly makes me feel like I'm living my childhood dream of having a full computer in my pocket. I use git to blog from my phone, I have ffmpeg and yt-dlp installed to download videos for when I am going to be away from internet access for a while, and I even have some home automation scripts setup that control the lights over the local network. But I am concerned about the direction Android is headed,…

Why would I want to install termux? You basically need a keyboard to use it; at which point you might as well grab a laptop.

There is quite a difference in size there! Find me a 7 inch laptop with phone battery life and pocket availabilty.

Re: Termux is an Android terminal emulator and Linux environment app

#44

This is on the top 5 list of my favorite android apps, every time such question comes up in a forum. I complement such with what I install under it (e.g. nmap, wget, curl, dns tools, various network utilities, whois, openssh, etc.)

Would love to know what your other 4 are.

Re: Termux is an Android terminal emulator and Linux environment app

#45
Termux is great.

One of my favorite tricks is sharing a photo to it, then running a quick `python -m http.server 8000` while on wifi. It makes it dirt simple to send a photo from my phone to any local machine on my network without the hassle of cloud services (including generation loss from recompression), incompatible apps, bluetooth pairing, etc.

Re: Termux is an Android terminal emulator and Linux environment app

#46
I have used termux for to SSH to various boxen in a pinch, but I just recently realised it allows me to write and run arbitrary scripts on my phone!

I can basically do (limited -- but sufficient for my needs) Android programming without knowing a lick of Android. And I can do it on the phone itself. Crazy that I didn't realise this potential sooner.

Re: Termux is an Android terminal emulator and Linux environment app

#47
post #39

Earlier quoted context omitted.

I think it hasn't happened because much of the sandboxing of Android is part of the Android runtime, thereby only sandboxing code compiled for the Android runtime. If you could spawn a native Linux executable (that hasn't been compiled for Android the way the Termux executables have) from an Android application, then that process can escape the application's sandbox and do stuff it shouldn't be able to do given the p…

Android 13+ includes a crosvm based virtulization setup: https://source.android.com/docs/core/virtualization > ...then that process can escape the application's sandbox and do stuff it shouldn't be able to do given the permissions granted to the Android application. Android's sandboxing is not limited to ART and has multiple layers [0]. Native apps cannot bypass sandboxing, I don't think. [0] https://hernan.de/blog/t…

> Android 13+ includes a crosvm based virtulization setup

Interesting; but I feel that their choice of a hypervisor-based design here supports my point of plain container-based isolation (or even containers + gVisor) being insufficient to achieve true sandboxing on Android.

> Android's sandboxing is not limited to ART and has multiple layers [0]. Native apps cannot bypass sandboxing, I don't think.

Yes, but when I say "sandboxing", I mean just the ART sandbox, not the other layers. I don't care whether you can get root / jailbreak the device. I (and presumably Google, in not publishing apps that do this in the Play Store) care about whether an application that, upon installation, doesn't request permission to e.g. read your contacts, can actually read your contacts. There are certain capabilities like that (not sure if "reading your contacts" is one of them, but you get the idea), that are only prevented from being accessed by ART, not by Linux ACLs. This is especially true when there's one level of permission that gets you access to a certain database file through an API, but then another level of permission that gets you access to certain special records in that database file through the same API. The lower level of permission is already granting you Linux filesystem ACLs to the database file; the only difference between the two permissions comes down to what ART will allow you to request through the higher-level API.

Re: Termux is an Android terminal emulator and Linux environment app

#48

Earlier quoted context omitted.

Why would I want to install termux? You basically need a keyboard to use it; at which point you might as well grab a laptop.

There is quite a difference in size there! Find me a 7 inch laptop with phone battery life and pocket availabilty.

The closest option is probably the GPD MicroPC. It's 6", but pretty damn close to the ideal of a truly tiny PC. I think they're making a successor to this finally, dunno what the status is.

https://www.gpd.hk/gpdmicropc

Re: Termux is an Android terminal emulator and Linux environment app

#49
post #45

Termux is great. One of my favorite tricks is sharing a photo to it, then running a quick `python -m http.server 8000` while on wifi. It makes it dirt simple to send a photo from my phone to any local machine on my network without the hassle of cloud services (including generation loss from recompression), incompatible apps, bluetooth pairing, etc.

kdeconnect is great for this too!

Re: Termux is an Android terminal emulator and Linux environment app

#50
post #9

Termux singlehandedly makes me feel like I'm living my childhood dream of having a full computer in my pocket. I use git to blog from my phone, I have ffmpeg and yt-dlp installed to download videos for when I am going to be away from internet access for a while, and I even have some home automation scripts setup that control the lights over the local network. But I am concerned about the direction Android is headed,…

Why would I want to install termux? You basically need a keyboard to use it; at which point you might as well grab a laptop.

I mainly use termux for the script API (which is incredible btw). I usually write the scripts in bash or ruby on my computer and scp them over, but I also have a small keyboard that I can plug in to type directly on the phone.

Even if you don't use the CLI part of Termux often, it's still an incredibly neat piece of hackery goodness. I once needed to text about 50 people and have it be from my real phone number. Rather than hack around with Twilio or AWS, I spent 5 minutes writing a ruby script to send the texts from Termux. If you aren't familiar yet with the API, it will take a little longer than 5 mins the first time. Once I had that script, I kept finding neat usecases for it. I sometimes still just text from the CLI because it's easier than using the built-in messages app depending on what I'm doing.

You can definitely get an amazing experience on Android without Termux, but Termux is like if Android were a really nice bicycle, Termux is a small powered motor you can bolt on somewhere to automate parts of your life.

Aside: I find Termux easier to use than Tasker. I'm a CLI native old man though, so don't take this as a knock against Tasker.

Post reply on HN