Basic Linux/Unix Shell Commands – Android

 

This guide aims to give you a background on some of the linux commands available to you once you obtain an adb shell. In order to obtain an ADB shell, you must have adb set up on your computer (all ADB really consists of in windows is adb + 2 dlls + adb drivers. However, it makes sense to fully set up the Android SDK if you plan on developing for Android.

 NOTE = All commands in linux/unix are CASE SENSITIVE.

 

cd – Change Directory

To change to any directory, simply type:

cd dirname   
dir name is the path. For instance, to switch to system/etc, type:

cd /system/etc
‘..’ will allow you to go back one directory. In our example, typing:

cd ..
would take you back to /system

 

ls – List Files

To list all the files in whatever directory you’re in, simply type:

ls
pressing enter after, of course. This will list all NON-HIDDEN files/directories.

ls /system/etc
will list the contents of system/etc

ls -l 
will list all NON-HIDDEN files in your current directory with additional details

ls -a 
will list all files/directories(including hidden) within your current directory

 

su – SuperUser

The standard adb shell (unless you’re on an insecure kernel/ramdisk), will be a non-root shell ($)

To obtain root priviliges (if your phone is rooted), simply type:

su
on obtaining superuser priviliges, you will be presented with a # symbol, which represent a root shell.

 

chmod – Change Mode

The two most commonly used ‘modes’ you’ll come across in Android are ‘777’ and ‘755’ 

These numerical pemissions have different meanings, of course. This can be a little confusing, so I hope this explains it in a simple to understand way.

As you can see, there are three numbers in the following example; ‘chmod 755’

So, to break that down: The first number in the sequence, ‘7’, represents the USER (aka, you). The second number in the sequence, ‘5’, represents the GROUP (users who are members of the file’s group) and the third number, ‘5’ represents OTHERS (aka, everyone else). 

Now to explain why they are 755, and the significance of those numbers, see the following list:

7     Full
6     Read/Write
5     Read/Execute
4     Read Only
3     Write/Execute
2     Write Only
1     Execute
0     None

So in the instance of 777, you can see that USER, GROUP and OTHERS have FULL access to the file in question.

To change the permissions of one file (apns-conf.xml for example, type:
chmod 777 /system/etc/apns-conf.xml


To change the permissions of all files in a directory, use the -R (recursive)option:
chmod 777 -R /system/etc

 

pwd – Print Working Directory

Couldn’t be more simple. if you want to find out which dirctory you’re currently in, type:

pwd
and press enter. 

 

cat – Concatenate (evolved from)

The cat command if used to list a file’s contents on your screen; or pass via pipeline to use with other Linux commands. 

cat /proc/mounts
will output the various mount points in your android OS. 

Note that there are many other uses for the cat command. It can be used to copy files, for example. 

 

dd – Data Dump

This one’s useful if you’re ever looking to dump your ROM/kernel, etc. After you have run cat /proc/mounts (above) and have a su (#) shell, you can dump system in the format of its current file system to your SD card. Let’ say system is on mmcblk0p1 (/dev/block/mmcblk0p1). Type the following:

dd if=/dev/block/mmcblk0p1 of=/sdcard/system.img bs=4096 

There you go – system.img is now on your SD card!

 

mount – As it says on the tin.

In order to mount system as read write, (using the output from cat /proc/mounts), simply type in the following:

su
mount -o rw,remount /dev/block/mmcblk0p1 /system

Android Secret Dial Codes


 

Built into the Andoid OS, are dialling codes which will activate a number of hidden features, such as the ability to change your MMS Service Centre Number, or totally turn off the phone’s radio. Simply dial them, and they will automatically bring up each feature.

BE AWARE – SOME OF THESE CODES WILL CHANGE THE WAY YOUR PHONE FUNCTIONS – USE THEM WITH EXTREME CAUTION


These codes are listed below:

*#*#4636#*#* – Phone Information (allows you to change the SMS service centre number and more)

*2767*3855#  – HARD RESET (will fully wipe and restore firmware. USE WITH CAUTION

*#*#34971539#*#* Shows completes information about the camera 

*#*#7594#*#* Changing the power button behavior-Enables direct poweroff once the code enabled 

*#*#273283*255*663282*#*#* For a quick backup to all your media files 

*#*#197328640#*#* Enabling test mode for service activity 

*#*#232339#*#* OR *#*#526#*#* OR *#*#528#*#* Wireless Lan Tests 

*#*#232338#*#* Displays Wi-Fi Mac-address 

*#*#1472365#*#* For a quick GPS test 

*#*#1575#*#* A Different type GPS test 

*#*#0283#*#* Packet Loopback test 

*#*#0*#*#* LCD display test 

*#*#0673#*#* OR *#*#0289#*#* Audio test 

*#*#0842#*#* Vibration and Backlight test 

*#*#2663#*#* Displays touch-screen version 

*#*#2664#*#* Touch-Screen test 

*#*#0588#*#* Proximity sensor test 

*#*#3264#*#* Ram version 

*#*#232331#*#* Bluetooth test 

*#*#7262626#*#* Field test 

*#*#232337#*#* Displays bluetooth device address 

*#*#8255#*#* For Google Talk service monitoring 

*#*#4986*2650468#*#*  PDA, Phone, Hardware, RF Call Date firmware info 

*#*#1234#*#* PDA and Phone firmware info 

*#*#1111#*#* FTA Software version 

*#*#2222#*#* FTA Hardware verion 

*#*#44336#*#* Displays Build time and change list number 

*#06# Displays IMEI number 

*#*#8351#*#* Enables voice dialing logging mode 

*#*#8350#*#* Disables voice dialing logging mode 

**05***# Execute from Emergency dial screen to unlock PUK code 


Samsung Only:

*#*#7780#*#* Wipe data/factory reset

Create a Free Website

Google India has announced first-of-its kind program to offer free websites, domain & hosting services to small medium businesses in India. You can create a free website for your small business in few minutes with a free domain and hosting account. As per the program, you can get a free .IN domain name along with hosting from Hostgator. This is really great offer for SMBs which wants to get online and promote their products and services.



What Indian businesses get from this offer:

It’s free to set up your website.

The domain is free for 1 year, and it’s free to maintain your website for 12 months.

The website tool takes 15 minutes from sitting down to being found online

You don’t need to be a tech whiz to get started. All you need to start is your address, phone number, TAN/CIN or PAN to verify you as a business

The website is simple because customers are looking for simple information online

Gives you your own .in domain

Other features include photos/logos, integration with social media platforms

You get a Google Apps account – free personalized email ids

If you want to make your website work harder, you’ll have access to steady stream of free tips and tools from the Getting Indian Business Online team and a free coupon of worth Rs. 2500 INR advertising trial from Google AdWords to help promote your site

.After the first year, SMBs can choose to pay a monthly pay-as-you-go to maintain their website using HostGator.

At the end of the first year, they’ll have to pay a nominal charge if they wish to renew their domain name. They can cancel their website at any time.

Google India plans to help 500,000 small medium businesses in India to get online in next three years through this program, which is a great step for SMBs.

How to Make DIY USB OTG

Need Items

  1. USB to Micro-USB cable     

     

     

     

     

     

     

     

2. USB Extender Cable

 

 

 

 

Tools

Screwdriver, Cutter and Soldering Gun

Summary

First of all cut the USB to Micro-USB cable far from Micro-USB end about 6 inches.

 

Open up the outer cover and carve the plastic around the micro USB pins. 

Pin1

VCC

Red

Pin2

D-

White

Pin3

D+

Green

Pin4

Sensor

N/A

Pin5

GND

Black

In Micro-USB normally pin will be arranged     

                            

 

 

 

 

 

After that solder the 4. pin to 5. pin with a piece of wire

 

Make sure that wire ,which is joining PIN4 and PIN5 is not touching the other cable.

 

 

Now cut USB extender for the female USB Connetor about 3 or 6 inch

Remove the shiled for wire at end of both connector (were u cut the cable out for USB Male Connector )

Join wire with related to wire colours.

Red-Red

White-White

Green –Green

Black-Black

 

Then try connect your cell .Now ur USB OTG is READY

Hello world!

Welcome to WordPress.com. After you read this, you should delete and write your own post, with a new title above. Or hit Add New on the left (of the admin dashboard) to start a fresh post.

Here are some suggestions for your first post.

  1. You can find new ideas for what to blog about by reading the Daily Post.
  2. Add PressThis to your browser. It creates a new blog post for you about any interesting  page you read on the web.
  3. Make some changes to this page, and then hit preview on the right. You can always preview any post or edit it before you share it to the world.