본문 바로가기

Programming/Linux Tip

proc/meminfo 분석하기 와 pagecache size limitation(restrict) 하는 방법 1. meminfo 분석하기 전반적인 내용 : https://ssambback.tistory.com/entry/Linux-Memory%EC%9D%98-%EC%83%81%ED%83%9C%EB%A5%BC-%EB%B6%84%EC%84%9D%ED%95%98%EB%9D%BC Linux Memory의 상태를 분석하라 리눅스의 메모리 사용량의 경우 항상 물리적인 메모리 대비 Cache 와 Buffer의 사용량에 대해서 논쟁이도고는 한다. 물론 운영중에 갑자기 물리적인 메모리의 사용량이 늘어서 SWAP을 사용하는 경우라면 달라지겠.. ssambback.tistory.com 정보는 최고사용량과 최저사용량으로 표현되며, 먼저 최고사용량에 대해 살펴보면 다음과 같다. - MemoryTotal : 사용 가능한 최대 메모리(R.. 더보기
find and grep on linux shell Sometimes, we want to perform 'grep' command among results of 'find' command.I'll introduce how can we do this easier. The way is very simple - magic keyword is "--include=" Example, below command find "PAGE" word among the files what has ".dts" string in file name. grep -snra --include="*.dts*" "PAGE" 더보기
shell terminal 이 종료되어도 계속해서 작업 수행되도록 하기 원문 : http://dreamlog.tistory.com/470build 같이 시간이 걸리는 작업을 걸어놓으면, windows pc 를 off 할 수 없어서 곤란한 상황이 생길때가 있다. 혹은 실수로 터미널을 종료할 때도 있다. 아래와 같이 screen 을 사용하면 그런 우려를 덜 수 있다. 자세한 설명은 위 원문에 잘 설명되어 있고, 사용법만을 보관을 위해 적어 둔다. . screen 사용법screen 만들기.$ screen -S build1 screen 목록 보기.$ screen -listThere is a screen on: 3703.build1(2015년 11월 11일 01시 43분 38초)(Attached) 1 Socket in /var/run/screen/S-hyunmu. 사용 예)$ scr.. 더보기
patch 적용하기, diff, sdiff 원문 : https://blog.naver.com/zeta0807/220943464598 1. diff --brief간략한 폴더비교를 할 일이 자주 있다. 아래와 같이 사용하면 된다.diff --brief -r folder1/ folder2/아래 site를 참조하였으며 엄청난 option들이 있다. http://stackoverflow.com/questions/4997693/given-two-directory-trees-how-can-i-find-out-which-files-differ You said Linux, so you luck out (at least it should be available, not sure when it was added): diff --brief -r dir1/ dir2/ .. 더보기
MBR 혹은 partition table dump 명령어, device node 로 부터 ufs, emmc dump dd if=/dev/block/vold/disk:8,0 of=/data/local/tmp/mbr-dump bs=512 count=1 dd if=/dev/block/vold/disk:179,64 of=/data/local/tmp/mbr-dump bs=512 count=1 dd if=/dev/block/vold/disk:179,0 of=/data/local/tmp/dump bs=512 count=1 - usb storage low image 위치 /dev/block/vold/disk:8,0 혹은 /dev/block/sda => dump 뜨면 MBR 부터 떠짐 /dev/block/sda1 => dump 뜨면 partition 부터 떠짐 /data/local/tmp/mbr-dump dd if=/dev/block.. 더보기
loop device and losetup 원문 : https://cafe.naver.com/taskers/10933 loop는 이미지파일을 블록 디바이스로 인식되게 해주는 디바이스 드라이버입니다.즉, 이미지 파일을 마운트 시켜줍니다. 쉽게 말해서 윈도우즈의 데몬툴이나 시디스페이스 같은 것이라 보면 됩니다.그러나 그 기능과 성능은 훨씬 강력합니다. 아래는 loop를 이용하여 100MB짜리 vfat 이미지를 마운트하는 예제입니다. 진행하려면 비지박스와 루팅은 필수입니다.터미널이나 ADB Shell에서 진행하세요. 1. 일단 dd를 이용해서 100메가짜리 공파일을 뜹니다. dd if=/dev/zero of=/mnt/sdcard/vdrive.img bs=1000000 count=100 dd : 덤프를 뜹니다. if=[덤프대상] of=[덤프결과]/dev.. 더보기
linux partitions (sda, sda1, sda2...) # cat partitions major minor #blocks name 1 0 8192 ram0 8 0 247087104 sda -> 디스크.. 보통 여기에 파티션을 만들지는 않는다. 8 1 204800 sda1 -> 실제 파티션 8 2 1048576 sda2 8 3 1048576 sda3 8 4 1048576 sda4 8 5 30720 sda5 8 6 102400 sda6 8 7 20480 sda7 8 8 30720 sda8 8 9 614400 sda9 8 10 17039360 sda10 8 11 225898444 sda11 8 16 4096 sdb 8 32 4096 sdc = 아래는 byte 단위 일듯 # cat size 494174208 # cat /sys/block/sda/sda1/start .. 더보기
Calculation real size from results of 'df' and 'stat' "df" show result based on KB unit."stat" using block unit that it can be get from "stat"'s result. # df -h /efsFilesystem Size Used Avail Use% Mounted on/dev/block/mmcblk0p16 12M 712K 11M 6% /efs # df /efsFilesystem 1K-blocks Used Available Use% Mounted on/dev/block/mmcblk0p16 12016 712 11304 6% /efs 1K-blocks : total block count12016(KB)/1024 = 11.734712(KB) # stat -f /efs File: "/efs" ID: d360.. 더보기
Can't access samba directory by windows after installing wine After installing wine, my samba shared directory of Ubuntu PC couldn't access by windows. Checking samba log $ cat /var/log/samba/log.no-onegun-lee06 #31 smbd(main+0x15b4) [0x7f9b7de9b6c4] #32 /lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xf5) [0x7f9b79fd6ec5] #33 smbd(+0x7a96) [0x7f9b7de9ba96][2017/03/04 14:01:46.815788, 0] ../source3/lib/util.c:801(smb_panic_s3) smb_panic(): calling panic.. 더보기
ps command PC meaning, ps 명령어 의미 root@graceqltevzw:/ # ps USER PID PPID VSIZE RSS WCHAN PC NAMEroot 1 0 5920 912 SyS_epoll_ 00004cfa20 S /initroot 2 0 0 0 kthreadd 0000000000 S kthreaddroot 3 2 0 0 smpboot_th 0000000000 S ksoftirqd/0root 4 2 0 0 worker_thr 0000000000 S kworker/0:0...root 645 1 4344 408 SyS_epoll_ 000044a668 S /sbin/healthdroot 647 1 6536 2080 SyS_epoll_ 7f952d2594 S /system/bin/lmkdsystem 648 1 7508 2548 binder.. 더보기
linux command tip - double redirection(꺽쇠) ">>" Normally, redirection ">" is used overwrite. = overwriteecho 11 > ./11.logcat ./11.log11echo 5 > ./11.logcat ./11.log5 If you use duoble redirection ">>", it works appending = appendecho 11 > ./11.logcat ./11.log11echo 5 >> ./11.logcat ./11.log115 더보기
The result of access(ls, cp) according parent directory permission | 상위 디렉토리의 권한에 따른 access(ls, cp) 결과 ./SE_API/1111 ls -al ./SE_API/1111-rwxr-xr-x parent directory user permission r(4) x(1) (0) status drwxr-xr-- 2 root root 4096 10월 26 18:15 . drwxrwxrwx 11 root root 4096 10월 27 13:25 .. -rwxr-xr-x 1 root root 5 10월 26 18:18 1111 drwxr-x--x 2 root root 4096 10월 26 18:15 . drwxrwxrwx 11 root root 4096 10월 27 13:09 .. -rwxr-xr-x 1 root root 5 10월 26 18:18 1111 drwxr-x--- 2 root root 4096 10월 26 18.. 더보기
block device 의 stat 정보 해석하기 cat /sys/block//stat 의 정보 Name units description ---- ----- ----------- read I/Os requests number of read I/Os processed read merges requests number of read I/Os merged with in-queue I/O read sectors sectors number of sectors read read ticks milliseconds total wait time for read requests write I/Os requests number of write I/Os processed write merges requests number of write I/Os merged with in-.. 더보기
hard link 와 symbol link (sym link) 의 차이점 기본 차이점을 잘 설명한 곳 :http://blog.naver.com/dorose2000/220575536780 만약 원본의 소유주나 권한이 바뀐다면?? $ echo 444 > 444.log$ sudo chown root:root ./444.log $ ls -altotal 20drwxrwxr-x 2 onegun onegun 4096 9월 12 16:02 .drwxrwxrwx 10 root root 4096 9월 12 15:59 ..-rw-rw-r-- 1 onegun onegun 4 9월 12 16:00 111.log-rw-rw-r-- 1 root root 4 9월 12 16:02 444.log-rw-rw-r-- 1 onegun onegun 4 9월 12 16:00 hardlnklrwxrwxrwx 1 on.. 더보기
xming dual(multiple) monitor setting "C:\Program Files (x86)\Xming\Xming.exe" :0 -clipboard -multiwindow -screen 0 @1 -dpi 96 -ac -lesspointer 간혹 창의 크기가 화면을 넘어가면-screen 0 1920x1080@1으로 셋팅을 바꾸었다가 다시 원복 (주 모니터 밖에 표시가 안됨) 더보기
xming 관련 tip 들 Xming 글씨 크기가 작을때http://blueedu.dothome.co.kr/xe/usefulinfo/21962 Xming 윈도우 창이 크기조절이 안되고 윈도우 단축키(win + 방향키)로 동작하게 하고 싶을때- 터미널 창에서 "gnome-wm &" 입력 후 이후에 linux 프로그램 실행함.=> 이 방법으로 실행하면 다른 program(gedit, meld) 등이 정상 동작까지 시간이 오래걸리는 side-effect 가 발생함.- "C:\Program Files (x86)\Xming\Xming.exe" :0 -clipboard -multiwindow -screen 0 1920x1080@1=> 위 옵션 추가해서 해결 더보기
linux 개발을 위한 source insight tab 설정하기 원문 : http://jaram.tistory.com/202 alt + t를 누름1. Tab width를 4 로 설정2. Expand tab을 enable로 설정3. Auto Indent는 취향에 맡게 simple에 체크 둘다 해주는거... tab --> space로 일괄 변경1. 소스 전체 선택2. alt+ e3. special --> tab --> space 누름 정해진 tab width만큼으로 모두 변경됨 내가 쓰는 simple 한 치환 방법 tab 을 복사한 후Ctrl+h 를 눌러서 치환 문자열에 복사한 tab 을 붙여넣기 하고대체 문자열에 스페이스 4번 입력후 all 더보기
터미널의 컬러 text 를 클립보드로 복사하기 아직 작성중... http://www.linuxquestions.org/questions/linux-desktop-74/preserve-colors-when-copy-pasting-from-terminal-943213/ -> perl 로 html 로 변환하는 해법http://stackoverflow.com/questions/245121/a-library-to-convert-ansi-escapes-terminal-formatting-color-codes-to-html http://stackoverflow.com/questions/5505515/how-do-i-embed-source-code-or-html-in-open-office-org-presentations-without-usin 더보기
ubuntu firefox 실행시 warning 해결 firefox 실행시 아래와 같은 warning 이 발생하면서 실행이 매우 느린 현상이 발생하였다. An error occurred while loading or saving configuration information for firefox. Some of your configuration settings may not work properly. 이 문제는 .debus 의 실행권한이 없어서 발생하는 이슈로써 다음과 같이 해결이 가능하다. https://bbs.archlinux.org/viewtopic.php?id=90671 I think I may have found a solution, can you print the output of ls -la ~/ | grep .dbusapparently thi.. 더보기
sudo -s / su 와의 차이점 sudo -s 계정은 그대로 user 계정인 상태에서 이후 실행되는 명령어 들만 root 권한으로 실행시킴 su계정이 root 로 변경됨 su 와 su - root(su -) 와의 차이점이 아래 설명되어 있지만 맞는지는 모르겠음.http://blog.naver.com/ooobba/70189243851 더보기
adb shell 기본 접속 권한 root 에서 shell 로 변경 방법 원본 : http://stackoverflow.com/questions/15336215/how-to-restart-adb-from-root-to-user-mode ~$ adb shell id uid=2000(shell) gid=2000(shell) ~$ adb root restarting adbd as root ~$ adb shell id uid=0(root) gid=0(root) ~$ adb shell 'setprop service.adb.root 0; setprop ctl.restart adbd' ~$ adb shell id uid=2000(shell) gid=2000(shell) 더보기
Ubuntu 원격제어 하기 $ sudo apt-get install xrdp$ sudo apt-get install gnome-panel$ echo "gnome-session --session=gnome-fallback" > ~/.xsession$ sudo /etc/init.d/xrdp restart 더보기
Terminal 에서 Home, End 키 숫자키(오른쪽) 동작 안할때 ... SecureCRT 를 사용하고 있는데 Home, End 키가 동작하지 않습니다. SecureCRT 에 검색결과 Linux 연결이면 XTerm mode 로 변경을 권장하네요.설정에 Terminal -> Emulation 에 가면 VT100 으로 default 설정되어 있는 mode 를 XTerm 으로 변경 가능합니다. https://s2-forums.vandyke.com/showthread.php?p=42242 https://s2-forums.vandyke.com/attachment.php?attachmentid=1056&d=1408632381 위와같이 셋팅하니, 일반적인 터미널 환경에서는 숫자키패드 입력이 잘 되는데,vi 를 실행하면 숫자키를 눌러도 영문자가 입력됩니다. vi내에서 home, end 키와.. 더보기
ubuntu / windows PC 와 android phone 간 file explorer 파일 관리 - QtADB Ubuntu / windows PC 와 Android 간에 adb interface 를 이용해서 파일을 탐색기 형태로 자유롭게 전송하는 프로그램이다.개발 및 test 에 아주 용이하다. 다운로드 경로https://qtadb.wordpress.com/download/ 아래 apk file 을 Android Phone 에 설치한 후 실행한다.이후 start service 버튼을 눌러준다.아래 프로그램을 Ubuntu 에서 실행 한후, 첫 화면에서 adb 가 설치되어 있는 path 의 경로를 지정해 준다. 이후 아래와 같이 창이 뜨면서 file 을 주고 받을 수 있다. 더보기
vi 에서 마우스 우클릭 / 클립보드 붙여넣기 안되는 문제 해결 문제 해결중임 클립보드를 적용하는지 확인하고 싶다면 vim 명령 :echo has(‘clipboard’) 를 실행해서 그 결과가 1이면 (혹은 0이 아닌 다른 값) 사용가능하고 0이면 되지 않는다. 위 실행결과가 0 임 또다른 팁 http://blog.nacyot.com/articles/2014-07-29-linux-terminal-and-copy-integration/ 더보기
Android platform open source 배포(공개) 사이트 정리 - samsung galaxy 시리즈의 platform 소스 코드 배포 사이트http://opensource.samsung.com/ 더보기
Program 실행시간(performance time) 측정 방법, IO time 계산 방법 time command #time ./mobibench -p ....#0m2.15s real 0m0.40s user 0m0.31s system 결과는 다음과 같이 해석real : 실제 program 동작 시간user : user area program 동작 시간system : kernel area program 동작 시간 IO time = real - (user + system) 더보기
e2fsprogs arm cross-compile for android e2fsprogs 의 filefrag Tool 을 arm 에서 사용하기 위해 build 시도. 0. 소스코드 다운로드 http://sourceforge.net/projects/e2fsprogs/?source=dlp 1. arm build toolchain 경로를 path 에 추가.이건 .configure 에서 CC 로 지정한 build tool 을 direct 로 호출해 버리기 때문임.export PATH=/home/onegun/2_hdisk/storage/utils_ubuntu/build_toolchains/MOST-build-toolchain/arm-2009q1/bin/:$PATH 2. ./configure 로 make 파일 생성./configure --target=arm-linux --host=ar.. 더보기
apt-get 이 꼬여서 동작하지 않을때 처리 방법 The following packages have unmet dependencies: sqlitebrowser:i386 apt-get 으로 패키지를 설치하거나 지우려고 할때 위와같은 오류만 계속 뜨며패키지 설치나 삭제가 안될때가 있다. apt-get -f dist-upgrade 이 명령어를 사용하면 깨끗하게 해결된다. 참조 : http://askubuntu.com/questions/261230/unmet-dependencies-linux-generic/261256 더보기
How to set cpu and bus frequency of galaxy S5 max install "No-frills cpu" on PlayStore (need root auth.) -> min / max clock -> 2.458 -> speed setting : performance = check max freqcat /sys/class/devfreq/qcom,cpubw.43/max_freq7102cat /sys/class/devfreq/fdb00000.qcom,kgsl-3d0/max_freq 578000000 = fix freqecho 7102 > /sys/class/devfreq/qcom,cpubw.43/min_freqecho 578000000 > /sys/class/devfreq/fdb00000.qcom,kgsl-3d0/min_freq = chec.. 더보기