views:

54

answers:

4

Can't find information on how to print out documentation on android shell commands while in the shell. Something along the lines of

help ls
A: 

Try this:

ls --help
Mathias Lin
This actually doesn't work as the --help option is not included in the ls source code used in Android. It will result in a "--help: No such file or directory"
Octavian Damiean
+2  A: 

The command help got stripped for most (if not all) commandline tools.

The only thing I can tell you is how to find out about the functionality of all the tools or better where you can find the sources and look at each of their code.

Here you can find the commandline tools used in Android. Git source browser: system/core/toolbox

Now looking at the code of the ls command I can tell you for example that it supports following switches.

  • -l long list
  • -s list sizes
  • -R list recursively
  • -d list directories
  • -a list all

You can try to find that information in the source code of the commands you need.

Hope it helped.

Octavian Damiean
Awesome! Thanks!
Julian
+1  A: 

The short answer is: you can't and you shouldn't need to.

Android's shell environment is purposefully very limited - it's pretty much just there to support the odd script needed for system events such as booting. If you're trying to use them in your app, you're probably doing something you shouldn't be doing. If nothing else, I strongly suspect the Android team would not consider the shell tools to be part of any published API, so would feel free to change them, including adding and removing behaviour, at any time. Also, I don't think there's much you can do with 'ls' which you can't do with Java's file handling APIs...

vmlinuz
I was actually trying to cd to the directory that holds the db for an app I'm working on. In order to figure out where to go next, I used ls. But ls didn't seem to be able to return the directory names sorted alphabetically. I wanted to find out if there was some option I could pass to ls to make that happen.
Julian
+1  A: 

My reputation isn't high enough to respond to Julian's comment directly, but if the goal is to find where the application database is, it should be in /data/data/com.app.package.name/databases

John