What Do You Do with All of Your Old Photos?

Smartphone cameras have advanced so tremendously over the past few years that they have … more

Diving into the April 2015 Material Design Update

Before the release of Android 5.0 Lollipop, the Holo Design guidelines served as the … more

New Cyanogen Partnerships Bring Privacy Concerns

New Privacy concerns have emerged regarding Cyanogen’s latest announcements, … more

PSA: Google Play Services Wakelock Affects Many 5.x ROMs

Wakelocks are the bane of the battery conscious, and this wakelock bug has been … more
Post Reply Subscribe to Thread Email Thread

Android Terminal Commands

5th June 2012, 10:04 PM |#1  
rezo609's Avatar
OP Senior Member
Flag Dallas
Thanks Meter: 479
363 posts
Join Date:Joined: May 2012
Here are a few commands for Android in terminal. If you have any commands that you think should be here, just reply. Enjoy!

chmod - give/take rights away from files. The numbers you see in the how-to's is a little complicated. It has to do with the rights you are assigning the file or folder. http://wiki.linuxquestions.org/wiki/Chmod for further reading.

cat - look at, modify, or combine a file. You can also copy files with this command by "reading" it to another file instead of to the screen.

cd - change from one directory to another

cp - Copy a file from one location to another

dd - copies exact locations to other locations. Can be an entire drive, a folder, etc.

dd if= of=. uses an input file and an output file.

exit - exits the shell you are in. When you type su you start up a shell.

ls - lists all files with in a directory try ls - l too.

mv - Move a file from one location to another. At the same time you can rename a file.

su - Substitute User. We type this to switch to the root user. You need to type this command first to do a lot of the other commands.

tar - creates taped archives. Compresses files like winzip, 7zip, winrar and others tar /? for details.
rm - followed by a file name with delete the file sync - synchronizes any data on disk with data in memory. We type this before rebooting to ensure we've got all data written

Other commands of interest:

df - how much free disk space. In linux you can add a switch "df -h" but the "-h" does nothing for me on Android. top - like task manager, it displays running processes. in Linux the q key quits. On Android I don't know how to make it quit other than closing the app. uptime - displays how long it has been since you last rebooted the system.

busybox - a tool that combines many linux commands into a single compact file. Typing this displays all the commands at your disposal.

busybox df - a much easier to read display of free diskspace. This display shows how full (use%) each file system is.
Last edited by rezo609; 5th June 2012 at 10:19 PM.
The Following 24 Users Say Thank You to rezo609 For This Useful Post: [ View ]
1st October 2012, 08:09 AM |#2  
pdthekd's Avatar
Junior Member
Thanks Meter: 3
24 posts
Join Date:Joined: Apr 2011
Thumbs up Thanks
thank you so much, well for a noob like me very informative was looking for this kind from very long
25th November 2012, 07:20 PM |#3  
Thanks Meter: 50
58 posts
Join Date:Joined: Oct 2012
Substitute user XD you know it is superuser right?
The Following 4 Users Say Thank You to mid-kid For This Useful Post: [ View ]
29th November 2012, 08:53 AM |#4  
Act7's Avatar
Junior Member
Flag Vienna
Thanks Meter: 0
18 posts
Join Date:Joined: Mar 2012
free - see all free Memory from the Device
29th November 2012, 02:11 PM |#5  
Recognized Contributor
Flag Slovenj Gradec
Thanks Meter: 745
2,262 posts
Join Date:Joined: Feb 2011
Originally Posted by mid-kid

Substitute user XD you know it is superuser right?

Actually substitute user is also correct.

"The su command, also referred to as substitute user, super user, or switch user, allows a computer operator to change the current user account associated with the running virtual console."

Source: http://en.wikipedia.org/wiki/Su_(Unix)

Sent from my Galaxy Nexus using xda premium
Last edited by Lesicnik1; 29th November 2012 at 03:36 PM.
The Following User Says Thank You to Lesicnik1 For This Useful Post: [ View ]
7th January 2013, 07:53 PM |#6  
Junior Member
Flag Athens
Thanks Meter: 0
4 posts
Join Date:Joined: Jul 2010
So practically the basic linux comands are the same with android terminal!!!
11th January 2013, 09:55 PM |#7  
sepehrthegreat-iran's Avatar
Senior Member
Flag urmia
Thanks Meter: 26
143 posts
Join Date:Joined: Jan 2013
I just noticed that the ping command is working just fine
Type ping for example
18th February 2013, 03:15 AM |#8  
Junior Member
Flag San Diego
Thanks Meter: 5
25 posts
Join Date:Joined: Sep 2012
Originally Posted by rezo609

If you have any commands that you think should be here, just reply. Enjoy!

svc data enable - turn on mobile data

svc data disable - turn off mobile data

svc wifi enable - turn on wifi

svc wifi disable - turn off wifi

svc help - show information about subcommands
The Following 3 Users Say Thank You to toasterwater For This Useful Post: [ View ]
13th March 2013, 06:46 AM |#9  
Senior Member
Thanks Meter: 124
372 posts
Join Date:Joined: Sep 2012
For the top command mentioned in the OP, just type "top -n 1" and it will exit, leaving you with the readout at the time you executed the command. -n is for number of updates before stopping.

Also will add that the powertop command will show the top reasons for wakeups from idle.
Last edited by wangdaning; 13th March 2013 at 06:57 AM. Reason: Added a command
23rd March 2013, 05:52 PM |#10  
Flag Ljubljana
Thanks Meter: 6
59 posts
Join Date:Joined: Feb 2013
Post Reply Subscribe to Thread
Previous Thread Next Thread
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes