안드로이드 envsetup.sh 파일을 참고하여 작성된 function.
아래 파일을 sh 파일로 저장후 cygwin 이나 Linux 환경에서 동작.
". filename.sh" 실행후, functionName string 으로 사용.
function jgrep()
{
find . -name .repo -prune -o -name .git -prune -o -type f -name "*\.java" -print0 | xargs -0 grep --color -n "$@"
}
function cgrep()
{
find . -name .repo -prune -o -name .git -prune -o -type f \( -name '*.c' -o -name '*.cc' -o -name '*.cpp' -o -name '*.h' \) -print0 | xargs -0 grep --color -n "$@"
}
function resgrep()
{
for dir in `find . -name .repo -prune -o -name .git -prune -o -name res -type d`; do find $dir -type f -name '*\.xml' -print0 | xargs -0 grep --color -n "$@"; done;
}
function mangrep()
{
find . -name .repo -prune -o -name .git -prune -o -path ./out -prune -o -type f -name 'AndroidManifest.xml' -print0 | xargs -0 grep --color -n "$@"
}
function sepgrep()
{
find . -name .repo -prune -o -name .git -prune -o -path ./out -prune -o -name sepolicy -type d -print0 | xargs -0 grep --color -n -r --exclude-dir=\.git "$@"
}
function allgrep()
{
find . -name .repo -prune -o -name .git -prune -o -type f \( -name '*.java' -o -name 'AndroidManifest.xml' -o -name '*.xml' -o -name '*.c' -o -name '*.cc' -o -name '*.cpp' -o -name '*.h' \) -print0 | xargs -0 grep --color -n "$@"
}
2014년 8월 27일 수요일
2014년 7월 9일 수요일
Windows + gvim + ctags + cscope + taglist
- gvim 명령어
vimrc 파일 링크
https://drive.google.com/file/d/0B8GbcWIV_h-OOC1ndXBZZVRhX2s/edit?usp=sharing
> 커서 이동
k 커서를 위로 움직임
j 커서를 아래로 움직임
h 커서를 왼쪽으로 움직임
l 커서를 오른쪽으로 움직임
- 커서를 줄의 처음으로 옮김
e, E 다음단어의 끝으로, 문자단위
이동
w, W 다음단어의 처음으로, 문자단위
이동
$ 줄의 마지막으로
0 줄의 처음으로
^ 줄의 처음으로(공백이
아닌 처음시작되는 문자)
Shift+g 문서의
마지막으로 이동한다.
gg,
1g 문서의 처음으로 이동한다.
1대신 다른 숫자를 입력하면 해당 숫자의 라인으로 이동한다.
), ( 다음, 이전 문장의 처음으로
}, { 다음, 이전문단의 처음으로
]],
[[ 다음, 이전
구절의 처음으로
> 화면 스크롤
^F 한 화면 을 앞으로 스크롤
^B 한 화면 을 뒤로 스크롤
^D 반 화면 을 앞으로 스크롤
^U 반 화면 을 뒤로 스크롤
^E 한줄 앞으로 스크롤
^Y 한줄 뒤로 스크롤
Shift + h 화면의
맨 윗줄로
Shift + m 화면의
중간줄로
Shift + l 화면의
맨 아랫줄로
> 입력
i 현재위치에서 삽입
I 현재줄의 처음위치에서 삽입
a 현재위치에서 한칸앞으로 이동해서 삽입
A 현재줄의 마지막위치에서 삽입
o 새로운 줄을 커서 아래에 연다
O 새로운 줄을 커서 위연다
s 현재 위치의 문자를 지우고 입력모드로 들어간다.
S 현재위치의 라인을 지우고 입력모드로 들어간다.
> 편집
y 한줄 복사
yn 현재 라인에서부터 n라인만큼을
복사
p 복사된 내용 붙이기
dd 한줄삭제
dw 한단어 삭제
Shift+d, d$ 현재커서
위치에서 마지막까지 삭제
Shift+j 현재
행의 개행문자를 제거한다. 즉 아래라인을 현재라인에 덧붙인다.
> 블록
v 단어단위로 블럭지정이 가능하다.
블럭범위는 이동명령인 'hjkl' 로 원하는 범위 만큼 지정할수 있다.
Shift+v 라인단위
블럭지정이다. 라인전체가 선택되며, 위아래 이동명령 'hj' 으로 범위 지정이 가능하다.
Ctrl+v 블럭단위
블럭지정이다. 4각형의 블럭지정이 가능하며 이동명령인 'hjkl' 로
원하는 범위를 지정할수 있다.
> 파일 처리
:e
[filename] filename 으로 파일열기
:q,
:q!, :wq 종료,
강제종료, 저장후 종료
:w,
:w [filename] 현재파일명으로 저장, filename 로 저장
:<범위>w
[filename] 지정한 범위만 다른 파일로 저장
:e
[filename] filename 을 편집하기 위해서 연다
ZZ 지금파일을 저장하고 vim 을
종료한다.
:f 현재 작업중인 파일의 이름과,
라인수를 출력한다
- ctags
압축파일
다운
환경변수
설정
1. tags 파일을 만들기
우선 소스에서 Makefile 확인하여 tags 타겟이 있는지 확인. 있다면 그걸 활용.
# make tags
없다면, 해당 프로젝트 폴더에서 아래 명령을 batch로 만들거나 직접 실행.
ex) ctags.bat
:: for windows
ctags -R .
2. vim 설정
tags 파일이 있는 경로를 설정합니다.
# vi ~/.vimrc
""""""""""""""""""""""""""""""""""""""""""""""""
" ctags 연결
""""""""""""""""""""""""""""""""""""""""""""""""
"set tags+=D:\tags
set tags+=D:\Source\tags
경로 추가시 반드시 /tags 까지 포함해야 함. 절대경로로 작성.
CTRL+ ] (go) , CTRL+T (back)
3. 명령어
1. tags 파일을 만들기
우선 소스에서 Makefile 확인하여 tags 타겟이 있는지 확인. 있다면 그걸 활용.
# make tags
없다면, 해당 프로젝트 폴더에서 아래 명령을 batch로 만들거나 직접 실행.
ex) ctags.bat
:: for windows
ctags -R .
2. vim 설정
tags 파일이 있는 경로를 설정합니다.
# vi ~/.vimrc
""""""""""""""""""""""""""""""""""""""""""""""""
" ctags 연결
""""""""""""""""""""""""""""""""""""""""""""""""
"set tags+=D:\tags
set tags+=D:\Source\tags
경로 추가시 반드시 /tags 까지 포함해야 함. 절대경로로 작성.
CTRL+ ] (go) , CTRL+T (back)
3. 명령어
gvim
–t keyword, 또는 :ta keyword
:ta
keyword keyword와 일치하는 태그 위치로 이동
:ta
/keyword keyword가 포함된 태그 검색
:tj keyword
keyword와 일치하는 태그 목록을 출력하고 선택하여 이동 (일치하는 태그가 한개일 경우
바로 이동)
Ctrl
+ ] 커서가 위치한 keyword의 정의 부분으로 이동
Ctrl
+ t, Ctrl + o 이전 위치로 이동
:tn 다음
태그로 이동
:tp 이전
태그로 이동
:tags
이동한 태그 히스토리 목록 출력
1.cscope 생성
cscope.bat
::#!bin/sh
::rm -rf cscope.files cscope.files
::find . \(-name '*.c' -o -name '*.cpp' -o -name '*.cc' -o -name '*.h' -o -name '*.s' -o -name '*.S' -o -name '*.java' \) -print > cscope.files
::cscope -i cscope.files
:: for windows
rm -rf cscope.files cscope.files
dir /B /S *.c *.cpp *h *.s *.S *.java -print > cscope.files
cscope -b -q -k
리눅스에서는 cscope.sh파일을 실행권한을 부여한다음 /usr/bin 에 복사하면 편리하게 사용 할 수 있다.
2. vim 설정
""""""""""""""""""""""""""""""""""""""""""""""""
" cscope 연결
""""""""""""""""""""""""""""""""""""""""""""""""
"source $VIMRUNTIME/plugin/cscope_maps.vim
"cs add D:\cscope.out
cs add D:\Source\cscope.out
3. 명령어
:cs find [질의방법][심볼이름]
ex) :cs find s task_struct
질의종류
0 or s - > Find this C symbol
1 or g - > Find this definition
2 or d - > Find functions called by this function
3 or c - > Find functions calling this function
4 or t - > Find assignments to
6 or e - > Find this egrep pattern
7 or f - > Find this File-TagList
1. 설치
태그리스트는 vim 플러그인으로 현재 작업 파일의 심볼을 나열하는 기능.
http://vim-taglist.sourceforge.net/
plugin 폴더에 저장.
2. 명령어
:Tlist 실행
창 전환 ctrl+ww
[gVim plugin 설정]
https://www.facebook.com/vim.kr/posts/1421915028024646:0
위 내용 참고하면 됨.
단, 아래 설정시 Windows 에 administaror 계정만 있는 경우 아래 예시처럼 변경 필요.
적당한 위치에 git 으로 받을 폴더 위치 생성.
> git clone https://github.com/gmarik/vundle.git .vim/bundle/vundle.vim
_vimrc 에도 동일한 경로로 지정.
set rtp+=C:\.vim\bundle\vundle.vim
_vimrc 참고
set rtp+=C:\.vim\bundle\vundle.vim
call vundle#begin()
"let Vundle manage Vundle, required
Plugin 'VundleVim/Vundle.vim'
"추가하고 싶은 플러그인을 아래에 나열
Plugin 'bling/vim-airline'
Plugin 'vim-airline/vim-airline-themes'
Plugin 'altercation/vim-colors-solarized'
Bundle 'tpope/vim-fugitive'
Bundle 'Lokaltog/vim-easymotion'
Bundle 'rstacruz/sparkup', {'rtp': 'vim/'}
Bundle 'tpope/vim-rails.git'
Plugin 'scrooloose/nerdtree'
Plugin 'airblade/vim-gitgutter'
Plugin 'scrooloose/syntastic'
Plugin 'ctrlpvim/ctrlp.vim'
Plugin 'nanotech/jellybeans.vim'
Plugin 'kchmck/vim-coffee-script'
call vundle#end()
"plugin 설치 이후
color jellybeans
syntax enable "문법 강조
set wmnu "
set nu "라인 표시
set noswapfile "백업 파일 취소
if has("gui_running") "gvim만 적용
set guifont=D2Coding:h12
set background=dark
colorscheme solarized
set guioptions-=m "메뉴 삭제
set guioptions-=T "툴바 삭제
set guioptions-=r "스크롤 삭제
endif
Linux 명령어, 팁 등등
1. ls
2. 속성 변경
chmod -R 777
3. 복사/삭제
cp /Source/*.* /Destination/
- 파일 찾아 열기
find .-name 'xxx.txt' -exec vim {} \;
find . -name "*.*" | xargs grep -n --color=auto "string" 2> /dev/null
- 특정 폴더 삭제(하위포함)
find . -name .git | xargs rm -rf
- 파일 개수
find . -type f | wc -l
zz. etc
which gcc : gcc 설치 위치
pwd : 현재 위치
scp
deb install
sudo dpkg -i xxx.deb
sudo apt-get remove xxx
rpm install
rpm -ivh --force --nodeps xxx.rpm
symbolic link
sudo ln -s /opt/eclipse/eclipse /usr/bin
log redirect
> : 표준출력을 새로운 파일로
>& : 표준출력,에러를 새로운 파일에
./start.sh >& 1.log
touch
find -type f -exec touch {} +
find -type f -name "*.txt" -exec touch {} +
find . -type d -exec chmod 777 {} \
encoding
file -i xxx.file
iconv -f ISO-8859-1 -t UTF-8//TRANSLIT xxx.file -o xxx.file
lib check
ldd process_name
vim shortcut key
http://seungdols.tistory.com/537
$ bash -xv filesize.sh
ls –d */ - 디렉토리만 출력,
보기좋게
2. 속성 변경
chmod -R 777
3. 복사/삭제
cp /Source/*.* /Destination/
cp -rp
/Source/
/Destination/
4. 찾기
find . -name “*.c”
find . -name “*.c” | xargs touch
/ : 루트부터 검색
. : 현재기준 하위포함 검색
/디렉토리명 : 디렉토리명
검색
- 폴더 찾기
find . -name 'xxx*' -type d (현재 기준 하위 폴더)
find / -name 'xxx*' -type d (root 기준)
- 폴더 찾기
find . -name 'xxx*' -type d (현재 기준 하위 폴더)
find / -name 'xxx*' -type d (root 기준)
- 현재 디렉토리 내 확장자가
txt인 파일들을 중에서 "홍길동"이라는
문자열을 갖고 있는 파일의 한 줄과 이름을 보여준다.
find . -name "*.txt" |
xargs grep 홍길동
- 이 때 검색어로 사용된 문자열은 색을 달리하여 표시하고
싶다면
find . -name "*.txt" | xargs
grep --color=auto 홍길동
- 검색어의 위치(줄번호)를 같이 표기하고 싶다면
find . -name "*.txt" | xargs grep -n 홍길동
find . -name "*.txt" | xargs grep -n 홍길동
- 대소문자를 구분하고 싶지 않다면
find . -name "*.txt" | xargs
grep -i LgMobile
- 현재 디렉토리 내 확장자가
txt인 파일들을 중에서 "홍길동"이라는
문자열을 갖고 있는 파일의 이름만 보고 싶다면
find . -name "*.txt" | xargs
grep -l 홍길동
- 검색 결과에 다음과 같은 메시지가 포함된다면
grep: [특정경로]: No
such file or directory
2>/dev/null 을 추가하면 해당 메시지를 표시하지
않고 찾은 결과만 볼 수 있다. 즉,
find . | xargs
grep 2>/dev/null 홍길동
- 모든 옵션은 함께 사용 가능하다.
find . -name "*.txt"
| xargs grep --color=auto -n 2>/dev/null 홍길동- 파일 찾아 열기
find .-name 'xxx.txt' -exec vim {} \;
find . -name "*.*" | xargs grep -n --color=auto "string" 2> /dev/null
- 특정 폴더 삭제(하위포함)
find . -name .git | xargs rm -rf
- 파일 개수
find . -type f | wc -l
5. 하드디스크 용량 확인
df -h : file system
du -hs * : 현재폴더에 있는 폴더 및 파일 용량 확인
du -hs 폴더이름 : 해당 폴더 용량 확인
du -hsx * | sort -rh | head -n 10 : 현재폴더에 있는 폴더 및 파일 중에서 용량이 큰 것 순으로 10개 보기
6. Screen
screen -S 111 (create)
screen -list
ctrl + a + d (detach)
screen -x 111 (재접속)
exit (종료)
7.network
ifconfig eth1 xxx.xxx.xxx.xxx : ip setting
ifconfig eth1 down
ifconfig eth1 up
route add default gw 192.168.10.1 (http 안될때)
vi /etc/resolv.conf 에도 dns 추가 168.126.63.1
8. symbolic link
sudo ln -s /opt/eclipse/eclipse /usr/bin
9. serial com
dmesg | grep tty
sudo minicom -b 115200 -D /dev/ttyUSB3
10. 압축 관련
tar 압축
tar -cvzf name.tar 경로(파일 or 폴더) ex> tar -cvf abc.tar def
tar 해제
tar -xvf name.tar
tar.gz 압축
tar -zcvf name.tar.gz 경로
permission 없는 파일 무시하기
tar -zcvf name.tar.gz 파일 --ignore-failed-read
tar.gz 해제
tar -zxvf name.tar.gz
-C 옵션 이용하여 압축 풀 경로 지정
tar -zxvf name.tar.gz -C path
tgz 압축 풀기
tar -zxvf name.tgz
option value
-x : 묶음을 해제
-c : 파일을 묶음(압축이 아님)
-v : 과정을 화면에 표시
-f : 파일 이름 지정
-p : 권한을 원본과 동일하게 유지
-C : 경로 지정
-z : gzip 으로 압축/해제
zip 압축
zip -rF name.zip folder or file
r : recursive
F : 한글 이름 파일 포함 압축
zip 해제
unzip name.zip -d 경로
11. systemd
systemctl start xxx
systemctl stop xxx
systemctl status xxx -l(로그확인)
journalctl -u xxx | cut -d ' ' -f 6- | more
12. process
pgrep tms-manager
pidof tms-manager
kill -INT id
killall -9 tms-manager
13. gdb
gdb
gdb process_name
run
falut <- 발생
bt
killall -9 gdb
du -hs * : 현재폴더에 있는 폴더 및 파일 용량 확인
du -hs 폴더이름 : 해당 폴더 용량 확인
du -hsx * | sort -rh | head -n 10 : 현재폴더에 있는 폴더 및 파일 중에서 용량이 큰 것 순으로 10개 보기
6. Screen
screen -S 111 (create)
screen -list
ctrl + a + d (detach)
screen -x 111 (재접속)
exit (종료)
7.network
ifconfig eth1 xxx.xxx.xxx.xxx : ip setting
ifconfig eth1 down
ifconfig eth1 up
route add default gw 192.168.10.1 (http 안될때)
vi /etc/resolv.conf 에도 dns 추가 168.126.63.1
8. symbolic link
sudo ln -s /opt/eclipse/eclipse /usr/bin
9. serial com
dmesg | grep tty
sudo minicom -b 115200 -D /dev/ttyUSB3
10. 압축 관련
tar 압축
tar -cvzf name.tar 경로(파일 or 폴더) ex> tar -cvf abc.tar def
tar 해제
tar -xvf name.tar
tar.gz 압축
tar -zcvf name.tar.gz 경로
permission 없는 파일 무시하기
tar -zcvf name.tar.gz 파일 --ignore-failed-read
tar.gz 해제
tar -zxvf name.tar.gz
-C 옵션 이용하여 압축 풀 경로 지정
tar -zxvf name.tar.gz -C path
tgz 압축 풀기
tar -zxvf name.tgz
option value
-x : 묶음을 해제
-c : 파일을 묶음(압축이 아님)
-v : 과정을 화면에 표시
-f : 파일 이름 지정
-p : 권한을 원본과 동일하게 유지
-C : 경로 지정
-z : gzip 으로 압축/해제
zip 압축
zip -rF name.zip folder or file
r : recursive
F : 한글 이름 파일 포함 압축
zip 해제
unzip name.zip -d 경로
11. systemd
systemctl start xxx
systemctl stop xxx
systemctl status xxx -l(로그확인)
journalctl -u xxx | cut -d ' ' -f 6- | more
12. process
pgrep tms-manager
pidof tms-manager
kill -INT id
killall -9 tms-manager
13. gdb
gdb
gdb process_name
run
falut <- 발생
bt
killall -9 gdb
zz. etc
which gcc : gcc 설치 위치
pwd : 현재 위치
scp
scp xxx.txt id@192.168.10.241:/app/hmiapp/ : 보내기
scp -r id@192.168.10.241:/app/hmiapp/ /xxx/ : 가져오기
deb install
sudo dpkg -i xxx.deb
sudo apt-get remove xxx
rpm install
rpm -ivh --force --nodeps xxx.rpm
symbolic link
sudo ln -s /opt/eclipse/eclipse /usr/bin
log redirect
> : 표준출력을 새로운 파일로
>& : 표준출력,에러를 새로운 파일에
./start.sh >& 1.log
touch
find -type f -exec touch {} +
find -type f -name "*.txt" -exec touch {} +
find . -type d -exec chmod 777 {} \
encoding
file -i xxx.file
iconv -f ISO-8859-1 -t UTF-8//TRANSLIT xxx.file -o xxx.file
lib check
ldd process_name
vim shortcut key
http://seungdols.tistory.com/537
bash shell
-xv 옵션을 주면서 실행하면 디버깅 모드로 출력된다.
피드 구독하기:
글 (Atom)
안드로이드(Android) 16 소개
안드로이드 16이 드디어 출시되었어요! 🎉 이번 포스팅에서는 안드로이드 16의 다양한 기능과 장점에 대해 자세히 알아보도록 할게요. 1. 안드로이드 16 소개 안드로이드 16은 구글의 모바일 운영 체제인 안드로이드의 최신 버전으로, 많은 ...

-
메모리 사용량 알기 1 - heap Runtime runtime = Runtime. getRuntime (); long maxMemory = runtime.maxMemory(); long totalMemory = runtim...
-
https://developer.android.com/reference/androidx/recyclerview/widget/ListAdapter # 안드로이드 ListAdapter 사용하기: 효율적인 RecyclerView 업데이트 안드로이드 개발에서...
-
국민연금 수령나이에 대해 알아볼께요. 국민연금은 우리나라에서 가장 중요한 사회보장 제도 중 하나로, 노후에 필요한 생활비를 지원해주는 역할을 해요. 많은 분들이 국민연금을 어떻게 수령할 수 있는지, 그리고 수령나이는 언제부터인지 궁금해 하실 텐데요...