Take the 2-minute tour ×
Android Enthusiasts Stack Exchange is a question and answer site for enthusiasts and power users of the Android operating system. It's 100% free, no registration required.

I'm pretty new to Android, but I have a bit of linux understanding. Do I need to use adb and do I need to type adb before every command?

I have SSHDroid running on my GS3. I open my regular linux terminal and did ssh root@<ip>. When I got in I typed abd logcat, that failed. just logcat worked.

I'm happy with the shell I know, is this going to cause an issue?

share|improve this question
    
I tried to explain the basic commons and differences with my answer. I might have missed something -- simply point it out, and I'll add it. As a simple short answer: connecting via SSH, think of your Android device as "another Linux machine". No need to prefix anything with "adb" -- you don't do that on your Linux machine either, do you? :) –  Izzy Mar 28 '13 at 20:06
add comment

1 Answer

up vote 1 down vote accepted

The answer depends on what you want to do. ADB and SSH serve different purposes, though they have some things in common: you can remotely access your Android device, and execute commands on it. With ADB you can do a lot more -- you will get an idea if you read the ADB tag wiki and also follow the links contained there.

One more thing in common: both can be used interactively.

And one more shorty: they do not depend on each other.

SSH

To use SSH, you will need to install a SSH server on your Android device. If the latter is rooted (as a Linux user, I do not need to explain that "root" is the administrative account, and also known as the "super-user" who has full access to everything), you can set it up to use the default SSH port -- otherwise you need to chose one above 1000, as it is with Linux.

Now you can interact with the device: copy files with scp, or log in to the device directly. This way you reach a shell, and can work on the device like on any other Linux machine (almost -- of course there are some restrictions, like e.g. no X-Server being present, and a limited set of commands).

ADB

With ADB you can also establish such a "terminal mode", by simply executing the command adb shell without any arguments. This directly brings you to the shell prompt. Similar to ssh, you can also directly execute commands by simply pass them as parameters. In this case, as with ssh, you will be returned to your local terminal prompt once the command has been completed.

ADB offers additional commands, not only "shell". So you can e.g. use adb push or adb pull to transfer files (comparable to scp). All the other capabilities go beyond the scope of your question -- but above mentioned tag wiki should get you started here as well.

One last word on ADB: similar to SSH, this is a client-server model. Which means, to execute ADB commands from a client, you must have a server running. This is started when you enable "USB Debugging" in the settings of your Android device.

share|improve this answer
    
Thanks... Does ADB require a USB connection? –  wlraider70 Mar 28 '13 at 22:08
    
Usually yes (that's why the corresponding option to start the ADB server on the device is labeled "USB Debugging"). But there's also "ADB via WiFi" alias "wireless adb" (with an app of this name in the playstore) if you prefer such. I hesitated a long time to use ADB (mainly because I didn't want the overload of a full SDK), until I found out about a minimalistic approach -- now I don't want to miss it :) –  Izzy Mar 28 '13 at 22:12
    
To me this seems like the most significant difference. USB or ip. –  wlraider70 Mar 28 '13 at 22:21
    
For security: nothing beats a direct wired connection (pro for USB). For speed probably the same (depends, so neutral). For convenience, wireless get's the "pro" (and to make up with security, here I'd favor SSH). I didn't check about security for "wireless adb", as I never used that. BUT: all the mentioned examples use IP (yes, including ADB -- so your "USB or ip" doesn't fit :) –  Izzy Mar 28 '13 at 22:25
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.