Attend XDA's Second Annual Developer Conference, XDA:DevCon 2014!
5,810,055 Members 48,040 Now Online
XDA Developers Android and Mobile Development Forum

Useful Commands in Terminal Emulator

Tip us?
 
system.img
Old
(Last edited by system.img; 29th August 2014 at 01:25 PM.)
#1  
system.img's Avatar
Senior Member - OP
Thanks Meter 485
Posts: 2,162
Join Date: Feb 2012
Location: Chennai
Default Useful Commands in Terminal Emulator

Hi guys!

I created this thread mainly because many useful things can be done in Terminal emulator. I will show you some simple commands which are useful.

Very useful if you don't have Root explorer when you need it.

Make sure you take a Nandroid backup before you try out just in case you can restore when you do something wrong!

You can get terminal Emulator from here: https://play.google.com/store/apps/d...roidterm&hl=en


Note: Most commands need root. So type su and press enter and grant superuser permissions to Terminal Emulator!


First type this command before using any of the commands below just in case(needs root)

Code:
su
Some useful commands:

Turning device off (Turns your device off very fast!! ):
Code:
poweroff
Rebooting:
Code:
reboot
Rebooting to Recovery
Code:
reboot recovery
Rebooting to download mode:
Code:
reboot download
Forcing Most Apps to install to SDcard(Root needed with Terminal Emulator, no need root with ADB):

Code:
pm setInstallLocation 2
Alternatively, you can type 0 at the end instead of 2 for Auto location install mode or 1 for Internal memory install mode

To check what the current install location is:
Code:
pm getInstallLocation
Mounting R/W in system(Use with caution)

Code:
mount -o rw,remount -t /system
If above one doesnt work, try this.
Code:
mount -o rw,remount -t ext3 /dev/block/mmcblk1p21 /system
Unmounting R/W in system.

Code:
mount -o ro,remount -t /system
If above code doesn't work, try this
Code:
mount -o ro,remount -t ext3 /dev/block/mmcblk1p21 /system
Moving files from sdcard to system (Use after mounting R/W):
Code:
busybox cp /sdcard/<path> /system/<path>
Example: busybox cp /sdcard/demo/framework-res.apk /system/framework/

Changing file permissions to rw-r--r-- (Use after mounting R/W):
Code:
chmod 644 <path>
Example 1: chmod 644 /system/app/mms.apk
Example 2: chmod 644 /system/app/*.apk (This command changes the file permission of all apps in the folder to rw-r--r--)


Changing the current directory:
Code:
cd <path>
Example: cd /sdcard

Listing all the files and folders under the current directory:
Code:
ls
If you want to view all the files and folders in your sdcard, type:
cd /sdcard
ls


Making a new folder:
Code:
mkdir <path>
Example: mkdir /sdcard/newfolder

Removing files (For System files, Use after mounting R/W)
Code:
rm <path>
Example: rm /system/app/demoapp.apk

Removing Folders:
Code:
rmdir <path>
Get info of your build.prop values
Code:
getprop

That's all for now. I will add a few more later!
If you have any more new commands or if I have given an improper command, feel free to post it in the thread

Thanks for reading.
The Following 16 Users Say Thank You to system.img For This Useful Post: [ Click to Expand ]
 
UserU
Old
#2  
UserU's Avatar
Member
Thanks Meter 6
Posts: 75
Join Date: Mar 2012
Have you any idea on why if I were to enter pm set-install-location 2(SD card), the next line would be "Killed"?
The Following User Says Thank You to UserU For This Useful Post: [ Click to Expand ]
 
system.img
Old
#3  
system.img's Avatar
Senior Member - OP
Thanks Meter 485
Posts: 2,162
Join Date: Feb 2012
Location: Chennai
Quote:
Originally Posted by UserU View Post
Have you any idea on why if I were to enter pm set-install-location 2(SD card), the next line would be "Killed"?
I don't understand your question...

Anyways...Thanks for reminding me of that command!
 
UserU
Old
#4  
UserU's Avatar
Member
Thanks Meter 6
Posts: 75
Join Date: Mar 2012
Quote:
Originally Posted by system.img View Post
I don't understand your question...

Anyways...Thanks for reminding me of that command!
No problem. This is the output from the Terminal Emulator. The bold command changes the default install dir to the SD card:
Quote:
u0 a49@android:/ $ pm set-install-location 2
Killed
137|u0 a49@android:/ $
 
system.img
Old
(Last edited by system.img; 13th September 2012 at 03:13 PM.)
#5  
system.img's Avatar
Senior Member - OP
Thanks Meter 485
Posts: 2,162
Join Date: Feb 2012
Location: Chennai
Quote:
Originally Posted by UserU View Post
No problem. This is the output from the Terminal Emulator. The bold command changes the default install dir to the SD card:
I never got that problem on adb.
Let me see....
 
panpjp
Old
#6  
panpjp's Avatar
Senior Member
Thanks Meter 75
Posts: 994
Join Date: Mar 2012
Location: Bangkok
This:
mount -o remount rw system
Is much easier than the previous one to mount readwrite.

Sent from my GT-P7300 using xda app-developers app
Phone One X+ CM11 [hyped for the N6 lol]


thailand's internet is **** right now...
The Following User Says Thank You to panpjp For This Useful Post: [ Click to Expand ]
 
system.img
Old
#7  
system.img's Avatar
Senior Member - OP
Thanks Meter 485
Posts: 2,162
Join Date: Feb 2012
Location: Chennai
Quote:
Originally Posted by panpjp View Post
This:
mount -o remount rw system
Is much easier than the previous one to mount readwrite.

Sent from my GT-P7300 using xda app-developers app
Isnt it /system?
ok...will add to op.
Thanks.
 
panpjp
Old
#8  
panpjp's Avatar
Senior Member
Thanks Meter 75
Posts: 994
Join Date: Mar 2012
Location: Bangkok
Quote:
Originally Posted by system.img View Post
Isnt it /system?
ok...will add to op.
Thanks.
Not necessary for it to be /system

Sent from my Desire using xda app-developers app
Phone One X+ CM11 [hyped for the N6 lol]


thailand's internet is **** right now...
 
system.img
Old
#9  
system.img's Avatar
Senior Member - OP
Thanks Meter 485
Posts: 2,162
Join Date: Feb 2012
Location: Chennai
Quote:
Originally Posted by panpjp View Post
Not necessary for it to be /system

Sent from my Desire using xda app-developers app
Ok....
 
UserU
Old
#10  
UserU's Avatar
Member
Thanks Meter 6
Posts: 75
Join Date: Mar 2012
Quote:
Originally Posted by system.img View Post
I never got that problem on adb.
Let me see....
Here's a thread which shed some light on the similar issue.

http://forum.xda-developers.com/show....php?t=1495423

Thread Tools
Display Modes