Japan/테스트 업무

adb shell

군찐감자만두 2016. 5. 25. 07:33
728x90
반응형

http://zewtion.tistory.com/m/post/274


adb devices
:디바이스 검색


adb install -? APP설치파일.APK
: 어플을 설치한다
(명령어 사용안한다면 일반 설치한다)
-r 설치된 어플을 재 설치한다 단 데이터는 삭제되지 않는다.
-s 메모리카드에 설치한다.
* adb install c:\어플폴더\abcd.apk


adb uninstall -? 어플이설치된경로
: 어플을 삭제한다
(명령어 사용안한다면 모두 삭제한다)
-k 어플의 데이터는 삭제 하지 않는다.
* adb uninstall com.android.abcd


adb reboot
: 스마트폰을 재부팅 시킨다.


adb kill-server
: 문제 발생시 adb 종료


adb start-server
: 종료 시킨 adb 실행


adb pull 스마트폰경로 PC경로
: 스마트폰기기내에 파일이나 어플등을 본인의 PC로 복사한다
* adb pull /sdcard/abcd.apk c:\abcd

adb push PC경로 스마트폰경로
: PC의 파일이나 어플등을 스마트폰으로 복사한다
* adb push c:\abcd\abcd.apk /sdcard/

adb root
: 스마트폰에 root권한으로 접근한다.

adb shell
:연결된 스마트폰의 쉘을 연결한다
* adb -s emulator-디바이스번호 shell
퍼미션 부여 =adb chmod 777 경로
파일삭제 = adb shell rm 경로
폴더삭제 = adb shell -r 경로

아래는 shell 명령어 가져온글 입니다
시스템 기본정보: 하드웨어, 커널 등
cat /proc/version : 커널 버전
cat /proc/cpuinfo : 프로세서 정보, CPU타입, 모델 제조사 등
cat /porc/meminfo : 메모리 정보, 실제 메모리 및 가상 메모리
cat /proc/devices : 현재 커널에 설정되어 있는 장치 목록
mount : 마운트된 모든 장치 정보
df : 하드디스크 사용량
cat /porc/filesystems : 커널에 설정되어 있는 파일시스템 목록
cat /proc/swaps : 스왑 파티션의 크기와 사용량
cat /proc/interrupts : 장치가 사용중인 인터럽트(IRQ)목록 표시
cat /proc/ioports : 현재 사용중인 input/output 포트
cat /proc/partitions : 파티션 정보
cat /proc/uptime : 시스템이 얼마나 살아있었는지
cat /proc/stat : 시스템 상태에 관한 다양한 정보, CPU 사용 통계, 부팅이후 page fault 발생 횟수 등
cat /proc/zoneinfo : ZONEINFO
dmesg : 시스템 부팅시 나왔던 메시지
ps : 실행중인 프로세스 정보
ps -p - t : 프로세스와 쓰레드 목록
set or printenv : 환경설정값 출력


시스템 리소스 사용 현황
vmstat : 시스템 리소스 상황 모니터, CPU, I/O, Memory 등
cat /proc/diskstats : 디스크 utilization과 throughput. 즉 디스크 I/O현황
top : 시스템 프로세스 상황 모니터링/ 프로세스별 CPU사용량, 메모리와 스왑 사용량 등
procrank : 프로세스별 메모리
dumpsys meminfo [PID] : 해당 프로세스 메모리 상세 정보
cat /proc/[PID]/stat : 해당 프로세스에 대한 정보, 시작시간, 상태, CPU 사용량 등
cat /proc/[PID]/maps : 해당 프로세스의 메모리 맵 정보
cat /proc/vmstat : 버추얼 메모리 통계?
librank : 라이브러리별 메모리 사용량?


네트워크 관련
cat /proc/net/netlink : 네트워크 정보
netcfg : 네트워크 인터페이스와 IP주소 목록
netstat : 네트워크 연결상태 확인
nc : 네트워크용 cat 명령어(netcat)
ifconfig : 네트워크 인터페이스 설정 정보. 장치명을 파라미터로 받음. ip 주소. 서브넷마스크 등
tcpdump : 실시간 패킷 모니터링
iftop : 네트워크를 위한 top
route : 해당 호스트까지 연결하는 중간 경로 정보인 라우팅 테이블 표시
ping : 원격 호스트와의 연결 테스트
cat /proc/net/route : Route


안드로이드 제공
logcat : 로그캣 보기
pm : package manager의 약자. 패키지/permission/instrumentation/feature 목록, 패키지 설치/제거 등
am : activity manager의 약자, 액티비티 시작, Intent 브로드캐스팅, Instrumentation 시작, profiling 시작 / 중지 등
service : 안드로이드 서비스 목록 표시, 서비스에 명령 전달
monkey : 애플리케이션에 랜덤 이벤트 발생시킴. 사용자 이벤트, 시스템 이벤트의 무작위 발행
cat /data/anr/traces.txt : VM TRACES (쓰레드 덤프)
cat /proc/binder/proc/[PID] : 바인더 프로세스 상태
cat /proc/binder/xxx : 바인더 관련 정보(xxx은 transaction, transaction_log, failed_transaction_log, stats 등)
cat /data/system/packages.xml : 설치된 패키지 세팅 정보
setprop : system property 셋팅
getprop : 셋팅된 system property 목록 출력


종합 리포트
dumpsys [service] : app/service 상태정보 덤프, 서비스별로 추가 파라미터 받을 수 있음
dumpstate : device 상태정보 덤프. 상태정보를 추출하는 여러 명령어들의 조합으로 구성
dumpcrash : 애플리케이션이 crach될 때의 상태정보 덤프
bugreport : logcat + dumpsys + dumpstat



조금더 정보가 필요하신분들을 위한 정보 입니다.

ADB Shell Command - 15가지 팁

Basic Android Terminal and ADB Shell Command List
1. How to open a cmd in Android Phone
Method 1: “Start” ? “”Program”-” “Accessories” ? “” Command Prompt ”
Method 2: “Start” ? “” Run “, type cmd ENTER
2. How to restart Android Phone
When the phone and Computer is connected to the data cable, you can enter the following command
adb shell reboot === ENTER
3. Restart Android into Recovery Mode
With the data cable connected to your phone and computer, enter the following command

adb shell reboot recovery === ENTER
4. Convert back to ext2 partition
Restart the phone into Recovery mode, press “Alt + X” into the console. Open cmd and enter the following command

adb shell === ENTER
tune2fs-O ^ has_journal / dev/block/mmcblk0p2 === carriage return
e2fsck / dev/block/mmcblk0p2 === carriage return (optional, can be a problem area in section 2, when used)
5. Pulling applications from Android phone to computer
adb pull /system/sd/app app
adb pull /system/sd/app-private app-private
6. Pushing applications back to android phone from the computer
adb push app /system/sd/app
adb push app-private /system/sd/app-private
7. Delete existing apps on Android SD
adb shell rm -r /system/sd/app
adb shell rm -r /system/sd/app-private

8. Repair gravity System or switch to screen
Sometimes frequent brushing of phone can cause gravity system or switch to screen failure. Just follow the steps below-
Restart the phone into Recovery mode, press “Alt + X” into the console
Open cmd and enter the following command
mount / data === carriage return
rm / data / misc / akmd * / data / misc / rild * === ENTER
9. Ext2/ext3/ext4 formatted partition
Enter the following command in the cmd
adb remount === ENTER
adb shell === ENTER
rm-r / system / sd / * === carriage return

10. Remove/ system / app under the application
Under normal circumstances / system / app is not under an application. Use the following methods to remove these applications.
Open cmd and enter the following command

adb remount === ENTER
adb rm / system / app / Stocks.apk === Enter
11. If the start Time is too Long
Just enter the following command in order to view the boot process.
adb logcat === ENTER
12. Through Terminal Partition SD card
It will erase everything on your SD card
$ su
# cd /data
# wget http://64.105.21.209/bin/lib/droid/sdsplit
# chmod 555 sdsplit
# /data/sdsplit -fs *size* (add -nc to the end for JFv1.5ADP)
13. From the Recovery Screen, send an update file to your SD card.
adb shell mount /sdcard
adb shell rm /sdcard/update.zip
adb push *filename* /sdcard/update.zip
14. Restoring a nandroid backup via Fastboot
Start command-prompt/terminal cd to the nandroid folder and enter following commands
fastboot erase boot
fastboot erase recovery
fastboot flash system system.img
fastboot flash boot boot.img
fastboot flash userdata data.img
fastboot flash recovery recovery.img
fastboot reboot
15. Clear Search History in Android
Search History is accounted for Mobile Memory. It can also leak your privacy information as well. Just follow the steps below to clear android history.
Steps are as follows:
1. Make sure your mobile phone has Root authority.
2. Open the super-terminal.
3. Enter the following command
su
rm / data / data / com.android.vending / databases / suggestions.db
4. Exit Hyper Terminal and restart the phone.

728x90
반응형
그리드형