[HTC EVO 3D] vboyz103:
So I have been reading quite a few threads here on XDA, and the one thing I noticed for noobs to linux/unix world is that they are struggling with some basic command once adb shell is gained. I decided to whip out this quick tutorial to help those noobs out to become more of an expert...like me...lol j/k

Here we go:

Prerequisites:

You must know how to invoke a adb shell command already to drop into your phone.

ALL commands in Unix/Linux are case sensitive

For more details, go to this ADB tutorial (very good one): http://xdaforums.com/showthread.php?t=517874

Let's get going:

Once a shell is gained via adb, let's look at some of the basic commands you can do to navigate around the filesystem. Note: you must remove the double-quotes (") for the actual command.

"cd" = is change directory

to change to any directory, you type: cd dir_name (where dir_name is a full path)

Example: I want to go to /data/local/tmp in my phone, I would do

cd /data/local/tmp <hit ENTER>

You can also use the ".." to go UP one directory.

Example: I'm in /data/local/tmp and I want to go up to /data folder, a command would be: cd ../.. alternatively, if I do cd .. then i'll drop into /data/local folder instead.

"ls" = list files/directories

to list files/directories within a folder, the command should be:

ls <hit enter> => this will list all NON-HIDDEN file/directories within your CURRENT directory.

ls /data/local/tmp => this will list all NON-HIDDEN file/directories within /data/local/tmp directory.

ls -l => this will list all NON-HIDDEN file/directories within your CURRENT directory, plus additional details. Consider this is like a "Details" view in Windows Explorer.

ls -a => this will list all files/directories (including hidden files) within your CURRENT directory.

ls -la => this will list all files/directories (including hidden files) within your CURRENT directory, plus details.

"chmod" = change mode

Goes to wikipedia for more details: https://secure.wikimedia.org/wikipedia/en/wiki/Chmod

Most commonly used modes on android phones are:

"755" or "777".

So if you have a root.sh shell script that you downloaded from XDA, and uploaded to your phone and try to execute it with ./root.sh and it said "Permission denied". That means your script does not have the execute permission. You need to do:

chmod 755 root.sh <hit enter>

[B]IMPORTANT: There is *NO* negative sign (-) in front of the mode bit. So it is NOT chmod -755 root.sh[/B]

If you get a "File or directory not found" error, which means you are chmod-ing a file that doesn't exist in your current directory. To execute a chmod on root.sh in /data/local/tmp you do:

chmod 755 /data/local/tmp/root.sh

If you want to chmod an ENTIRE DIRECTORY and ALL files underneath it you do:

chmod -R 755 /data/local/tmp => this will set /data/local/tmp and ALL files/folders underneath it to be 755.

"chown" = change ownership

Go to wikipedia for details: https://secure.wikimedia.org/wikipedia/en/wiki/Chown

Most common used chown for android is: "root:root" or "root:shell"

Example: if you want to change ownership of root.sh to root:shell then you do:

chown root:shell root.sh

NOTE: the -R (recursive) option is also available for chown.

chown -R root:shell /data/local/tmp

"pwd" = print working directory

so when you are within a directory and you want to know which directory you are in, then you issue the command:

pwd <hit enter>

The system will reply back with the currently directory you are in.

I'll try to add more if I think of anything else useful, or if you have suggestions, please feel free to add.