Useful Terminal Commands
If you’re familiar with Linux you might think you can just use Linux commands on an Android device, but even on a rooted tablet you quickly discover a LOT of the commands you wouldn’t think twice about entering on Linux don’t work on Android, or the commands are there but flags and parameters you’d assume you can use aren’t recognized. Why? Because they didn’t include a lot of the little “helper” programs that usually ship with Linux. Thankfully they do ship some of them, though many are simplified versions. Here is my list of useful commands to enter in a Terminal on the tablet (or via adb shell), some of them may require root though, I’m not sure. Feel free to add your own favorites to this thread!
STORAGE SPACE
Code:
#df
Shows the storage space in kilobytes (it doesn’t appear df as implemented on Android accepts the -H flag so you’re stuck with kilobytes). Pay particular attention to the /sdcard and /nand as those are where users can store files. If you add up all the the numbers (except /sdcard) you’ll find out how much total built-in storage you actually have on your tablet. For example, my tablet shows /nand is 1422144 K but if I add up all the internal storage it totals 1992976 K (or 1.9 GB).
MEMORY INFO
Code:
#cat /proc/meminfo
“MemTotal” = physical memory minus whatever is being shared with devices (such as the radio, DMA buffers, etc), so it will always be less than the advertised RAM for your tablet.
“MemFree” = whatever is not being used at all. This number will vary depending on what apps and services are running.
“Cached” = typically around 20 MB, that’s just how it is.
“SwapCached” = will always read zero. Android doesn’t actually use this apparently.
Note: I couldn’t get any of the usual Linux methods to find the actual physical RAM amount to work.
FILE SYSTEM SUPPORT
Code:
#cat /proc/filesystems
Will show you what file system support was rolled into the kernel. So if you connect a drive that is formatted in something odd you can see if it’s even possible for your tablet to read it.
KERNEL MODULES
Code:
#cat /proc/modules
or
#lsmod
Shows you a list of the modules baked into the kernel. If you can’t get your tablet to recognize something this may help you determine if it is even supported.
FIRMWARE VERSION
Code:
#cat /proc/version
Will show you the Linux kernel version (not particularly useful), but the number after the “#” sign will be the firmware build and it will also show you the full date of the build (useful since some firmware is referred to by the date rather than the build number).
LOTS OF DATA
Code:
#dmesg
Gives you a major info-dump on your tablet. Sorting through it (if you know how to read it) will be info on memory, networking, and of particular interest to some people the MAC address of the tablet.
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. Interestingly enough the “Menu Key > System > About Phone > Status > Up time” on my phone does not match “uptime” typed in the terminal emulator.
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.
Search the internet for what some of the other busybox commands do by just searching for something like “linux df”.
If there are other good commands of interest post them here and I’ll add them to this. Searching the internet will show you others as well.
You also can put a /? after the command so ls /? will display options. ls -l will do a long list vs the list short view
—
rild
resize2fs_recvy
bluetoothd
reboot
radiooptions
awb_camera
ping
netsharing
racoon
applypatch
pppd
netcfg
aparse
mtpd
mediaserver
akmd
mscompress
logwrapper
monitorMTD
logcat
mmclient
newfs_msdos
linker
mmcamera_test
iptables
mke2fs_recvy
ip
wipe
id
insmod
date
smd
lsc_camera
watchprops
installd
top
getevent
netstat
wpa_supplicant
keystore
vmstat
dmesg
umount
mkdir
hciattach
dumpcrash
notify
start
wlan_loader
keypress
sleep
gzip
rmmod
printenv
vold
pm
setprop
htclogkernel
dvz
renice
hd
ls
udhcpd
mount
fsck_msdos
lsmod
dumpsys
monkey
route
toolbox
chmod
fbtool
dumpstate
schedtop
system_server
getprop
ps
sendevent
df
stop
flash_image
ioctl
e2fsck_recvy
dhcpcd
svc
su
input
wifitools
dumplayer
surfaceflinger
ime
chown
rmdir
dexopt
sound
rm
vptest
setconsole
iftop
debuggerd
mv
debug_tool
cmp
uevent
kill
snd
ln
log
bugreport
cat
dbus-daemon
sync
spkamp
dd
sh
ifconfig
dalvikvm
btipsd_cli
snd8k
servicemanager
btipsd
cam_ins_spmo
shutdown
service
app_process
bootcomplete
setmic
sdptool
bootanimation
am
ser2net
bmgr
schedtest
rsync
Download Android terminal emulator –> https://market.android.com/details?id=jackpal.androidterm
*) http://androidforums.com/droid-all-things-root/44647-using-terminal.html
http://www.droidforums.net/forum/droid-hacks/26036-linux-commands-android.html



























Komentar mereka!