• Introducing XDA Computing: Discussion zones for Hardware, Software, and more!    Check it out!

Android Terminal Commands

Search This thread

rezo609

Senior Member
May 17, 2012
363
523
Dallas
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:

Lesicnik1

Senior Member
Feb 12, 2011
2,294
756
Slovenj Gradec
Last edited:
  • Like
Reactions: yashade2001

wangdaning

Senior Member
Sep 17, 2012
1,377
571
Wuxi
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:

RoberGalarga

Senior Member
Dec 21, 2011
745
274
In front of my laptop :D
So practically the basic linux comands are the same with android terminal!!!
Yep ;)

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

grep - Useful to apply filters to other commands. For example, to list only the apk files inside a folder:
Code:
ls /folder/to/list | grep apk
or to search a string inside a file:
Code:
cat /file | grep stringToSearch
logcat - Debugging tool, all the system messages are shown here. To show only the debug messages (useful when an app is giving FC without apparent reason), type:
Code:
su
logcat -d


mount
- The most common use for this command is remount the system partition, to modify its content (be careful, you can easily brick your device!). Common usage (needs root):
Code:
Mount /system in Read/Write mode:
mount -o rw,remount /system

Mount /system in Read Only mode:
mount -o ro,remount /system
Saving command output to file. Type
Code:
command >> /folder/to/save/file
If the file doesn't exist will be created, otherwise, the info will be added to the end of the file.
You can also use:
Code:
command > /folder/to/save/file
If the file doesn't exist also will be created, but if the file exists its content will be deleted before add the info.
 
  • Like
Reactions: HemanthJabalpuri

pinchopanda

Member
Apr 15, 2012
6
0
mount - Mounting a partition

umount - Unmounting a mounted partition

reboot - Reboot phone

stop - Shutdowns the GUI

start - Restarts GUI

above two commands can be used to get a fast reboot.
 

smep

Senior Member
Jul 30, 2013
219
34
Also you my use the reboot command to do a faster restart to the device but your are going to lose any unsaved work
You must be rooted
First type : su
Then : reboot


Sent from my GT-I9505 using XDA Premium 4 mobile app
 

tigerphones

New member
Mar 22, 2010
1
0
SAVED ME!

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

Dude, thank you so much for posting this information. I had switched my MNVO service to a newer a phone, and this one was just sitting around. There were still things on it that I needed like some notes that I had saved. Because I had not used it in a while, and there was no data/cell service on it, I was out of luck (or so I thought) when I forgot my unlock pin. It wouldn't accept my google login information because there was no data connection. I COULD NOT GET INTO MY PHONE! I was dreading the possibility of having to factory reset, which would erase my notes and other things saved on there. On a whim and after MUCH Google searching, I was trying to find a way to reset the number of attempted pin locks to no avail. I was about to give up, but luckily, I remembered I had rooted it. And after downloading the latest SDK bundle, I came across your post. It allowed me to turn the wifi on my cell phone even though I was "locked out." Wouldn't you know that it very quickly picked up my home wifi signal. Because a data connection was enabled, I was then able to use my gmail login information to get into the phone. Your post saved me and prevented me from having to factory reset my phone and losing my information. Thank you so much!
 

Veniceee

Member
Oct 22, 2012
45
1
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.

if i wanted to delete a directory with data ? what would be the syntax
 

purplecircle

Member
Aug 19, 2009
12
3
Set/View Network Host Name

Run the following as root

setprop net.hostname <new_hostname> // To Change Device Hostname
getprop net.hostname // To View Device Hostname
 

QuaRanTin3

New member
Sep 24, 2014
1
0
list of all android terminal commands

Open terminal or file explorer with root access
From root folder go to /system/bin
Type command :ls
The list contains all the terminal codes available
Enjoy!!


Disclaimer1: I'm not responsible if anything goes wrong while you try out the codes.
Disclaimer:man & help pages are not available on android terminal
 

Top Liked Posts

  • There are no posts matching your filters.
  • 37
    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.
    9
    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
    6
    Substitute user XD you know it is superuser right?
    1
    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
    1
    So practically the basic linux comands are the same with android terminal!!!
    Yep ;)

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

    grep - Useful to apply filters to other commands. For example, to list only the apk files inside a folder:
    Code:
    ls /folder/to/list | grep apk
    or to search a string inside a file:
    Code:
    cat /file | grep stringToSearch
    logcat - Debugging tool, all the system messages are shown here. To show only the debug messages (useful when an app is giving FC without apparent reason), type:
    Code:
    su
    logcat -d


    mount
    - The most common use for this command is remount the system partition, to modify its content (be careful, you can easily brick your device!). Common usage (needs root):
    Code:
    Mount /system in Read/Write mode:
    mount -o rw,remount /system
    
    Mount /system in Read Only mode:
    mount -o ro,remount /system
    Saving command output to file. Type
    Code:
    command >> /folder/to/save/file
    If the file doesn't exist will be created, otherwise, the info will be added to the end of the file.
    You can also use:
    Code:
    command > /folder/to/save/file
    If the file doesn't exist also will be created, but if the file exists its content will be deleted before add the info.