7 ms·
Better adb shell
- xyzzy_plugh 2y agoI feel as though I am a dying breed, as nothing about this seems "better" than the default. The PS1 is enriched with information, sure, but I find it very distracting. I much prefer $ or #.
- alanbernstein 2y agoDo you never look at your scrollback, or a command+result pasted into a text file? I find it useful to include the context of working directory and timestamp, adjacent to the command.
- thrdbndndn 2y ago> one alias to fix the typo sl => ls. I'm wondering what others think about such feature (in general, not just in this specific case). On one hand, it won't negatively affect my personal usage in anyway, probably even beneficial; On the other hand, the "purist in me" feels very uncomfortable with this kind of features (probably to the detriment of myself). Again, this is not a complainant at all. Just find it interesting.
- jdowner 2y agoIt's not for me. I can see the appeal of these shortcuts, but I can see it being a wtf down the road once I've forgotten that I have them in place. Also with something like auto-correct, you have a visual affordance that alerts you to the change (with the option to override), which just happened when I misspelled 'forgotten' above. The shell doesn't have that so something just happens without any actual correction or indication the user may have made an error. Although I am not a 'fish' user, this is something that I think it does well.
- hyperhopper 2y agoOr, just install sl! https://www.cyberciti.biz/tips/displays-animations-when-accidentally-you-type-sl-instead-of-ls.html https://www.cyberciti.biz/tips/displays-animations-when-acci... Personally I have sl aliased to sl=sl && ls to make sure I break the habit of ever typing sl. (Though also usually I'm typing ll which I have aliased to an ls with list mode and many details)
- themoonisachees 2y agoI have a magic enter plugin that just runs 'll' when I input no command and press enter, I haven't typed ll in months!
- t8sr 2y agoThis is similar, but actually gives you additional tools and a statically compiled bash: https://github.com/wowsignal-io/android-tools https://github.com/wowsignal-io/android-tools
- farmerbb 2y agoSeems to be tailored specifically for Apple Silicon Macs, considering that it attempts to spin up an AArch64 Docker container to compile some of its tools.
- kytazo 2y agoI ended up just resorting in bash with an exec bash inside my mkshrc iirc. I switched to nushell a couple of months back and I haven't got the opportunity to rock it on android, really curious how it does. It is supposed to support android as well if I'm not mistaken.
- matan-h 2y agoI've tried it. nushell works for me only with the "-c" option, otherwise I get "Error: I/O error: Function not implemented (os error 38)". Probably the prompt function
- dzaima 2y agoOf note of course is termux, which is a proper terminal, complete with a custom apt repo. For cases where an adb shell is needed (modify external storage, slightly more permissions if not rooted) it's approximately possible to just copy necessary executables and .so files from termux to /data/local/tmp/ for adb (with some LD_LIBRARY_PATH & co setup), allowing running bash, htop, etc.
- matan-h 2y agoI use this to copy programs from termux. in termux (you need lld [pkg i lld]): mkdir /sdcard/.adb cp `which bash` /sdcard/.adb cp $(ldd `which bash`|cut -d ">" -f2) /sdcard/.adb in adb shell: cd /data/local/tmp cp /sdcard/.adb/bash cp /sdcard/.adb/*.so LD_LIBRARY_PATH=. ./bash
- deleted 2y ago[deleted]
- deleted 2y ago[deleted]
- gardnr 2y agoI prefer adb hell. https://stackoverflow.com/questions/18097790/adb-hell-command-not-a-typo https://stackoverflow.com/questions/18097790/adb-hell-comman...
- vodkapump 2y agoadb lolcat and adb longcat are also neat ones
- sva_ 2y ago$ adb hell adb: unknown command hell
- DownrightNifty 2y agoFrom one of the SO comments: https://android-review.googlesource.com/c/platform/system/core/+/180036/7/adb/commandline.cpp#b1346 https://android-review.googlesource.com/c/platform/system/co... It was removed :( Kinda funny that the commit message doesn't say anything like "remove hell mode", it's integrated into another unrelated patch
- deleted 2y ago[deleted]
- pif 2y ago"rmtree" and "untar" look too much like: #define BEGIN { When on Unix, do as Unixers do.
- dzaima 2y agoGiven that unzip and unxz exist, untar isn't that unreasonable.
- chasil 2y agoAs an aside, mksh hasn't been updated since 2020. This is not as bad as ksh93, but it is starting to look more like abandonware, implying that oksh is healthier. http://www.mirbsd.org/mksh.htm http://www.mirbsd.org/mksh.htm
- natrys 2y agoNo new release doesn't mean abandonware though, upstream last commit was 2 weeks ago.
- frusdroid 2y agoSince adb rarely comes up on Hacker News, I got only one shot to ask how other Android uses deal with the problem of freeing up disk space without rooting the device or doing a factory reset? The number of apps is not the problem. Some apps or the OS must be filling directories with inaccessible temporary files or perhaps the OS is keeping all its old updates somewhere? On a 32M device 15 megs is lost over the course of a year. All the obvious user space tooling cannot clear or access it.
- causality0 2y agoI gave into temptation and bought a device I can't root. Two years on, I'm resolved to never make that mistake again.
- j4hdufd8 2y agoIt's not physically possible to buy a device you can't root. You can however buy a device that is not easy to root.
- causality0 2y agoYou are aware Samsung encrypts the bootloader of their American devices, yes? If you have a way to decrypt Android 12+ Samsung bootloaders I know two separate people running unlock businesses who would love to pay you a lot of money.
- j4hdufd8 2y agoI wouldn't tell you because I know people that pay more than your unlock businesses.
- chasil 2y agoMaybe two options... For any unprivileged user, find the bundled apps that are unused, uninstall updates, clear their storage, then disable them. There is also a more thorough debloat method that does not require root. It seems to be in a state of flux as it is rewritten in Rust. https://gitlab.com/W1nst0n/universal-android-debloater/-/blob/master/README.md https://gitlab.com/W1nst0n/universal-android-debloater/-/blo...
- chasil 2y agoIn startup.sh, here are a few things to think about. Instead of setting RED/GREEN/BLUE, you could do this: N=$(printf \\033) N="$N[" x=30 for a in Bl R G Y B M C W # Black Red Green Yellow Blue Magenta Cyan White do eval $a='$N'"'"$(( x))"m'" \ b$a='$N'"'"$((60 + x))"m'" \ ${a}bg='$N'"'"$((10 + x))"m'" \ b${a}bg='$N'"'"$((70 + x))"m'" # bX=bright Xbg=background bXbg=brgt bgnd x=$(( x + 1 )) done # https://en.wikipedia.org/wiki/ANSI_escape_code Unless you have "set -e" this: if [ ! "$HOSTNAME" ]; then HOSTNAME="$(hostname -s)" fi Is more succinctly expressed as this: [ -z "$HOSTNAME" ] && HOSTNAME="$(hostname -s)"
- matan-h 2y agoApart from the length, what advantages does `[-z $VAR ] && VAR=x` over `if [ ! $VAR ]; then VAR=x fi` ? Btw, The color script is cool. This makes ANSI sensible.
- chasil 2y agoI don't think there are any functional or performance differences between these forms: [ -n "$var" ] || var=X [ -z "$var" ] && var=X if [ ! "$var" ]; then var=X; fi It's a question of [your] style and taste, I think. There are a lot more ANSI sequences that I could work into that block, but it is quite thorough for the space it occupies. BONUS: Here is my script to extract all of the stored WiFi networks and passwords when run as root: #!/bin/sh find /data \ -name WifiConfigStore.xml \ -print0 | xargs -0 awk ' /"SSID/ { s = 1 } /PreShared/ { p = 1 } s || p { gsub(/[<][^>]+[>]/, "") sub(/^[&]quot;/, "") sub(/[&]quot;$/, "") gsub(/[&]quot;/, "\"") gsub(/[&]amp;/, "\\&") gsub(/[&]lt;/, "<") gsub(/[&]gt;/, ">") } s { s = 0; printf "%-32.32s ", $0 } p { p = 0; print } ' | sort -f
- gizmo686 2y agoIf -e is set you can use || and invert the condition.
- retrochameleon 2y agoStill trying to find a functional tool that makes it easy to take full backups and restore them to android devices since adb deprecated the "backup" command
- TwoNineFive 2y agoI don't think such a thing exists right now. I've been looking for it. The best normie backup tool is probably Neo Backup on F-Droid, and it's buggy and lacks some important features. Titanium is dead. I've not been satisfied with any of the various closed-source paid apps on the Play Store. Any true backup is going to require rooting your phone. It's not in google's interest to allow you, the user, to access core operating system files and configuration on their device. If you don't 0wn it, you don't own it. Here's what I do. I install Magisk and the MagiskSSH module. This gives me a root ssh shell and I can rsync any file on the device, selinux context and all. The system requires some excludes for remounted/mirrored directories, and then there's other things like cache directories that I don't need to backup, so I use a rsync filter file. rsync's --link-dest makes backups very very fast and reduces disk usage. I should really do this on a filesystem that does block-level de-duplication, but I don't really need to because it's efficient enough already. Each app has to be paused/frozen during the backup to ensure data integrity. Restoring requires a bunch of hacky scripts. It's not pretty, but it works. I have to send over the apk file and use Android's native "pm install" to install it from /data/local/tmp. There's some cases where this doesn't work and I have to install the app manually from the store or wherever (APEX and other mutli-apk crap). Then my script freezes/disables the app, wipes the local data, copies the backup data, fixes the ownership, unfreezes the app, and it mostly usually sometimes works. Figuring out all the commands to do this, like getting the AIDs of apps, is some dark art shit. I've been doing this since the very beginning on a G1. Maybe some day I'll put my scripts out there and it will inspire someone to pick it up and make them easier to use, but it's never going to be a real solution. Someone just needs to make a real backup app for Android.
- tripdout 2y agoTitanium Backup has been working fine for me to backup and restore various apps. Are there features missing or problems with TB's implementation on modern Android versions?