How to take a screenshot - Fire TV General

I tried all kinds of screen capture apps but none of them worked on the FireTV for me. So after too much research, I found this nifty terminal command.
adb shell screencap -p /sdcard/screen.png
NOTE: replace /sdcard/ with desired save location if you want and screen.png with desired image name .png)
Perfect screen captures. Hope this saves someone else some time.

The following command is what I use. It may need to be modified for windows, as I use it in OS X's terminal. The command takes a screenshot, names it with a timestamp, and saves it to the connected PC (not the Fire TV).
Code:
./adb shell screencap -p | perl -pe "s/\x0D\x0A/\x0A/g" > "~/Downloads/firetvscreenshot_$(date +%Y%m%d-%H%M%S).png"
I have the following in my Mac's .bash_profile file so that I can just enter "adbpic" and a screenshot file will appear in my downloads directory.
Code:
alias adbpic='~/adb shell screencap -p | perl -pe "s/\x0D\x0A/\x0A/g" > "/Users/YOURUSERNAME/Downloads/firetvscreenshot_$(date +%Y%m%d-%H%M%S).png"'

fireTVnews.com said:
The following command is what I use. It may need to be modified for windows, as I use it in OS X's terminal. The command takes a screenshot, names it with a timestamp, and saves it to the connected PC (not the Fire TV).
Code:
./adb shell screencap -p | perl -pe "s/\x0D\x0A/\x0A/g" > "~/Downloads/firetvscreenshot_$(date +%Y%m%d-%H%M%S).png"
I have the following in my Mac's .bash_profile file so that I can just enter "adbpic" and a screenshot file will appear in my downloads directory.
Code:
alias adbpic='~/adb shell screencap -p | perl -pe "s/\x0D\x0A/\x0A/g" > "/Users/YOURUSERNAME/Downloads/firetvscreenshot_$(date +%Y%m%d-%H%M%S).png"'
Click to expand...
Click to collapse
That's great!
You don't have to do an 'adb pull' to download the .png file and works with just '>'? Is that an adb feature or perl?
It's probably really easy to make a Windows batch file with the same purpose.

Newcron said:
That's great!
You don't have to do an 'adb pull' to download the .png file and works with just '>'? Is that an adb feature or perl?
It's probably really easy to make a Windows batch file with the same purpose.
Click to expand...
Click to collapse
'>' is shell syntax to redirect the output of a command to a file. The little perl code is there to clean up some end-of-line character conversion caused by adb shell.

Related

[Q] Using a DROID X and MAC together is tough -- can someone help?

Too many threads... too many sites and PC options.
Here's my situation:
Droid X
Used the leak update... running 2.2 now.
Use a MAC. And have Terminal app on DX.
Have SBF file for 2.1 stock, have ZIP files of rooted 2.2's
Dont have custom recovery.
Dont care much about warranty or OTA... just want to be able to apply ZIPs.
I need to somehow either root my DX with Mac or Terminal app. Or flash the SBF to bring things back to 2.1.
Not sure what to do??? Please please help.
I am not familiar with terminal commands...so if you leave instructions that would be great.
-Roman
You follow the same ADB commands, more or less. Why not try something like Universal AndRoot though? Then you could just skip over it.
But, if you need to sbf, I would *think* you follow the Linux instructions.
1) download sbf_flash & sbf file
Code:
cd directory/where/these/are/located
./sbf_flash SBFfileLOCATION
The only way to SBF is to run windows through bootcamp or this http://www.droidforums.net/forum/droid-hacks/38671-flashing-sbf-mac.html . I am in the same boat as you luckily my girlfriend has a dell running Windows. You should also be able to root 2.2 using the Droid 2 method posted in this section http://forum.xda-developers.com/showthread.php?t=766767. I assume you have the SDK downloaded already? The Linux directions does not work for Mac.
x.v_ said:
You follow the same ADB commands, more or less. Why not try something like Universal AndRoot though? Then you could just skip over it.
I TRIED THAT, BUT THERE IS SOME ERROR THAT POPS UP... CAN'T DO IT. 2.2 ISN'T SUPPORTED... I THINK IT'S JUST FOR 2.1..
But, if you need to sbf, I would *think* you follow the Linux instructions.
1) download sbf_flash & sbf file
Code:
cd directory/where/these/are/located
./sbf_flash SBFfileLOCATION
Click to expand...
Click to collapse
SO THAT EASY? JUST TWO COMMAND LINES?
So, if I put the SBF on my desktop it would be:
cd desktop (enter)
./sbf_flash fullSBFfilename.sbf (enter)
???????
romanvail said:
SO THAT EASY? JUST TWO COMMAND LINES?
So, if I put the SBF on my desktop it would be:
cd desktop (enter)
./sbf_flash fullSBFfilename.sbf (enter)
???????
Click to expand...
Click to collapse
Running ADB with Mac OSX and therefore rooting with the mac is EASY. Just make sure you have the Android SDK installed on your Mac. Make sure in your .bash_profile you have the path set to the tools directory of your SDK folder.
Since I can't tell if you have all this down, I'll give you the instructions on setting up adb on the mac (using terminal), then give you the directions I followed on rooting my Droid X from OSX (I am running 2.2 leaked).
Essentially follow these instructions (taken from tjrocks91 on droidforum... I'd link, but I am not yet allowed to post outside links on this forum):
1. Download the Android SDK for Mac OSX. (google it)
2. Extract the zip file to any destination on your Mac. *Remember its path!*
In the AndroidSDK folder, there will be a folder named “tools”. We will be adding this folder to the path on Mac OSX. For this example, extract to your home folder (the folder that contains the desktop, documents, etc. folders)
3. To do this click on Finder > Go > Utilities > Terminal.
4. Type in without quotations “cd ~/”
5. Next, type "touch .bash_profile" to create your new bash or otherwise known path file.
6. Next, type "open -e .bash_profile" to open it in TextEdit. A TextEdit window will open, copy and past this into that window, substituting <username> for your username on OSX:
export PATH=${PATH}:/Users/<username>/AndroidSDK/tools
7. Save the file and close the window.
8. Repeat steps 5 through 7, but replace .bash_profile with ".bashrc" (without the quotes)
9. ADB should be ready to go. Make sure that your Droid X is set to "charge only" when connected via USB, and that you have debug mode set to on in your Android settings (settings>applications>development> USB Debugging)
10. In terminal, type (without the quotes): "adb devices". You should see a return that gives a list of devices attached. If the daemon wasn't started yet, this will do it. After that, type "adb shell" to enter adb.
11. After that, the adb commands are ALL the same on any platform, just make adjustments for different file systems when moving things TO your phone when using the command prompt (and not in the adb shell itself, but using adb commands). OSX follows unix/linux file structure, but not always the linux/unix file arrangement (but pretty darn close, since it is a Unix BSD GUI).
Now onto rooting your DX running 2.2. I've attached the file I used. It is a .rar files, so you will need a .rar extractor. I found a nice free one on the net called UnrarX. Google it, get it. Its free, it works. I will give instructions assuming you have them. These instructions come from karnovaran here on XDA. THey are for the droid 2, but work for the Droid X as well. i will translate them into instructions that can be followed verbatim on Mac (as the instructions he gave are meant for those doing this through the command prompt in windows).
1. Extract the contents of the attached file to your sdk tools folder
2. Open a terminal window and navigate to your sdk tools folder. if you put the sdk folder in your home folder, then the command and path you should enter from the terminal should be something like this:
cd AndroidSDK/tools
3. Now the process is as follows (follow EXACTLY, making sure you are faithful to YOUR file paths). I'm copying almost verbatim from karnovaran:
- adb devices (to verify the connection)
- adb push Superuser.apk /sdcard/Superuser.apk
- adb push su /sdcard/su
- adb push busybox /sdcard/busybox
- adb push rageagainstthecage-arm5.bin /data/local/tmp/rageagainstthecage-arm5.bin
- adb shell
- cd data/local/tmp
- chmod 0755 rageagainstthecage-arm5.bin
- ./rageagainstthecage-arm5.bin
- let the process run until it 'kicks' you out (this WILL take a while, so don't TOUCH ANYTHING on your phone. Just go grab a beer and relax until the proces kicks you back out to the tools folder in terminal)
- adb kill-server
- cd <wherever-your-sdk-tools-folder-is>
- adb devices (to verify the connection)
- adb shell (you should now have a # prompt, if not return to ./rage step above)
- mount -o rw,remount -t ext3 /dev/block/mmcblk1p21 /system
- cp /sdcard/Superuser.apk /system/app/Superuser.apk
- cp /sdcard/su /system/bin/su
- cp /sdcard/busybox /system/bin/busybox
- chmod 4755 /system/bin/su
- chmod 4755 /system/bin/busybox
- mount -o ro,remount -t ext3 /dev/block/mmcblk1p21 /system
- exit
- exit
This got me root on my DX and I did this on OSX no problem. The only PC I have that is functional is my laptop for work and because of the content on it and security procedures, though I could do android hacking with it, I will not, so I'm stuck with using my Mac. Thing is that it really is NOT hard. Commands are almost exactly as in Linux/Unix, and OSX terminal runs bash, which is quite versatile (more commands than busybox, iirc) in and of itself. And getting mac root access is bloody easy using sudo if you need it (otherwise, don't use it).
I hope this helps. Have fun.
many steps.... but will go slowly.
Thank you!!!!
Many steps, but they work!
SirBrass said:
Running ADB with Mac OSX and therefore rooting with the mac is EASY. Just make sure you have the Android SDK installed on your Mac. Make sure in your .bash_profile you have the path set to the tools directory of your SDK folder.
Since I can't tell if you have all this down, I'll give you the instructions on setting up adb on the mac (using terminal), then give you the directions I followed on rooting my Droid X from OSX (I am running 2.2 leaked).
Essentially follow these instructions (taken from tjrocks91 on droidforum... I'd link, but I am not yet allowed to post outside links on this forum):
1. Download the Android SDK for Mac OSX. (google it)
2. Extract the zip file to any destination on your Mac. *Remember its path!*
In the AndroidSDK folder, there will be a folder named “tools”. We will be adding this folder to the path on Mac OSX. For this example, extract to your home folder (the folder that contains the desktop, documents, etc. folders)
3. To do this click on Finder > Go > Utilities > Terminal.
4. Type in without quotations “cd ~/”
5. Next, type "touch .bash_profile" to create your new bash or otherwise known path file.
6. Next, type "open -e .bash_profile" to open it in TextEdit. A TextEdit window will open, copy and past this into that window, substituting <username> for your username on OSX:
export PATH=${PATH}:/Users/<username>/AndroidSDK/tools
7. Save the file and close the window.
8. Repeat steps 5 through 7, but replace .bash_profile with ".bashrc" (without the quotes)
9. ADB should be ready to go. Make sure that your Droid X is set to "charge only" when connected via USB, and that you have debug mode set to on in your Android settings (settings>applications>development> USB Debugging)
10. In terminal, type (without the quotes): "adb devices". You should see a return that gives a list of devices attached. If the daemon wasn't started yet, this will do it. After that, type "adb shell" to enter adb.
Last login: Tue Sep 14 09:12:34 on console
Roman-Vails-Computer:~ romanvail$ cd ~/
Roman-Vails-Computer:~ romanvail$ touch .bash_profile
Roman-Vails-Computer:~ romanvail$ open -e .bash_profile
Roman-Vails-Computer:~ romanvail$ touch .bashrc
Roman-Vails-Computer:~ romanvail$ open -e .bashrc
Roman-Vails-Computer:~ romanvail$ adb devices
-bash: adb: command not found
Roman-Vails-Computer:~ romanvail$
*****DOESNT WORK FOR ME*****
Click to expand...
Click to collapse
Do you have the path to adb set properly?
Sent from my DROIDX using XDA App
SirBrass said:
Do you have the path to adb set properly?
Sent from my DROIDX using XDA App
Click to expand...
Click to collapse
Yeah this would be your problem.
@OP,
yes, it would be just that easy IF AND ONLY IF the linux commands apply to macs as well. Which I have NO IDEA on. so proceed at your own risk :z
i finally figured it out... saw another post....
here's what worked:
./
Here's my log in case anyone else needs is:
Roman-Vails-Computer:~ romanvail$ adb
-bash: adb: command not found
Roman-Vails-Computer:~ romanvail$ cd/Users/romanvail/android-sdk-mac_x86/tools -bash: cd/Users/romanvail/android-sdk-mac_x86/tools: No such file or directory
Roman-Vails-Computer:~ romanvail$ cd /Users/romanvail/android-sdk-mac_x86/tools Roman-Vails-Computer:tools romanvail$ ./adb
Android Debug Bridge version 1.0.26
-d - directs command to the only connected USB device
returns an error if more than one USB device is present.
-e - directs command to the only running emulator.
returns an error if more than one emulator is running.
-s <serial number> - directs command to the USB device or emulator with
the given serial number. Overrides ANDROID_SERIAL
environment variable.
-p <product name or path> - simple product name like 'sooner', or
a relative/absolute path to a product
out directory like 'out/target/product/sooner'.
If -p is not specified, the ANDROID_PRODUCT_OUT
environment variable is used, which must
be an absolute path.
devices - list all connected devices
connect <host>[:<port>] - connect to a device via TCP/IP
Port 5555 is used by default if no port number is specified.
disconnect [<host>[:<port>]] - disconnect from a TCP/IP device.
Port 5555 is used by default if no port number is specified.
Using this ocmmand with no additional arguments
will disconnect from all connected TCP/IP devices.
device commands:
adb push <local> <remote> - copy file/dir to device
adb pull <remote> [<local>] - copy file/dir from device
adb sync [ <directory> ] - copy host->device only if changed
(-l means list but don't copy)
(see 'adb help all')
adb shell - run remote shell interactively
adb shell <command> - run remote shell command
adb emu <command> - run emulator console command
adb logcat [ <filter-spec> ] - View device log
adb forward <local> <remote> - forward socket connections
forward specs are one of:
tcp:<port>
localabstract:<unix domain socket name>
localreserved:<unix domain socket name>
localfilesystem:<unix domain socket name>
dev:<character device name>
jdwp:<process pid> (remote only)
adb jdwp - list PIDs of processes hosting a JDWP transport
adb install [-l] [-r] [-s] <file> - push this package file to the device and install it
('-l' means forward-lock the app)
('-r' means reinstall the app, keeping its data)
('-s' means install on SD card instead of internal storage)
adb uninstall [-k] <package> - remove this app package from the device
('-k' means keep the data and cache directories)
adb bugreport - return all information from the device
that should be included in a bug report.
adb help - show this help message
adb version - show version num
DATAOPTS:
(no option) - don't touch the data partition
-w - wipe the data partition
-d - flash the data partition
scripting:
adb wait-for-device - block until device is online
adb start-server - ensure that there is a server running
adb kill-server - kill the server if it is running
adb get-state - prints: offline | bootloader | device
adb get-serialno - prints: <serial-number>
adb status-window - continuously print device status for a specified device
adb remount - remounts the /system partition on the device read-write
adb reboot [bootloader|recovery] - reboots the device, optionally into the bootloader or recovery program
adb reboot-bootloader - reboots the device into the bootloader
adb root - restarts the adbd daemon with root permissions
adb usb - restarts the adbd daemon listening on USB
adb tcpip <port> - restarts the adbd daemon listening on TCP on the specified port
networking:
adb ppp <tty> [parameters] - Run PPP over USB.
Note: you should not automatically start a PPP connection.
<tty> refers to the tty for PPP stream. Eg. dev:/dev/omap_csmi_tty1
[parameters] - Eg. defaultroute debug dump local notty usepeerdns
adb sync notes: adb sync [ <directory> ]
<localdir> can be interpreted in several ways:
- If <directory> is not specified, both /system and /data partitions will be updated.
- If it is "system" or "data", only the corresponding partition
is updated.
environmental variables:
ADB_TRACE - Print debug information. A comma separated list of the following values
1 or all, adb, sockets, packets, rwx, usb, sync, sysdeps, transport, jdwp
ANDROID_SERIAL - The serial number to connect to. -s takes priority over this if given.
ANDROID_LOG_TAGS - When used with the logcat option, only these debug tags are printed.
Roman-Vails-Computer:tools romanvail$ adb devices
-bash: adb: command not found
Roman-Vails-Computer:tools romanvail$ ./adb devices
* daemon not running. starting it now on port 5037 *
* daemon started successfully *
List of devices attached
015D61C60A003017 device
Roman-Vails-Computer:tools romanvail$ ./adb push Superuser.apk /sdcard/Superuser.apk
1059 KB/s (27688 bytes in 0.025s)
Roman-Vails-Computer:tools romanvail$ ./adb push su /sdcard/su
1802 KB/s (26248 bytes in 0.014s)
Roman-Vails-Computer:tools romanvail$ ./adb push busybox /sdcard/busybox
1918 KB/s (1926944 bytes in 0.980s)
Roman-Vails-Computer:tools romanvail$ ./adb push rageagainstthecage-arm5.bin /data/local/tmp/rageagainstthecage-arm5.bin
726 KB/s (5392 bytes in 0.007s)
Roman-Vails-Computer:tools romanvail$ ./adb shell
$ cd data/local/tmp
$ chmod 0755 rageagainstthecage-arm5.bin
$ ./rageagainstthecage-arm5.bin
[*] CVE-2010-EASY Android local root exploit (C) 2010 by 743C
[*] checking NPROC limit ...
[+] RLIMIT_NPROC={3815, 3815}
[*] Searching for adb ...
[+] Found adb as PID 2846
[*] Spawning children. Dont type anything and wait for reset!
[*]
[*] If you like what we are doing you can send us PayPal money to
[*] [email protected] so we can compensate time, effort and HW costs.
[*] If you are a company and feel like you profit from our work,
[*] we also accept donations > 1000 USD!
[*]
[*] adb connection will be reset. restart adb server on desktop and re-login.
$ Roman-Vails-Computer:tools romanvail$ ./adb kill-server
Roman-Vails-Computer:tools romanvail$ ./adb kill-server
* server not running *
Roman-Vails-Computer:tools romanvail$ cd /Users/romanvail/android-sdk-mac_x86/tools
Roman-Vails-Computer:tools romanvail$ ./adb devices
* daemon not running. starting it now on port 5037 *
* daemon started successfully *
List of devices attached
XXXXXXXXXXXXXXXX device
Roman-Vails-Computer:tools romanvail$ ./adb shell
# mount -o rw,remount -t ext3 /dev/block/mmcblk1p21 /system
# cp /sdcard/Superuser.apk /system/app/Superuser.apk
# cp /sdcard/su /system/bin/su
# cp /sdcard/busybox /system/bin/busybox
# chmod 4755 /system/bin/su
# chmod 4755 /system/bin/busybox
# mount -o ro,remount -t ext3 /dev/block/mmcblk1p21 /system
# exit
Roman-Vails-Computer:tools romanvail$ exit
logout
[Process completed]
Now that's odd. I only get problems when I try and use ./ just regular "adb" works on my machine.
SirBrass said:
Now that's odd. I only get problems when I try and use ./ just regular "adb" works on my machine.
Click to expand...
Click to collapse
Yea pretty weird... I use OSX 10.5.8
Intel machine... so, it's weird, but IT DID WORK.
romanvail said:
Yea pretty weird... I use OSX 10.5.8
Intel machine... so, it's weird, but IT DID WORK.
Click to expand...
Click to collapse
There's your problem.... you're using leopard . I'm using 10.6.3. Love it. They did well with this new OS version (for those who don't know... the difference to users between Leopard and Snow Leopard for OSX folks is like the diff between Eclair and FroYo... the former is good, but the later far exceeds it under the hood though still remaining almost the same on the front end).
And obviously that means I'm running an intel machine as well. 2008 iMac 20".... 2.66 Ghz Core 2 Duo. Just your regular, nothing-special iMac.
I thought Macs were supposed to be user friendly?
*snicker*
Sent from my DROIDX using XDA App
Will this method work for a Droid X on Android 2.3.4 Gingerbread and with build # 4.5.1_57_DX8-51 Also is there a new one click type solution by now on a Mac?

Adb installation instructions for Ubuntu

The Absent-Minded Professor and I just installed adb on Ubuntu; here is how to set up adb on Ubuntu Linux, Gutsy through Maverick.
Our port of the BX theme to CM6 stable is forthcoming.
first command after installing and updating sdk and extracting the tgz file to your home directory is== sudo gedit /etc/udev/rules.d/70-android.rules
NOTE: In the above file replace ## with the number 50 if you are running Gusty/Hardy/Dapper (50-android.rules) or with the number 70 if you are running Karmic Koala/Lucid Lynx(70-android.rules
after the window pops write this in the file==SUBSYSTEM==”usb”, SYSFS{idVendor}==”0bb4″, MODE=”0666″ then save and close
the follwing commands is== sudo chmod a+rx /etc/udev/rules.d/70-android.rules
Then reboot.
Open a terminal and type== sudo gedit .bashrc
The file contents should be as follows== export PATH=${PATH}:~/home/user/android-sdk-linux_86/tools
Save and close.
Run the command== adb devices
If you see a serial number like this:
List of devices attached
HT99PHF02521 device
then you are done.
If you get error messages such as "no such command," cd to /home/user/android-sdk-linux_x86/tools and use the adb commands in this way:
./adb devices
./adb shell
etc.
If you get an error message here referencing insufficient device permissions, do the following:
./adb kill-server
sudo ./adb start-server
Now ./adb devices should work.
Courtesy of laie1472 and The Absent Minded Professor
Thanks to Esau Silva (http://esausilva.com/2010/05/13/setting-up-adbusb-drivers-for-android-devices-in-linux-ubuntu/) and Tobias Eisentrager (http://www.mail-archive.com/[email protected]/msg14211.html).

Windows batch script for wireless ADB with shell, logcat, and bugreport

I made a batch shell script for using wireless ADB in windows. It is simpler to use than opening CMD.exe, then CDing to the platform-tools directory and changing the ADB port, so I figured I'd post it. Just paste it into notepad, change the IP address to the correct one for your phone, and save as a .BAT file.
Code:
@ECHO OFF
cd "C:\Program Files (x86)\Android\android-sdk\platform-tools"
adb.exe connect [xxx.xxx.xxx.xxx:xxxx]
CLS
CHOICE /N /C:1234 /M "Press 1 for a realtime Android log, Press 2 for a shell prompt, press 3 for a bug report, or Press 4 for a command prompt."
IF ERRORLEVEL ==4 GOTO FOUR
IF ERRORLEVEL ==3 GOTO THREE
IF ERRORLEVEL ==2 GOTO TWO
IF ERRORLEVEL ==1 GOTO ONE
GOTO END
:FOUR
ECHO At the command prompt, type ADB for a list of possible commands.
GOTO END
:THREE
ECHO Enjoy your android bugs:
adb bugreport
GOTO END
:TWO
ECHO Welcome to the Android shell. Type "exit" and hit Enter to exit to command prompt.
adb shell
GOTO END
:ONE
adb logcat
GOTO END
:END
ECHO ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
cmd
Also, please let me know if you have any suggestions for my script.
Have you used UKE? It has wireless ADB built in to the phone. Never used wireless ADB personally, I'm a wired guy.
Don't you mean it's a Cyanogenmod feature and not a U.K.E feature?

[REF][DEV]Terminal Emulator Commands

Always wondered what the terminal emulator app does? Dont now what commands to type? Well this thread is all about that
ALERT!!! ALERT!!
BELOW ARE THE COMMANDS AND THE PROCESSES THAT WILL HAPPEN BY TYPING THE COMMANDS!!!
IF YOU DO NOT UNDERSTAND SOMETHING PLEASE SO NOT TRY IT.. IT IS RISKY AND WILL POTENTIALLY HARM YOUR DEVICE!!
DO NOT BLAME ME THEN!!
THIS IS A REFERENCE AND DEV THREAD. NOOBS SHOULD NOT LINGER AROUND HERE
The Android Shell
A "shell" is a program that listens to keyboard input from a user and performs actions as directed by the user. Android devices come with a simple shell program. This shell program is mostly undocumented. Since many people are curious about it I thought I'd write up some documentation for it.
Currently this documentation is incomplete, sorry!
Click to expand...
Click to collapse
Common problems
The built-in shell has very limited error handling. When you type a command name incorrectly it will say "permission denied", even though the real problem is that it couldn't find the command:
Click to expand...
Click to collapse
Code:
$ dir
dir: permission denied <---- this is a misleading error message, should say 'dir: not found'
$ ls
... listing of current directory
The PATH variable
The Android shell will run any program it finds in its PATH. The PATH is a list of directories. You can find out what your shell's PATH is set to by using the built-in echo command:
Code:
$ echo $PATH
/data/local/bin:/sbin:/vendor/bin:/system/sbin:/system/bin:/system/xbin
Depending upon your shell, you may see a different result.
Built in Commands
Every shell has a few built-in commands. Some common built-in commands are:
echo -- prints text to stdout.
set -- sets shell variables
export -- makes shell variables available to command-line programs
cd -- change the current directory.
pwd -- print name of the current directory.
Commands
To find out what commands you have available to you, use the "ls" command on each of the directories in the PATH variable.
Click to expand...
Click to collapse
Finding documentation for the Android commands.
Many of the Android commands are based on standard Linux (or bsd) commands. If you're curious about a command, you can sometimes learn how it works by using the "man" command on a desktop Linux or OSX (Apple Macintosh) computer. The Linux or OSX version of the command may be different in details, but much of the documentation will still apply to the Android version of the command.
Another source of documentation for people without a Linux or OSX machine handy is to use a web browser and use a web search engine to search for the text: "man Linux command-name".
List of commands
The following is a list of the commands that are present on a Nexus S phone running an Android 2.3.3 "user-debug" build. Many of these commands are not present on a "user" phone. (They are missing from a "user" phone because they are specific to developing or debugging the Android operating system.)
Code:
$ ls /data/local/bin
/data/local/bin: No such file or directory
Notice that by default there is no /data/local/bin directory. You can create this directory using the "mkdir" command if you like.
Code:
$ ls /sbin
opendir failed, Permission denied
The /sbin directory exists, but you don't have permission to access it. You need root access. If you have a developer phone, or otherwise have root access to your phone you can see what's in this directory.
Code:
$ su
# ls /sbin
ueventd
adbd
# exit
$
Notice that the shell prompt changes from a '$' to a '#' to indicate that you have root access.
Click to expand...
Click to collapse
Notice also that neither of the /sbin commands are useful to the shell -- the adb and ueventd files are 'daemon' programs used to implement the Android Debugger "adb" program that is used by developers.
Code:
$ ls /vendor/bin
gpsd
pvrsrvinit
Vendor/bin is where device vendors can put device-specific executables. These files are from a Nexus S.
Code:
$ ls /system/sbin
/system/sbin: No such file or directory
This directory does not exist on a Nexus S.
Code:
$ ls /system/bin
am
am is the Android Activity Manager. It's used to start and stop Android activities (e.g. applications) from the command line. Type am by itself to get a list of options.
Click to expand...
Click to collapse
Code:
amix
aplay
Command line audio file player.
Code:
app_process
applypatch
Used to apply patches to android files.
Code:
arec
Command line audio recorder.
Code:
audioloop
bluetoothd
BlueTooth daemon
Code:
bmgr
Backup manager - type command by itself to get documentation.
Code:
bootanimation
Draws the boot animation. You may have to reset your phone to get out of this.
Code:
brcm_patchram_plus
bugreport
cat
Copy the contents of a file to standard output.
Code:
chmod
Change the mode of a file (e.g. whether it can be read or written.)
Code:
chown
Change the owner of a file.
Code:
cmp
Compare two files byte-by-byte
Code:
dalvikvm
The dalvik virtual machine. (Used to run Android applications.)
Code:
date
Prints the current date and time
Code:
dbus-daemon
dd
Convert and copy a file. By default copies standard in to standard out.
Code:
debuggerd
dexopt
df
Shows how much space is free on different file systems on your device.
Code:
dhcpcd
dmesg
dnsmasq
dumpstate
dumpsys
dvz
fsck_msdos
gdbserver
getevent
getprop
gzip
hciattach
hd
id
ifconfig
iftop
ime
input
insmod
installd
ioctl
ionice
iptables
keystore
keystore_cli
kill
Send signals to processes.
Code:
linker
ln
Used to set up a file system link.
Code:
log
logcat
Prints the Android runtime log.
Code:
logwrapper
ls
Lists files.
Code:
lsmod
lsof
make_ext4fs
mediaserver
mkdir
Make a directory.
Code:
monkey
A program that sends random events, used to test applications. (Like having a monkey playing with the device.)
Code:
mount
mtpd
mv
Move a file from one directory to another. (Only on the same file system. Use "cat a > b" to copy a file between file systems.
Code:
nandread
ndc
netcfg
netd
netstat
newfs_msdos
notify
omx_tests
pand
ping
pm
pppd
printenv
ps
List active processes.
Code:
qemu-props
qemud
racoon
radiooptions
reboot
Reboot the device.
Code:
record
renice
rild
rm
Remove a file.
Code:
rmdir
Remove a directory.
Code:
rmmod
route
rtp_test
run-as
schedtest
schedtop
sdcard
sdptool
sendevent
service
servicemanager
setconsole
setprop
setup_fs
sh
showlease
sleep
smd
stagefright
start
Starts the Android runtime.
Code:
stop
Stops the Android runtime.
Code:
surfaceflinger
svc
sync
system_server
tc
testid3
toolbox
top
Shows which processes are currently using the most CPU time.
Code:
umount
uptime
Prints how long your device has been running since it was last booted.
Code:
vdc
vmstat
vold
watchprops
wipe
wpa_cli
wpa_supplicant
$ ls /system/xbin
add-property-tag
btool
check-lost+found
dexdump
dhdutil
hcidump
latencytop
librank
opcontrol
oprofiled
procmem
procrank
rawbu
scp
Secure copy program. (Used to copy files over the network.)
Code:
showmap
showslab
sqlite3
Used to administer SQLite databases.
Code:
strace
System trace command - use to see what system calls a program makes.
Code:
su
Start a shell with root privileges.
Versions of the Android Shell
Android 1.0 used a shell that had no tab completion or history editing.
Android 2.3 added history editing. You can for example use the up/down arrows to edit previous commands.
Other shells
Busybox
Busybox is a program that contains a shell and a set of command line utilities. Search Android Market for "Busybox" and you should find some versions you can install. The Busybox shell includes tab completion and history editing. Some versions of Busybox for Android do not require that you root your phone.
Debian utilities
You can install the full Debian shell and utilities. (Debian is a popular desktop Linux distribution.) I don't know the details, and it may require a "rooted" phone. Try a web search for "Debian Android install".
Custom ROMs
Some custom ROMs come with their own shells and utilities. If you are using a custom ROM, check its documentation to find out what's available.
How can I view stdout outputs in terminal emulator window?
For example with dd command, not specifying output should display it at current terminal, like in linux, but actually doesn't. Any ideas?
Hey wanna troll someone's phone
Type in terminal "stop" lololol
Sent from my E15i using xda premium
Similar to linux terminal commands I use
Nice work though, great guide, thanks dude
W!LßSO @ XDA
Great guide, but you have forgot a very useful command: grep
It allows to apply filters to the output of the commands. The syntax is:
Code:
command | grep filter
For example, to list only the apk files inside a folder:
Code:
ls /folder/to/list | grep .apk
Great guide!
IMO dmesg is also important. Maybe you should add in a description for it?
Dmesg --> prints the Linux kernel output, which is different from the Android system output, logcat. Useful for checking hardware and to see if modules started up succesfully. Also useful for debugging in conjunction with logcat.
Code:
cat /proc/kmsg > /sdcard/dmesg.txt
Copies the dmesg output to a file fled dmesg.txt on the sdcard
And
Code:
cat /dev/log/system > /sdcard/logcat.txt
Copies the logcat output to a file named logcat.txt on your sdcard.
Also, you missed out the parted and e2fsck commands, used for partitioning and checking filesystem integrity.
Also, the command free (display free ram/swap) is not included.
Sent from my E15i using Tapatalk 2
Is there a command for check disk utility as in windows.. chkdsk...
my memory card is not working hence thought of running the check disk if possible...
dspPunk said:
Is there a command for check disk utility as in windows.. chkdsk...
my memory card is not working hence thought of running the check disk if possible...
Click to expand...
Click to collapse
Code:
su
fsck_msdos /dev/block/yourdevice
For ext4 there's e2fsck
scandiun said:
Code:
su
fsck_msdos /dev/block/yourdevice
For ext4 there's e2fsck
Click to expand...
Click to collapse
Dint get it... Sorry i am a so not into commands...
Kindly tell me the step wise solution... How can i see my device [yourdevice] which you have specified...
dspPunk said:
Dint get it... Sorry i am a so not into commands...
Kindly tell me the step wise solution... How can i see my device [yourdevice] which you have specified...
Click to expand...
Click to collapse
I don't have a Xperia X8 actually, does it support mass storage mode for internal sdcard?
http://www.jayceooi.com/2012/03/14/...storage-on-android-4-0-ics-samsung-galaxy-s2/
scandiun said:
I don't have a Xperia X8 actually, does it support mass storage mode for internal sdcard?
http://www.jayceooi.com/2012/03/14/...storage-on-android-4-0-ics-samsung-galaxy-s2/
Click to expand...
Click to collapse
I am having SGS2 and yes it supports mass storage for internal sdcard...
When i connect to my computer it shows only internal sdcard and not external card which is present in the external sdcard slot...
actually the problem is that my sdcard gets detected some times and sometimes it doesnt...
i searched a lot and many of them told that it is a kernel version issue.. i updated kernel still no luck..
then i got one thread which gave me the solution of check disk so was thinking whether terminal emulator has any commands for check disk..
Hi hetunandu, great guide,
but still I don't understand few things:
1: how to run a specific action of an app?
2: how to KNOW the exact sintax of possible actions of an app?
3: is it possible to launch these commands via SSH (through an SSH server)?
eg: I want to start a audio-recording app on my phone from my computer, AND start recording from remote. Is it possible?
Thank you
(and sorry for my english..)
JFI - Never run fsck on a mounted partition.. You will corrupt your data!
CtrlAltDelIrl said:
JFI - Never run fsck on a mounted partition.. You will corrupt your data!
Click to expand...
Click to collapse
Usually fsck won't run on that case and you warn you, you will have to use the force option in that case.
reading traffic stats
I am trying to get the traffic stat getMobileRxBytes (or any other traffic stat) to output a usable result in the terminal emulator. The goal is simply to be able to copy the rx bytes total to be used in Tasker. However, I can't seem to be able to get any output. I would appreciate it if anybody knows the proper command/syntax to show this traffic data. Thanks.
I am on a stock rooted 4.1.1 Galaxy Nexus.
[Q] Is there a command to show some configuration ?
I have run this command on terminal emulator:
[email protected]:/ $ su
[email protected]:/ #setprop net.cdma.rstp.proxy.addr 0.0.0.0;
[email protected]:/ #setprop net.cdma.rstp.proxy.port 0;
[email protected]:/ #setprop net.cdma.httppd.proxy.addr 0.0.0.0;
[email protected]:/ #setprop net.cdma.httppd.proxy.port 0;
Is above command right..???
after that i ran "getprop" i don't see effect of that command.
Can you tell me the right way or command to change my rstp & httppd setting...? cause my Epic4G cannot play video streaming after flashing CM10 nightly.
thanks,
adit
permission denied
china telecom infotmic m7206 not root because no usb i want to root tablet pc
terminal is boot "permission denied" why
help me please ???
Any way to check Camera firmware version per http://forum.xda-developers.com/showthread.php?t=2006128 ?
rooted Verizon SG3 on CM10.0
Hi... Before this I have rooted my phone since yesterday when I accidentally copy su file from "/system" to "/system/bin/" andnow I can't get root access because on Superuser I check the su version was 3.1.1 but there got red words maybe it try saying that I put su file in wrong location and I can't move it back because my root explorer can't get root access and it just show Root Explorer acess denied by Superuser. Terminal emulator also access denied. One more I'm using Sony Ericsson W8 and it can't unlock bootloader. Could someone help me to remove su file from "/system/bin". Thanks You
PutraMasyers97 said:
Hi... Before this I have rooted my phone since yesterday when I accidentally copy su file from "/system" to "/system/bin/" andnow I can't get root access because on Superuser I check the su version was 3.1.1 but there got red words maybe it try saying that I put su file in wrong location and I can't move it back because my root explorer can't get root access and it just show Root Explorer acess denied by Superuser. Terminal emulator also access denied. One more I'm using Sony Ericsson W8 and it can't unlock bootloader. Could someone help me to remove su file from "/system/bin". Thanks You
Click to expand...
Click to collapse
Just root ur W8 again as u did before
see boot animation without rebooting

Ad Blocking on ZTE Open

Until there are ad blocking apps for FFOS it needs a DIY method.
I'll assume you know how to use adb and have it set up on your machine. I'll also assume you have rooted your phone following the instructions here.
I use Linux so my commands may be a bit off in places.
1. Collect a suitable hosts file. I used the one on my Android phone but this one seems to update regularly http://winhelp2002.mvps.org/hosts.txt
2. Save the file as 'hosts' to a known location on your PC.
3. Open a shell window (command window) on your PC and check adb works.
Code:
adb devices
should return roamer2. If not, on your phone, go to settings > More Information > Developer - and check Remote Debugging.
4. In the shell window - change directory to where you have saved the hosts file. then type:-
Code:
adb push hosts /sdcard/
5. When that completes type:-
Code:
adb shell
you'll see $ prompt
Code:
su
If you are rooted correctly you'll see # prompt
Code:
mount -o remount,rw /system
Mounts the system folder for read / write permissions.
Code:
cat /system/etc/hosts
Should show just '127.0.0.1 localhost'
Save this if you want as hosts.old
Code:
busybox mv /system/etc/hosts /system/etc/hosts.old
Now replace the hosts file with the new one:-
Code:
busybox mv /sdcard/hosts /system/etc/hosts
To check your hosts file has been replaced type
Code:
cat /system/etc/hosts
And lots of domain names will whiz past.
All done.

Categories

Resources