busybox & Windows command prompt & colors & ls - Android Software Development

ok... so, I've loaded my custom ROM and it contains busybox... I do like the extra functions that busybox offers over the stock Android "toolbox", so I don't really want to disable the commands like ls... I'd just like to turn the colors off.
Here's what I've found in my researches...
1) I can always
Code:
ls --color=never
but that is a lot of extra typing that I'm just not willing to do.
2) I can now SSH into my phone with putty and the colors are nice... but if I'm doing this over the cell modem (even EVDO), it's not too responsive (probably has some to do with currently running applications, syncs, and so forth)
3) I can use Droid Explorer and open a command shell from there, and the colors are nice... but Droid Explorer takes a lot longer to load than adb shell and the nice thing about being at my command prompt is if I need to push, pull, or remount (I understand I can always manually remount,rw and remount,ro from any shell, but adb makes it really easy to do with less typing) quickly... I can exit out of the shell, do the command, and go right back into the shell.
4) I can use Better Terminal Emulator on the phone... again... colors nice (I think you're seeing a theme here) but the typing is excruciating for long commands, and God forbid you make 1 typo... for quick things it's cool and to do a command while not at my computer, it's great.
5) If I were running Windows 95 (or maybe even XP), I could just use ansi.sys and do it. However, I've found that the only way ansi.sys works in a command prompt is to use COMMAND.COM and not CMD... plus you have to set CONFIG.NT to "dosonly" mode and include the driver in there... the biggest problem with all that is that adb will NOT run in DOS only mode. I even tried to adb shell from within a Cygwin command prompt (that already has colors enabled) but all the ansi color codes were lost.
So.... Here's my dilemma... I want colors when I'm not coming in through the Windows command prompt and adb shell. However, I want to disable the colors when I'm coming in through adb shell. I would probably settle for a different way to shell in from Windows 7 than the ones listed above.
I think I remember from my freshman year of college when they tried to teach me Unix, that you can set "default" command line switches for applications. For example, if you always wanted ls to do -l, then someplace you could set that as a default. I read on another post (possibly another forum) that somebody suggested editing .profile to do an alias of a command... something like
Code:
alias dir='ls --color=never'
but the problem with that is there's no .profile and there's no home directory for root or shell.
I even read that the standard ls uses an environment variable LS_OPTIONS, but I don't think that the stock Android ls uses it, and I can't get busybox to use it - plus, it'd be a pain to type that in every time I do an adb shell.
Does anybody have any suggestions or tips or any way to do this? If the alias will work, I'd be happy with that. I could then set dir to no color and keep ls with color. I could maybe even remap a command to do a ls -l all the time.
Thanks in advance.

This was what I ended up doing under Windows 7: http://softkube.com/blog/ansi-command-line-colors-under-windows/

This works for me:
Code:
export LS_COLORS=none
ls

Related

what are the shell and terminal emulator apps capable of

i understand that both these apps allow you to access the underlying linux distros shell. however is that shell a complete bash shell or somthing smaller. if it were a complete bash shell would you not be able to run text based apps like vi and mplayer.
It isn't a full bash shell, you're limited to:
a) commands the phone has (even cp is missing ffs).
b) commands the application has access to.
Wow that sucks. But thanks for the bad news.
No, some commands are completely missing (eg, cp really *isn't* there).
If you have root access on your phone, with an "su" command, these apps can get access to everything. But it's really kinda useless, using adb shell is much better.
terminal emulator
how to open apps through terminal emulator?
and how to control whole android phone by terminal emulator?

adb command

can anyone tell me what the ADB shell command is for going up one directory. I can use "cd" to enter a directory, but always have to exit because cd.. doesn't work like in windows. Also tried cd home, to no effect.
Thanks,
Will
Code:
cd ..
Notice the space. Windows forgives leaving it out, Linux doesn't.
oh...you are the bomb. I was getting so tired of having to exit just to go up one directory.
Thank you.
Will
No problem. Another quick tip, cd / takes you all the way to the root of your file system. Just in case you get lost somewhere
pwd shows you where you are as well.

[GUIDE] ADB Workshop and Guide for everyone

This workshop was held in #android-learning on irc.freenode.net by XDA Member Adrynalyne. All credit to him for this guide, I simply am taking it and turning it into a guide. Here we go!
You can find the raw IRC log here
Good evening folks, and welcome to my ADB workshop. This is by no means a full explanation on the subject, but more of a crash course to help folks get up to speed, and get more from their devices. There may be some things you already know here, so please be patient and respect those who do not.
Reference Files
http://adrynalyne.us/files/How to install adb.pdf
http://adrynalyne.us/files/Using ADB.pdf
So, lets just start with the basics.
What is ADB?
ADB stands for the android debugging bridge and is used for testing and debugging purposes by developers.
However, we like to get more out of our devices, and its a great way to fix things.
Knowing adb can mean the difference between a paperweight and a working phone.
So, to start with, we will look at installing ADB.
Generally speaking, the Sun/Oracle JDK is required to run all SDK functions.
ADB is but one tool in the SDK arsenal.
So, we begin by downloading and installing the JDK. This can be found here:
https://cds.sun.com/is-bin/[email protected]_Developer
Choose your OS, download and install. I recommend that 64 bit users use the regular x86/32 bit version as well.
Moving ahead, we download the Windows sdk from here:
http://dl.google.com/android/installer_r08-windows.exe
Due to already installing JDK, you won't be stopped by the install process.
Now, if you notice, I installed it to:
C:\android-sdk-windows
I did this because it makes things easier when setting up path variables.
I encourage everyone to do the same, but obviously it is not required.
So, this SDK is handy, but is only good up to 2.2. We want the latest and greatest! (Well I do)
So, we navigate to:
C:\android-sdk-windows\
and we run SDK Manager.exe
If you notice in your PDF file for installing adb, you will notice that you can update, and I made a choice not to include earlier sdk versions.
I won't go into full detail on that, but depending on the version of SDK you have, 8 or 9, it WILL make a difference in using adb.
By default, for version 8 adb.exe resides in C:\android-sdk-windows\tools
By default, for version 9 adb.exe resides in C:\android-sdk-windows\platform-tools
We will assume version 9 in this guide
Really, the SDK is installed and adb is usable right now, but in my humble opinion, its not enough
I like the ability to use adb in ANY directory on my machine.
To do this, we edit Windows's environment variables.
Specifically, the system path.
To do this, we click on start, or the orb (depending on OS), and right click on Computer, left clicking on properties in the menu.
If its windows XP, I believe it brings you into advanced system properties immediatly. Vista and 7 need a second step.
On the left hand side, as you notice I have highlighted in the pdf, left click advanced system settings.
Under advanced tab, we left click environment variables...
There are two boxes here.
We are concerned with system variables, however.
So we scroll down the list and highlight path and click edit.
Ignoring all the extra stuff in here, make sure you are at the end of the line, and type
Code:
;C:\android-sdk-windows\platform-tools
The semicolon allows us to separate it
from the previous path statement.
Click ok all the way out.
We now have ADB setup globally. We can use cmd.exe (I use powershell) and no matter what directory we are in, adb is recognized.
If it is not, make certain you entered the path into system variables, and made no typos.
If you installed to a different location, you will need to adjust the path accordingly.
This concludes the section on installing the Android SDK to use ADB.
This next section will be on using ADB, so please open that pdf now.
Now, this applies to any OS, not just Windows.
Well, with the exception of the USB drivers.
I will not go too much into that, but if you take a look at the PDF, it goes through installing usb drivers for the sdk, and how to download them.
Fiarly straightforward, in that rspect.
Now, to setup our phones to use with the SDK and ADB, we must change some settings.
First, we go to menu softkey, then settings.
We scroll down to Applications and tap it.
Under Development, we will check Enable USB Debugging. Please note the SGS phones are different in this respect.
The USB cable must be unplugged before enabling or disabling this setting.
Once this is done, we are now ready to play with adb
One quick note: If you get device not found/conencted, please reboot your phone. DJ05 has a quirk in it where ADBD randomly crashes on boot.
A reboot will fix this
ADBD= ADB Daemon
Ok, continuing on.
Lets look at installing applications. This is also known as sideloading.
Unlike installing from the SD card, it does not require unknown sources to be enabled.
The command for this is
Code:
adb install packagename
This assumes that you are working from the directory where the file is located.
This will install the application to /data/app.
It will also show sometimes useful errors if install fails.
That is not something you will see from the Android GUI.
Now, a lot of us have probably deleted files with apps like Root Explorer. While this isn't really a bad thing, it leaves behind databases and data for the application removed.
This is where the 0kb applicaiton entries come from.
If you take that application entry name, you can uninstall the extra data via adb.
First we go to the adb shell which logs into the phone.
Code:
adb shell
If we end up with a $, we will want admin rights, in many cases. This is not one of them, I don't beleive.
To get admin rights, you want to type
Code:
su
Look at your phone if this is the first time, it may prompt you to allow access. Else you will get permission denied.
If you are not rooted, this will not work either.
Ok, now that we are logged in, we will type
Code:
pm uninstall packagename
where packagename is the name of the 0kb listing.
Now this seems like a pain in the a** and I agree.
HOWEVER
There will be a time where Manage applications crashes when you try to uninstall it from the phone. In this case, a factory reset, or this method is the only effective way to fix the problem.
Moving on.
How many of us have removed system applications or renamed them? Did you know that you can simply disable them from the system?
Code:
adb shell
su
pm disable appllicationname
This will disable it, and the system will ignore it.
This can be seen as safer than deleting or renaming things, but your mileage may vary.
On the other hand, you can also re-enable these applications.
Code:
adb shell
su
pm enable applicationname
Please note: Not all applications will properly re-enable. I believe a factory reset or reinstall of said application will fix the issue.
Also, application names are absolutely case sensitive.
*nix based Operating Systems see the letter 'a' and 'A' as two different things.
when you log into adb shell, you are playing by android rules
Ok, a lot of us tweak and mod our phones and turning off the device to get to clockwork recovery, or battery pulls, or multiple button holds to get into Download mode are troublesome and annoying at best.
ADB can help us here.
Here, we do not need to be logged into the shell
If we want to merely reboot the phone:
Code:
adb reboot
If we want to go to recovery (works well with voodoo5)
Code:
adb reboot recovery
If we want to go to Download Mode because we need Odin, heaven forbid:
Code:
adb reboot download
Its instant. No waiting on animations or anything else.
Its also handy if Android has locked up, but yet still works in adb.
I for one hate taking my case off to battery pull.
So now we move on to pushing and pulling files.
Sometimes, I don't feel like mounting my sd card to copy a file over to my phone.
I can use this command to push a file straight to my sd card:
Code:
adb push filename /pathtodirectoryonphone
So for instance, if I have test.txt that I want to send, I would type:
Code:
adb push test.txt /sdcard/
and there it goes.
Ok moving on
Pushing files can be done to any directory, however, some are protected.
For instance, /system is going to give you a permission denied or a read only filesystem error.
To get around this, the easiest thing to do is push the file to your sdcard, then log into the shell:
Code:
adb shell
Code:
su
We will then mount the system as writable
Code:
mount -o rw,remount /dev/block/stl9 /system
Then we can use something like
Code:
cp /sdcard/test.txt /system/app/test.txt
cp stands for copy
and it requires the path of the file and destination path. The name of the file is optional
When you copy it, you can rename it to whatever you like.
For instance, if we wanted to backup a file
Code:
cp /sdcard/test.txt /sdcard/backuptest.txt
Now, lets assume you do not have busybox installed.
You non rooted users will not.
Then you must use a slightly more complicated command called dd
This is used like this:
Code:
dd if=/sdcard/test.txt of=/system/app/test.txt
if is for inputfile
of= output file
Not every user friendly, but probably one of the safer copy commands.
Ok, moving on to pulling files.
Lets say you want to get a file from your phone, to modify, backup, etc.
To do this, we simply use adb in this manner:
Code:
adb pull /pathtofile/filename destinationname
For instance, if I wanted to backup ADW launcher in system/app
I would do this
Code:
adb pull /system/app/ADWLaucnher.apk ADWLauncher.apk
And it will pull the file from the phone and put it in the current directory.
Like above, you can specifcy where it goes.
pushing files to the sdcard, it seems prudent to talk about changing permissions.
sdcards are typically fat32, which destroys permisisons, and Android is heavily permission based.
So if you push an application to your sd card, then try to copy it to /system/app/ bad things are going to happen, or the app may not even show up.
So in that case, we use something called chmod.
This is used in this manner
Code:
adb shell
su
chmod 755 /pathtoapplication/applicationname
Keep in mind
you dont want to do this while its still on your sd card.
an example
Code:
adb shell
su
chmod 755 /system/app/ADWLauncher.apk
755 is good for applications and script files.
Just a couple more topics to cover.
Lets go over deleting files.
This becomes especially handy for removing rogue applications.
To do this, we must be in the adb shell.
Code:
adb shell
su
rm /system/app/ADWLauncher.apk
You may need to remount system as writable with:
Code:
mount -o rw,remount /dev/block/stl9 /system
That applies when using chmod as well.
So what I did above was delete ADW Launcher from system/app
However, what if I wanted to delete the entire contents of a directory?
Same thing as before, except
Code:
adb shell
rm -f /data/dalvik-cache/*.*
I just cleared my dalvik-cache with that command
very quick, very effective.
If you just tried that, please reboot your phone now
Ok....this leaves us with the final topic: logcat
logcat allows us to log what the OS is doing, and possibly delve information for when things are not working
its quite simple Reading it is another.
To use logcat
Code:
adb shell
logcat
To logcat to a certain file do
Code:
adb shell
logcat > /sdcard/logcat.txt
Now we let the log settle down to a reasonable amount of data coming in and not a wall of scrolling, then start the app in question. When it gives an error, we hit ctrl-C and kill the adb shell session.
This should have captured enough data to see the error. Now, I prepared an example. A user came to me on IRC, and Google Maps was force closing. Clearing data didnt fix it, Clearing dalvik-cache, and fix permissions did not fix it. In this case, the user did not know how to use adb So I had him grab an app called alogcat from the market and email me the log. This is also a very valid method.
this file explains what the problem was, and highlights what to look for as an example.
http://adrynalyne.us/files/logcat.pdf
___________________________________________________________________
This concludes the guide from Adrynalyne, there will be more workshops such as this one in irc.freenode.net #android-learning.
Thanks to everyone in #samsung-fascinate !
Reserved for possible extension of topic
Great, saves a lot of questions/answers & search
Every new user should read this!!
Thread stuck as valuable reference thread
Just to add, if I may, a little about the permissions...
============================================================
File permissions for Unix... which Android is based, just so those who tinker with the file permissions may know what they are getting into.
============================================================
Use the chmod command to set file permissions.
The chmod command uses a three-digit code as an argument.
The three digits of the chmod code set permissions for these groups in this order:
1.Owner (you)
2.Group (a group of other users that you set up)
3.World (anyone else browsing around on the file system)
Each digit of this code sets permissions for one of these groups as follows. Read is 4. Write is 2. Execute is 1.
The sums of these numbers give combinations of these permissions:
0 = no permissions whatsoever; this person cannot read, write, or execute the file
1 = execute only
2 = write only
3 = write and execute (1+2)
4 = read only
5 = read and execute (4+1)
6 = read and write (4+2)
7 = read and write and execute (4+2+1)
Chmod commands on file apple.txt (use wildcards to include more files)
Command Purpose
chmod 700 apple.txt Only you can read, write to, or execute apple.txt
chmod 777 apple.txt Everybody can read, write to, or execute apple.txt
chmod 744 apple.txt Only you can read, write to, or execute apple.txt Everybody can read apple.txt;
chmod 444 apple.txt You can only read apple.txt, as everyone else.
Detecting File Permissions
You can use the ls command with the -l option to show the file permissions set. For example, for apple.txt, I can do this:
$ ls -l apple.txt
-rwxr--r-- 1 december december 81 Feb 12 12:45 apple.txt
$
The sequence -rwxr--r-- tells the permissions set for the file apple.txt. The first - tells that apple.txt is a file. The next three letters, rwx, show that the owner has read, write, and execute permissions. Then the next three symbols, r--, show that the group permissions are read only. The final three symbols, r--, show that the world permissions are read only.
Compliments and full credit from:
http://www.december.com/unix/ref/chmod.html
Amazing thread just what I needed lol thanks!
cooolone2 said:
Just to add, if I may, a little about the permissions...
============================================================
File permissions for Unix... which Android is based, just so those who tinker with the file permissions may know what they are getting into.
============================================================
Use the chmod command to set file permissions.
The chmod command uses a three-digit code as an argument.
The three digits of the chmod code set permissions for these groups in this order:
1.Owner (you)
2.Group (a group of other users that you set up)
3.World (anyone else browsing around on the file system)
Each digit of this code sets permissions for one of these groups as follows. Read is 4. Write is 2. Execute is 1.
The sums of these numbers give combinations of these permissions:
0 = no permissions whatsoever; this person cannot read, write, or execute the file
1 = execute only
2 = write only
3 = write and execute (1+2)
4 = read only
5 = read and execute (4+1)
6 = read and write (4+2)
7 = read and write and execute (4+2+1)
Chmod commands on file apple.txt (use wildcards to include more files)
Command Purpose
chmod 700 apple.txt Only you can read, write to, or execute apple.txt
chmod 777 apple.txt Everybody can read, write to, or execute apple.txt
chmod 744 apple.txt Only you can read, write to, or execute apple.txt Everybody can read apple.txt;
chmod 444 apple.txt You can only read apple.txt, as everyone else.
Detecting File Permissions
You can use the ls command with the -l option to show the file permissions set. For example, for apple.txt, I can do this:
$ ls -l apple.txt
-rwxr--r-- 1 december december 81 Feb 12 12:45 apple.txt
$
The sequence -rwxr--r-- tells the permissions set for the file apple.txt. The first - tells that apple.txt is a file. The next three letters, rwx, show that the owner has read, write, and execute permissions. Then the next three symbols, r--, show that the group permissions are read only. The final three symbols, r--, show that the world permissions are read only.
Compliments and full credit from:
http://www.december.com/unix/ref/chmod.html
Click to expand...
Click to collapse
Thanks! Added
ih4ckback said:
Amazing thread just what I needed lol thanks!
Click to expand...
Click to collapse
Thanks, all goes to Adrynalyne
Thanks for the guide. Helped me pick out the stupid stupid mistakes I was making...so just a problem. I'm able to use fastboot easily but I seem to be unable to use ADB still on my windows 7. It says there are no devices and I'm dang well sure I have USB debugging on. Is it because Windows 7 is missing drivers for the nexus one or something else?
wonderful guide. I would like to add it to the guides thread.
Really awesome work, thumbs up.
But we should also take a guide on installing adb with Ubuntu/Linux, which isn't a very difficult thing...
mm7490 said:
Really awesome work, thumbs up.
But we should also take a guide on installing adb with Ubuntu/Linux, which isn't a very difficult thing...
Click to expand...
Click to collapse
If I got time tomorrow I could do that. I work primarily in Linux also
Sent from my Samsung Fascinate using Tapatalk Pro
This is good but I have a problem, when I try to remove an .apk file from /system/app it fails and says 'rm failed, Directory not empty'
I have followed exact instructions many time but never succeeded :s any help!!
(I am runnging these commands in device mod)
when I am in recovery mod I get this prompt ~ # and I am not able to enter su mod. how to get rid of this??
Well when the $ changes to # it means you have SU access
mustafa.aziz said:
This is good but I have a problem, when I try to remove an .apk file from /system/app it fails and says 'rm failed, Directory not empty'
Click to expand...
Click to collapse
Please give us the exact command(s) you entered
Here are the commands I entered after adb shell;
su
mount -o rw,remount /dev/block/stl9 /system
rm /system/app/mytouchmusic-signed.apk
exact message returned is 'rm failed for mytouchmusic-signed.apk, Directory not empty'
mustafa.aziz said:
Here are the commands I entered after adb shell;
su
mount -o rw,remount /dev/block/stl9 /system
rm /system/app/mytouchmusic-signed.apk
exact message returned is 'rm failed for mytouchmusic-signed.apk, Directory not empty'
Click to expand...
Click to collapse
Ok i think you need to do a recursive force delete which should be rf but i am not too sure! could somebody please confirm/ correct this?
Well, I don't think so ^^ As he doesn't want to erase a whole directory, but only a file.
What surprises me the most is the returned message... You're trying to delete an apk, and it says it's a directory :/
Could you please give us the output of this :
Code:
su
mount -o rw,remount /dev/block/stl9 /system
ls -l /system/app/mytouch*
Perhaps you don't even need the su and mount lines, but I'm not sure about that, and that can't harm your system ^^
Khoral said:
Well, I don't think so ^^ As he doesn't want to erase a whole directory, but only a file.
Click to expand...
Click to collapse
I know he doesn't want to delete a whole directory, but since the apk isn't compressed perhaps android looks at is as a directory and not a file? i don't know since what was returned suggested that it was a directory i presumed it was a directory! :S
mustafa.aziz said:
Here are the commands I entered after adb shell;
su
mount -o rw,remount /dev/block/stl9 /system
rm /system/app/mytouchmusic-signed.apk
exact message returned is 'rm failed for mytouchmusic-signed.apk, Directory not empty'
Click to expand...
Click to collapse
rm -rf /blah/blah
here is your desired output:
sh-3.2# su
su
sh-3.2# mount -o rw,remount /dev/block/stl9 /system
mount -o rw,remount /dev/block/stl9 /system
sh-3.2# ls -l /system/app/mytouch*
ls -l /system/app/mytouch*
-rw-r--r-- root root 299838 2008-08-01 18:00 mytouchmusic-signed.apk
sh-3.2#

[Help] ADB for the Epic

Ok. I had the android sdk installed before and was able to easily "adb shell" "su"
but a few months ago my phone stopped being recognized by the pc (stock cable) so i uninstalled it since i couldnt use adb nor odin (i thought it was my phone though)
but now i got a BB cable and the drivers all installed wonderfully and there was no headaches so now i believe the hype with getting a new usb cable because the stock one sucks.
So i followed the "Setting up Android SDK for beginners" by bthomas and i ollowed it to a t because i couldnt remember how to set up the sdk, and after setting it up, when i type in adb shell, it gives me a "~#" (which never happened before) and then when i type "su" it gives me a "sh-3.2#"
Im not sure what couldve went wrong except for the fact that before i would install everything (1.5sdk, 1.6, etc.etc) because i didnt know any better, but the guide showed me that all we needed to get adb to wrok was the platform tools one, but its not working.
I need advice because i dont wanna mess up anything in my phone since ive never seen those prompts
TL;DR
ADB gives me a "~#" when i adb shell, and i dont know why
Also, im running urban regeneration with genocide 2.0
The '~' means you are in your home directory. The '#' means you already have root so the 'su' command is not necessary. Sounds like your rom has a non-stock shell installed and is kernel rooted?
machx0r said:
The '~' means you are in your home directory. The '#' means you already have root so the 'su' command is not necessary. Sounds like your rom has a non-stock shell installed and is kernel rooted?
Click to expand...
Click to collapse
but i cd to the sdk directory (Cd:/ android/sdk/platform-tools) so idk why it would think im still in the home directory (that would be cd: users/etc, right?)
and yes the kerna is rooted. its Genocide v2.0 and im undervolted.
im also ext4 if that makes a difference...as for the rom idk its Urban Regeneration
im such a noob now i never had problems before i was forced to stop using my phone with my pc
A_Flying_Fox said:
but i cd to the sdk directory (Cd:/ android/sdk/platform-tools) so idk why it would think im still in the home directory (that would be cd: users/etc, right?)
and yes the kerna is rooted. its Genocide v2.0 and im undervolted.
im also ext4 if that makes a difference...as for the rom idk its Urban Regeneration
im such a noob now i never had problems before i was forced to stop using my phone with my pc
Click to expand...
Click to collapse
After you 'adb shell' it's showing you the filesystem on the phone, not your computer. I assume the the cd platform-tools command you are mentioning is what you are doing in a Windows command prompt to get to where your adb.exe is located.
Edit: Do this, it's safe, 'pwd' shows your current directory (in Linux/Android)
adb shell
pwd
cd /
pwd
Chances are it will show your home directory and then /
http://en.wikipedia.org/wiki/Pwd
machx0r said:
After you 'adb shell' it's showing you the filesystem on the phone, not your computer. I assume the the cd platform-tools command you are mentioning is what you are doing in a Windows command prompt to get to where your adb.exe is located.
Edit: Do this, it's safe, 'pwd' shows your current directory (in Linux/Android)
adb shell
pwd
cd /
pwd
Chances are it will show your home directory and then /
http://en.wikipedia.org/wiki/Pwd
Click to expand...
Click to collapse
yeah adb.exe is in platformtools
but anyways, this is what happened
adb shell
~# pwd
pwd
~ # cd /
cd /
~ # pwd
pwd
/
and then i exited lol
could it be a problem with my computer? like the place i saved it or something?
A_Flying_Fox said:
could it be a problem with my computer? like the place i saved it or something?
Click to expand...
Click to collapse
I don't think you have a problem it's just different than what you remember. Probably because of a difference in your mod. The prompt itself can be modified with environment variables (it's the PS# variables, you can look with 'set') so I wouldn't worry about that. My pwd output on stock looked very similar to what you pasted.
My PS# variables on stock:
# set
set
.
.
.
PS1='# '
PS2='> '
PS4='+ '
machx0r said:
I don't think you have a problem it's just different than what you remember. Probably because of a difference in your mod. The prompt itself can be modified with environment variables (it's the PS# variables, you can look with 'set') so I wouldn't worry about that. My pwd output on stock looked very similar to what you pasted.
My PS# variables on stock:
# set
set
.
.
.
PS1='# '
PS2='> '
PS4='+ '
Click to expand...
Click to collapse
i typed that in and i got a whole list of things and under them PS1='\w \$ '
PS2='> '
PS4='+ '
PWD=' '
TMPDIR= '/data/local/tmp
how would i get it back to #? Im willing to go back to stock odin if i have to, but im getting more intrigued by this as you help...
A_Flying_Fox said:
i typed that in and i got a whole list of things and under them PS1='\w \$ '
PS2='> '
PS4='+ '
PWD=' '
TMPDIR= '/data/local/tmp
how would i get it back to #? Im willing to go back to stock odin if i have to, but im getting more intrigued by this as you help...
Click to expand...
Click to collapse
Ok so you can see how your PS1 environment variable is different than mine. Depending on the shell you are using it might support escape characters such as \w which should display the current directory and \$ which should show # if you are root or $ if not. Here's some non-Android specific info on the subject http://www.cyberciti.biz/tips/howto-linux-unix-bash-shell-setup-prompt.html (stop at the colors part, no clue about which if any character are supported in the stock android shell, just using to give the basic idea)
To temporarily change the command prompt you could do:
PS1="# "
But most likely your shell has a settings file that sets the default prompt when you login. Unfortunately I do not know where this is located. Going back to stock would certainly undo any custom shells or settings your current rom has set if you don't like it.
i think that directory might be sbin/sh. because it calls to it whenever i enter something like ADB REBOOT it says sbin/sh.: adb not found
but when i type in adb shell
and then reboot recovery, etc it works
i dont think i need to go to stock, i just need to not type certain things before commands i guess...
but thanks alot! youve enlightened me quite a bit hahah i wish i had more thanks to give

self-contained sideloading, adb stupid tricks version. no PC required.

(as dhayman11 pointed out, "unknown sources" is in security settings, not developer options. but no luck anyway, like most of the settings app, it also crashes if you try to set it.)
instead, here is an extremely stupid idea that just came to me.
1. turn on adb wifi debugging
2. sideload your favorite terminal, e.g.
http://jackpal.github.com/Android-Terminal-Emulator/downloads/Term.apk
(ok I lied. you will need your desktop/laptop/phone/whatever, exactly 1 time. step 2 will be skipped forever after that 1 time.)
3. fire up said terminal from the settings->applications menu.
4. (LOL!)
$ adb devices
4a. if the above command shows no devices,
$ adb connect localhost
and proceed to step 5.
4b. if the command shows exactly 1 device, e.g. "emulator-5554", proceed to step 5.
4c. if the command shows more than 1 device (wtf?!) then you will need to specify a device of your choice ("-s somedevice") in every subsequent adb command, e.g.
$ adb -s emulator-5554 <whatever>
$ adb -s localhost:5555 <whatever>
etc.
5. e.g.
$ adb install /sdcard/Download/foobar.apk
$ adb shell
$ adb uninstall -k com.something.somethingelse
etc. etc.
6. profit? profit!
ok here is a slightly-less incoherent form of the senior-moment-reply I posted earlier
several days ago it occurred to me to alternatively use sshd for terminal access, because:
-a) I feel a little unsafe leaving adb wifi enabled all the time (ok it's only a small thing to turn it on and off, but still) - and for security reasons there is no way to enable/disable it programmatically e.g. from a script/shell/terminal/app (well theoretically this is not exactly true, but practically it is)
-2) some people (i.e. me) would like to do shell/terminal remotely sometimes, rather than on the AFTV (and other people don't have/want a keyboard)
ssh access makes a great alternative to Term.apk, but the problem is:
- Term.apk and/or (pick your favorite android ssh server) don't have permission to run e.g. "pm install foo.apk" - it will fail. (btw 'pm' is a great command, take a look sometime at all the options. it shares a lot of functions as the adb command itself. 'am' is another fun command...)
- so, the hilarious workaround of enabling adb wifi, "adb connect", and then finally "adb shell" or "adb install" etc., is still required. (b/c the adb user is in the 'shell' group, among others - giving it permission to run /system/bin/pm) - oh well.
for random reference:
Code:
127|[email protected]:/ $ id
uid=2000(shell) gid=2000(shell) groups=1004(input),1007(log),1009(mount),1011(adb),1015(sdcard_rw),1028(sdcard_r),3001(net_bt_admin),3002(net_bt),3003(inet),3006(net_bw_stats)
[email protected]:/ $ exit
[email protected]:/ $ id
uid=10009(app_9) gid=10009(app_9) groups=1015(sdcard_rw),1028,3003(inet),50009(app_40009)
(also note it appears the adb shell user might possibly have 'mount' abilities, but since the /dev/block/sd* nodes permissions' are really locked up, who knows...)

Categories

Resources