< Vi editor 명령어 >
편집모드 (i,o 등로 입력할 수 있는 상태) |
명령 모드(편집모드에서 esc key를 누른상태) |
기 타 | |||||||||||
A 현재라인의 끝부터 문자 삽입 a 커서 다음부터 문자 삽입 I 현재라인의 처음부터 문자 삽입 i 커서 이전부터 문자 삽입 O 커서의 윗라인에 새로운 라인첨가 (처음부터 문자 삽입) o 커서의 아래 라인에 새로운 라인첨가 (처음부터 문자 삽입)
r 커서위치의 한문자 치환 R 커서위치에서부터 계속 치환 cw 한 단어 치환 C 한 라인 치환 c$ 현재부터 라인끝까지 치환 cG 현재부터 파일끝까지 치환 cL 현재부터 화면 끝까지 치환 c) 현재 구 치환 c} 현재 절 치환 ~ 소문자와 대문자 서로 치환 xp 두 문자 자리바꿈
n>> n(숫자)만큼 이동
CTRL + I tab 입력 CTRL + p 최근 사용명령어 출력 CTRL + u 커서 윗라인 지우기 CTRL + y 커서 윗라인 문자를 한자씩 복사 CTRL + e 커서 아래라인 문자를 한자씩 복사 CTRL + w 커서이전 문자 워드 단위로 삭제 CTRL + m 한줄 띄우기 CTRL + n 최근에 사용한 명령어(라인) 출력 |
j(아래), k(위), h(왼쪽), l(오른쪽) 이동 최근에는 방향키로 이동가능 ^ 현재행의 시작위치로 이동 $ 현재행의 끝으로 이동 + 커서의 다음행 처음으로 이동 - 커서의 윗행 처음으로 이동 ( 커서의 이전구로 이동 ) 커서의 다음구로 이동 { 커서의 이전절로 이동 } 커서의 다음절로 이동
SHIFT + g 파일의 끝으로 이동 SHIFT + h 현재 화면의 처음으로 이동 SHIFT + m 현재 화면의 중간으로 이동 SHIFT + l 현재 화면의 끝으로 이동 (L) CTRL + d 반화면 아래로 이동 CTRL + u 반화면 위로 이동 CTRL + f 한화면 아래로 이동 CTRL + b 한화면 위로 이동
x 커서의 다음방향 한문자 삭제 X 커서의 이전방향 한문자 삭제 dw 커서의 다음방향으로 한단어 삭제 dW 커서의 이전방향으로 한단어 삭제 dd 한 라인 삭제 d0 커서위치부터 라인의 시작까지 삭제 d$ 커서위치부터 라인의 끝까지 삭제 dG 커서위치부터 파일의 끝까지 삭제 dL 커서위치부터 화면 끝까지 삭제 nD 커서위치부터 n(숫자) 라인만큼 삭제 d) 현재구 삭제 d} 현재절 삭제
yw 커서위치의 한단어 복사 yy 커서위치의 한 라인 복사 y$ 현재부터 라인 끝까지 복사 yL 현재부터 화면 끝까지 복사 yG 현재부터 파일 끝까지 복사 y) 구 복사 y} 절 복사 P 커서 이전열에 삽입 (INSERT) p 커서 다음열에 삽입 (INSERT) |
/검색할문자열 아래로 검색 ?검색할문자열 위로 검색 n 다음 일치하는 문장으로 이동(아래) N 다음 일치하는 문장으로 이동(위로)
:w 파일저장 :w 파일명 지정한 파일명으로 파일저장 :wq! 파일 저정하고 나가기 :q 파일 나가기(변경 안했을 경우) :q! 무조건 저장안하고 나가기
:f 파일정보 출력 :nu 현재 라인정보 출력 :!(cmd) shell명령 실행 :set nu 라인 NUMBER 출력 :set nonu 라인 NUMBER 감추기
|
'개발/활용정보 > Linux' 카테고리의 다른 글
git 사용법 (0) | 2013.07.29 |
---|---|
ubuntu 12.04 함글 (0) | 2013.04.08 |
grep 사용법] 리눅스/유닉스/Cygwin 문자열 찾기 find 명령 (0) | 2012.01.10 |
bootchart (0) | 2011.12.29 |
Shell Script (0) | 2011.12.29 |
http://forum.xda-developers.com/showthread.php?t=622666
Hi!
Note:
Sorry this posting got very long. But it will tell you how to configure Android's internal taskkiller which may help getting your hero really speedy again.. Without using any taskkiller.
Here the long story:
I just was curious if already someone tried to play around with Android's internal low-memory task killer.
We all know that Android uses a different way of handling processes. Instead of killing every process after its Activity ended, processes are kept until the system needs more memory. These processes usually should not harm the overall performance and should give speed improvements if you start an Activity again. That's the idea.
But when does Android kill a process? And which process? As far as I understood android keeps a LRU (last recently used) list and starts killing the oldest unneeded process. This way it is much smarter than any of the taskkillers we see in the Market.
Just for curiosity I started to investigate how this mechanism works. Please correct me if you think that I got something wrong:
What I found out:
ActivityManagerService.java tracks the "importance" of processes (is foreground, is running a service, ..) and reflects this importance by setting the "oom_adj" value of the process.
(For info: "oom_adj" is a value of every process under Linux which gives the kernel a hint, which process it can kill in an oom [out of memory] situation. You can see this value on every Linux 2.6 system in the proc directory: /proc/[PID]/oom_adj ). The higher this value is set, the more likely this process gets selected by the kernel's oom killer.)
It seems that on Android the current forefround application gets an oom_adj value of 0 and as soon it's not visible anymore it gets some higher value. I assume the concrete value is dependent by the processes' place in the LRU list.
The out-of-memory killer in the standard Linux kernel only runs in one situation: when the available memory is critical low. However in the Android Linux kernel there is implemented a more fine-grained handling of low memory situations.
I found the kernel source file "lowmemorykiller.c" (located in the kernel source tree under "drivers/misc/"; or look here for GIT source tree: http://tinyurl.com/lowmemkiller).
This module seems to be more configurable than the kernel's standard out-of-memory killer as you can define more than one memory limit, when it should get active and you can tell it which oom_adj values it may kill.
In other words:
You can say "if free memory goes below XXXX then kill some process with oom_adj greater then YYY; if free memory goes even more below than ZZZ then start to kill some processes with oom_adj greater than XYXY. and so on.."
So it's possible to define multiple memory criterias and matching processes which can be killed in these situations. Android seems to group running processes into 6 different categories (comments taken out of "ActivityManagerServer.java"):
FOREGROUND_APP:
// This is the process running the current foreground app. We'd really
// rather not kill it! Value set in system/rootdir/init.rc on startup.
VISIBLE_APP:
// This is a process only hosting activities that are visible to the
// user, so we'd prefer they don't disappear. Value set in
// system/rootdir/init.rc on startup.
SECONDARY_SERVER:
// This is a process holding a secondary server -- killing it will not
// have much of an impact as far as the user is concerned. Value set in
// system/rootdir/init.rc on startup.
HIDDEN_APP:
// This is a process only hosting activities that are not visible,
// so it can be killed without any disruption. Value set in
// system/rootdir/init.rc on startup.
CONTENT_PROVIDER:
// This is a process with a content provider that does not have any clients
// attached to it. If it did have any clients, its adjustment would be the
// one for the highest-priority of those processes.
EMPTY_APP:
// This is a process without anything currently running in it. Definitely
// the first to go! Value set in system/rootdir/init.rc on startup.
// This value is initalized in the constructor, careful when refering to
// this static variable externally.
These 6 categories are reflected by 6 memory limits which are configured for the lowmemorykiller in the kernel.
Fortunately, it is possible to configure the lowmemorykiller at runtime!
(But only if you are root). The configuration is set in the file: "/sys/module/lowmemorykiller/parameters/minfree"
So if you want to see the current settings, you can do:
# cat /sys/module/lowmemorykiller/parameters/minfree
This should produce output like this (or similiar):
1536,2048,4096,5120,5632,6144
These values are the 6 memory limits on which Anedroid starts to kill processes of one of the 6 categories above. Be careful, the units of these values are pages!! 1 page = 4 kilobyte.
So the example above says that Anddroid starts killing EMPTY_APP processes if available memory goes below 24MB (=6144*4/1024). And it starts to kill unused CONTENT_PROVIDERs if available memory goes below 22MB (=5632*4/1024).
So if you want to try if your Hero goes faster when fewer processes are running you can try to adjust these settings. For example if you practically do not want any empty processes you can set the corresponding value very high. For example, you can set the values like this:
# echo "1536,2048,4096,5120,15360,23040" > /sys/module/lowmemorykiller/parameters/minfree
This example will tell Android to kill unused Content providers if less then 60MB is available and kill empty processes if available memory goes below 90MB.
All other processes will stay untouched! Do you see the advantage compared to process killers?
One word about durabilty:
If you change the settings like this, they are NOT PERMANENT. They will be gone after the next restart of your phone. So you can try to play around a little bit. Please share your results if you find some improvements!
To make this settings survive also reboots you need to somehow set this at startup. I am running Modaco's custom rom and added the command to the startup script /system/init.d/ramzswap.sh, but there may be other ways to do this.
Currently I also disabled compcache on my Hero and set the lowmemkiller very aggressive, as it seems to me that this makes my hero very responsive.
So these are my (current) settings:
echo "1536,3072,4096,21000,23000,25000" > /sys/module/lowmemorykiller/parameters/minfree
(and compcache disabled)
But play around.. I am glad about any feedback.
Please also give feedback if I am wrong or missed something!
'Android 개발' 카테고리의 다른 글
android version (0) | 2012.06.28 |
---|---|
garbage collection (0) | 2012.03.15 |
android porting on real target (0) | 2011.12.27 |
android dumpsys 정리 (0) | 2011.11.18 |
[Linux][Android] Analyzing Memory Usage. (0) | 2011.11.15 |
grep 의 주요한 옵션과 사용법 예제
grep [옵션] <찾을문자열> [찾기 대상이 될 파일명]
이런 식으로 옵션과 문자열을 지정합니다. (주의! 옵션은 대소문자를 엄격히 구분합니다.)
가령
grep 맹구 *
라고 하면, 현재 디렉토리(폴더)의 모든 파일들 중에서, "맹구"라는 문자열이 들어 있는 파일을 찾아서 그 문자열이 들어 있는 행을 화면에 출력합니다.
grep -n 맹구 *
이렇게 하면 그 행의 행번호까지 출력
grep -n 맹구 *.txt
.txt 라는 확장자를 가진 파일만을 대상으로 찾기
grep -v 맹구 *
모든 파일에서 "맹구"라는 문자열이 없는 행만을 출력
grep -i foo *
대소문자 구분없이, foo Foo FOO fOO 등의 문자열 찾기
grep -r foo *
서브디렉토리까지 foo 라는 문자열 찾기
grep -i -r foo *
대소문자 구분없이, 그리고 하위디렉토리까지, foo 라는 문자열 찾기
등등입니다.
grep 으로 문자열을 찾으면, 그 결과가 화면으로 출력되는데, 그냥 눈으로 보는 것에 그치는 것이 아니라, 재지향(Redirection)을 사용하여 결과를 다시 파일로 저장한 후 다른 작업에 사용하는 것이 보통입니다.
예를 들어
grep -n 맹구 *.txt
라는 명령의 출력 결과를 out.txt 라는 파일로 저장하려면
grep -n 맹구 *.txt > out.txt
이렇게 하면 됩니다.
▶▶ [grep] 여러 단어 동시에 찾기, 복수 문자열 검색 - Multiple Strings
▶▶ grep 명령] 찾은 문자열/단어 개수 출력, 행의 개수 출력: Count of String, Linux Unix
▶▶ [grep.exe] 유닉스/리눅스의 grep 을 윈도우에서 사용하기: 문자열 찾기
▶▶ grep] 이진파일/NULL포함 TEXT찾기 옵션; Binary File Grep
☞ 리눅스
'개발/활용정보 > Linux' 카테고리의 다른 글
ubuntu 12.04 함글 (0) | 2013.04.08 |
---|---|
vi editor 명령어 (0) | 2012.02.06 |
bootchart (0) | 2011.12.29 |
Shell Script (0) | 2011.12.29 |
리눅스 명령어 목록 (0) | 2011.10.10 |