Posted by JinnyDown
,

'<취미> > ___음악' 카테고리의 다른 글

P.O.D. - Youth Of The Nation  (0) 2013.04.08
Stone Sour - Absolute Zero  (0) 2013.04.08
MICHAEL SCHENKER GROUP - ARMED AND READY 1980  (0) 2013.04.08
Volbeat - 7 Shots Ft. Mille Petrozza & Michael Denner  (0) 2013.04.08
Symphony X - Heretic  (0) 2013.04.08
Posted by JinnyDown
,

'<취미> > ___음악' 카테고리의 다른 글

Stone Sour - Absolute Zero  (0) 2013.04.08
Volbeat - A Warrior's Call Lyrics  (0) 2013.04.08
Volbeat - 7 Shots Ft. Mille Petrozza & Michael Denner  (0) 2013.04.08
Symphony X - Heretic  (0) 2013.04.08
무료 음악 스트리밍 서비스  (0) 2013.03.27
Posted by JinnyDown
,

'<취미> > ___음악' 카테고리의 다른 글

Volbeat - A Warrior's Call Lyrics  (0) 2013.04.08
MICHAEL SCHENKER GROUP - ARMED AND READY 1980  (0) 2013.04.08
Symphony X - Heretic  (0) 2013.04.08
무료 음악 스트리밍 서비스  (0) 2013.03.27
소셜 음악 서비스 소개  (0) 2010.11.18
Posted by JinnyDown
,
Posted by JinnyDown
,

sudo adduser givenname.family –force-badname

또는 

sudo adduser username


관리자 권한 추가

sudo gpasswd -a username admin


adduser와 useradd는 다르다. 차이점은 까먹음. 인터넷 뒤지면 나오겠지


'<프로그래밍> > ___Unix/Linux' 카테고리의 다른 글

diff와 patch  (0) 2013.05.02
Head, Tail  (0) 2013.05.02
find 명령어 옵션과 사용  (0) 2013.04.03
ctags cscope 설정  (0) 2013.03.28
vim에서 redo undo  (0) 2013.03.21
Posted by JinnyDown
,

[옵션]

-atime n

파일이 n일 전에 마지막으로 접근되었으면 참 

-ctime n

파일이 n일 전에 생성되었을 경우 참 

-exec commmand 

command 실행 

-mtime n 

파일이 n일 전에 마지막으로 변경되었을 경우 참 

-name pattern 

파일명이 pattern에  대응될 경우 참

-print 

검색된 파일의 이름들을 출력 

-type [c] 

파일의 타입이 [c] 

[c] d: 디렉토리, f: 파일, l: 링크

-user name 

소유자가 name일 경우 참 


출처: 초보자를 위한 UNIX


[사용 예]

AND 조건

find . -name "찾는파일명*" | xargs grep '찾는 문자열1'  |  grep '찾는 문자열2'

 

OR 조건

find . -name "찾는파일명*" | xargs grep '찾는 문자열1'  OR  grep '찾는 문자열2'

find . | xargs egrep 'aaa|ddd'  (AIX)

find . | xargs grep 'aaa\|ddd' (Linux)


출처:http://blog.naver.com/dodo7777?Redirect=Log&logNo=90040225445


find 의 -perm 옵션은 보통 3가지 mode 를 사용합니다.

-perm mode

-perm -mode

-perm /mode


 mode 는 정확하게 mode 가 매치되는 것만

-mode 는 mode 를 포함하고, 추가적인 퍼미션이 있는 것만

/mode 는 mode 에서 한개 bit라도 매치되는 것이 있으면


아래의 예들을 실행해 보시면 이해에 도움이 되실 겁니다.

하나의 임시 디렉토리 속에 아래 명령으로 모든 가능한 퍼미션을 만들고 테스트 해보세요.

for i in $(seq 0 7); do for j in $(seq 0 7); do for k in $(seq 0 7); do  touch ${i}${j}${k}; chmod ${i}${j}${k} ${i}${j}${k}; done; done; done


아래는 서로 결과가 같고, 퍼미션이 0700인 것만 찾습니다.

find . -perm u rwx

find . -perm u=rwx

find . -perm 0700

find . -perm 700


아래는 서로 결과가 같고, 퍼미션이 0020인 것만 찾습니다.

find . -perm g w

find . -perm g=w

find . -perm 0020

find . -perm 020

find . -perm 20

 

아래는 서로 결과가 같고, 퍼미션이 0500 보다 더 많이 허용된 것을 찾습니다.

find . -perm -u rx

find . -perm -u=rx

find . -perm -0500

find . -perm -500


아래는 서로 결과가 같고, 퍼미션 0771 의 각 권한(rwxrwxrwx) 중 한 개 이상의 권한이 같은 것을 찾습니다.

find . -perm /u rwx,g rwx,o x

find . -perm /u=rwx,g=rwx,o=x

find . -perm /u=rwx,g=rwx,o x

find . -perm /0771

find . -perm /771


아래와 같이 !을 붙일 때 찾을 수 있는 퍼미션의 예상은

find . ! -perm /u rwx,g rwx,o x -ls

-------rw-

--------w-

----------

-------r--

입니다.


참조하세요 ^^


추가질문에 대한 답변

 -perm -2 -o -perm -20 

-o 는 or 의 의미입니다.

-perm -2 또는 -perm -20 입니다.

other 가 writable 이상이거나 또는 group 이 writable 이상인 것을 의미합니다.

즉, other 또는 group 에 실행권한이 있는 파일을 의미합니다.

같은 의미지만 반대로 이야기 하면, 실행권한이 user 에게만 있거나 아예 없는 파일을 제외한 파일을 의미합니다.

 

만약,

find ../ ! -user mylin \( -perm 2 -o -perm -20 \) -exec {} \; 이라면

상위 디렉토리의 하위로 소유자가 user가 아니고 other나 group 에 실행권한이 있는 파일을 찾아서 실행한다

는 의미가 됩니다.

해당 글은 지식스폰서가 활동 기간 (04년~08년 6월 종료)중에 작성한 글 입니다.

지식스폰서가 작성한 답변은 본문 내 자기소개 및 출처란의 실명, 상호명, URL표시를 허용합니다.

출처란에 표시된 정보가 지식iN 운영원칙에 위배되는 음란성, 불법성, 청소년 유해사이트 등으로 변질된 경우는 허용이 되지 않습니다.

*.sh 파일에서 choosecombo 문자열 찾기

find -name '*.sh' -print | xargs grep 'choosecombo' $1

다양한 파일 찾기 옵션

-name

-user

-group


-perm

퍼미션으로 찾기

ex) find -perm 777 

맨뒤에 -ls


 -size n  or -size -nc 

파일 크기로 찾기

ex) find -size -100

ex) find -size  1000c

 

같은 옵션 중복 사용가능


ex)find -size  50 -size -100


2>/dev/null/

권한없는 것들 출력안하기


[출처] 리눅스 파일 찾기 옵션2(유용한 옵션 편)|작성자 polpoipol

'<프로그래밍> > ___Unix/Linux' 카테고리의 다른 글

Head, Tail  (0) 2013.05.02
user 추가  (0) 2013.04.05
ctags cscope 설정  (0) 2013.03.28
vim에서 redo undo  (0) 2013.03.21
삼바 클라이언트  (0) 2013.03.11
Posted by JinnyDown
,

http://tksssch29.tistory.com/search/selinux


http://www.centos.org/docs/5/html/Deployment_Guide-en-US/index.html


http://www.linuxtopia.org/online_books/getting_started_with_SELinux/


http://www.linuxtopia.org/online_books/writing_SELinux_policy_guide/index.html


http://selinuxproject.org/page/Main_Page


http://www.freetechbooks.com/the-selinux-notebook-the-foundations-t785.html


https://access.redhat.com/site/documentation/en-US/Red_Hat_Enterprise_Linux/6/html/Security-Enhanced_Linux/

좋다!!

Posted by JinnyDown
,

  • sudo vim /etc/udev/rules.d/70-android.rules
  • 다음을 입력
    • SUBSYSTEMS==“usb”, ATTRS{idVendor}==“1004”, ATTRS{idProduct}==“61fc”, MODE=“0666”
    • (idVendor와 idProduct는 lsusb 명령어로 확인할 수 있음)
  • sudo chmod a r /etc/udev/rules.d/70-android.rules
  • usb 뺐다 꼽고, adb devices 치면 인식됨이 보인다

'<프로그래밍> > ___Android' 카테고리의 다른 글

git diff를 patch하기  (0) 2013.10.21
git commit 취소 방법  (0) 2013.10.02
git untracked file 제거  (0) 2013.02.26
우분투에 Eclipse Helios 설치  (0) 2013.02.22
해외폰 APN 세팅 (해외폰 국내에서 사용하기)  (0) 2013.02.22
Posted by JinnyDown
,

1. 필요 tools: vim, ctags, cscope

2. 손볼 files: ~/.vimrc, ~/.vim/plugin/cscope_maps.vim(이건 web에서 download), /usr/bin/mkcscope.sh

2. 설치: (sudo) apt-get install vim, ctags, cscope(또는 (sudo) yum install vim, ctags, cscope)

3. setup

 3.1. ctags setup

       source code가 있는 project folder로 이동하여 다음의 command 입력

       -> ctags *(현재 directory의 모든 소스의 tags 정보 만들기)

       -> ctags -R(현재 directory의 하위 모든 소스에 대해 tags 정보 만들기. 두번째 것만 해 줘도 될 것 같다.)

       .vimrc 파일에 tags 설정

       -> vi ~/.vimrc

       -> 'set tags=SOURCE_DIR/tags' 입력, wirte&quit

 3.2. cscope setup

       /usr/bin director 밑에 mkcscope.sh파일을 만든다.('chmod 755 mkcscope.sh'로 permission change)

       mkcscope.sh 파일에 아래 내용 추가

       =============== mkcscope.sh script ================

       #!/bin/sh

       rm -rf cscope.out cscope.files

       find ./ -name '*.c' -o -name '*.cpp' -o -name '*.cc' -o -name '*.h' -o -name '*.s' -o -name '*.S' > cscope.files

       cscope -i cscope.fils

       ===================================================

       위 script는 간단하게 현재 하위 파일의 모든 파일 중에서 *.c, *.cpp, *.cc, *.h, *.s, *.S 등 cscope로 분석 가능한

       소스 파일들을 찾아서 cscope.files라는 list 파일을 만든 후에 cscope -i cscope.files를 실행해서 cscope.out database를

       생성하는 script이다.

       -> cd SOURCE_DIR

       -> mkcscope.sh

       Database 파일(cscope.out) build가 끝나면 Ctrl d 키로 빠져나옴.

 3.3. vim setup

       ~/.vimrc file에 아래 set values 추가

       ================== cscope setting ==================

       set csprg=/usr/bin/cscope

       set csto=0

       set cst

       set nocsverb

       if filereadable("./cscope.out")

       cs add cscope.out

       else

       cs add SOURCE_DIR/cscope.out

       endif

       set csverb

       =====================================================

설정 끝.

4. Usage

 4.1. vim 실행 후 source 내에서 symbol 찾기

      - 찾으려고 하는 symbol위에서 'Ctrl \,s'(Ctrl 역슬레쉬 입력하고 그냥 s)를 입력하면 symbol로 빠르게 이동하거나 리스트가 보여짐. 

      - 리스트가 보여질 경우 number key로 선택

      - Ctrl t 하면 이전 line으로 back

      - Symbol 위에서 'Ctrl-spacebar s'하면 vim 창을 분활하여 symbol로 이동(입력기에서 'Ctrl space'가 입력 모드 전환으로 설정되어 있으면 

      - 당연히 안되고 한글을 쓰려고 하니, 입력기에서 'Ctrl space'를 삭제. 한글키가 먹어줌으로 필요 없음)

 4.2. vim command line에서 찾기 명령어

      - cscope 명령어 사용(or cs로 typing)

         ex) :cs(cope) f(ind) [querytype] STRING

               * querytype

                  s: symbol

                  g: definition

                  d: function called by this function

                  c: function calling this function

                   t: text

                   f: this file

                   i: include file

      - cscope 명령 대신 scscope(or scs)를 사용하면 가로로 창이 분할되어 symbole을 찾음.

[출처] ctags, cscope 설치 및 사용법|작성자 노랑무우


===================================================================

vimrc 설정

===================================================================

"cscope 설정

set csto=0

set cst

set nocsverb

if filereadable("./cscope.out")

 cs add cscope.out

else 

 cs add /usr/src/linux/cscope.out

endif

set csverb


"tag list

"set tags =/work/android/tags

set tagbsearch

===================================================================

'<프로그래밍> > ___Unix/Linux' 카테고리의 다른 글

user 추가  (0) 2013.04.05
find 명령어 옵션과 사용  (0) 2013.04.03
vim에서 redo undo  (0) 2013.03.21
삼바 클라이언트  (0) 2013.03.11
삼바 사용자 등록  (0) 2013.03.11
Posted by JinnyDown
,

http://grooveshark.com

Posted by JinnyDown
,

redo: ctrl + r

undo: u

'<프로그래밍> > ___Unix/Linux' 카테고리의 다른 글

find 명령어 옵션과 사용  (0) 2013.04.03
ctags cscope 설정  (0) 2013.03.28
삼바 클라이언트  (0) 2013.03.11
삼바 사용자 등록  (0) 2013.03.11
vim replace  (0) 2013.03.11
Posted by JinnyDown
,

* smbclient //ip/jinnydown


* 서비스 확인

   # smbclient -L //ip -I ip -U smbuser


* 접속

   # smbclient //ip/public -I ip -U smbuser

'<프로그래밍> > ___Unix/Linux' 카테고리의 다른 글

ctags cscope 설정  (0) 2013.03.28
vim에서 redo undo  (0) 2013.03.21
삼바 사용자 등록  (0) 2013.03.11
vim replace  (0) 2013.03.11
nfs 설정  (0) 2013.03.05
Posted by JinnyDown
,

$ sudo smbpasswd -a userID (ex. sudo smbpasswd -a jinnydown)

'<프로그래밍> > ___Unix/Linux' 카테고리의 다른 글

vim에서 redo undo  (0) 2013.03.21
삼바 클라이언트  (0) 2013.03.11
vim replace  (0) 2013.03.11
nfs 설정  (0) 2013.03.05
cpu 개수 구하기  (0) 2013.03.05
Posted by JinnyDown
,

:%s/old/new/g


%s: substitute

g globally (파일 전체에서)


출처: http://overegoz.tistory.com/659

'<프로그래밍> > ___Unix/Linux' 카테고리의 다른 글

삼바 클라이언트  (0) 2013.03.11
삼바 사용자 등록  (0) 2013.03.11
nfs 설정  (0) 2013.03.05
cpu 개수 구하기  (0) 2013.03.05
오픈소스 프로젝트에 참여하기위한 diff와 patch 사용법  (0) 2013.03.05
Posted by JinnyDown
,

  • Host PC
  •     * sudo vim /etc/exports
    
          * /nfs_dir *(rw,no_root_squash,no_all_squash,async)
    
        * sudo exportfs -r
    
        * sudo /etc/init.d/nfs-kernel-server restart
    
        * 
  • Remote PC (또는 target board)
  • * sudo mkdir ~/host_pc * sudo mount -t nfs -o nolock,rsize=1024,wsize=1024 <Host PC IP>:/nfs_dir ~/host_pc

'<프로그래밍> > ___Unix/Linux' 카테고리의 다른 글

삼바 사용자 등록  (0) 2013.03.11
vim replace  (0) 2013.03.11
cpu 개수 구하기  (0) 2013.03.05
오픈소스 프로젝트에 참여하기위한 diff와 patch 사용법  (0) 2013.03.05
비교  (0) 2013.03.05
Posted by JinnyDown
,

I. /proc/cpuinfo, /proc/stat, sysconf()

1. cat /proc/cpuinfo
/proc/cpuinfo marks down the details of each logical cpu (e.g. cpu core or hyper-thread if hyper-thread is enabled).

By counting the number of lines which contain "processor", we can get the number of logical cpu:
cat /proc/cpuinfo | grep "processor" | wc -l

Any logical cpu shares the same Physical ID is in the same cpu socket, so we can get the number of physical cpu by counting the number of physical id which are unique:
cat /proc/cpuinfo | grep "physical id" | sort | uniq | wc -l

For the same physical cpu, the number of cores equals to the number of logical cpus if hyperthread is not enabled; If two logical cpus share the same core id, hyper-thread is enabled.
This is how to get the number of cores in each physical cpu:
cat /proc/cpuinfo | grep "cpu cores" | wc -l

This is how to get the number of logical cpus in each physical cpu:
cat /proc/cpuinfo | grep "siblings"


2. cat /proc/stat
/proc/stat gives the performance of each logical cpu (Not sure about this). We can get the number by counting the lines of "cpu[0-9]":
cat /proc/stat | grep "^cpu[0-9]" | wc -l


3. Programming in C: sysconf() 
Examples of getting number of processors:

#include <unistd.h>
long num_processor_configured = sysconf (_SC_NPROCESSORS_CONF); => list the number of processors configured
long num_processor_available = sysconf(_SC_NPROCESSORS_ONLN);   => list the number of processors currently online

sysconf() is a function from glibc providing values of a configurable system. It is said that sysconf(_SC_NPROCESSORS_ONLN) gets the number of processors available by counting the lines in /proc/stat.


Example 1 (6 cores, 1 cpu socket):

[root@localhost ~]# cat /proc/cpuinfo
processor       : 0
model name      : Six-Core AMD Opteron(tm) Processor 8431
physical id     : 0
core id         : 0
cpu cores       : 6

processor       : 1
model name      : Six-Core AMD Opteron(tm) Processor 8431
physical id     : 0
core id         : 1
cpu cores       : 6

processor       : 2
model name      : Six-Core AMD Opteron(tm) Processor 8431
physical id     : 0
core id         : 2
cpu cores       : 6

processor       : 3
model name      : Six-Core AMD Opteron(tm) Processor 8431
physical id     : 0
core id         : 3
cpu cores       : 6

processor       : 4
model name      : Six-Core AMD Opteron(tm) Processor 8431
physical id     : 0
core id         : 4
cpu cores       : 6

processor       : 5
model name      : Six-Core AMD Opteron(tm) Processor 8431
physical id     : 0
core id         : 5
cpu cores       : 6

[root@localhost ~]# cat /proc/stat
cpu  4162865 54802 17262096 2509381549 1710104 218653 187057 0
cpu0 697349 7150 2995004 418253009 209167 6 3501 0
cpu1 627300 4797 2856686 418320595 316591 8692 27166 0
cpu2 823480 6976 2878035 418024209 346533 49309 34083 0
cpu3 642511 6386 2882030 418295657 230548 52706 52881 0
cpu4 583546 10618 2829846 418364092 288908 49996 37702 0
cpu5 788677 18871 2820493 418123985 318355 57942 31722 0


printf("%ld\n", sysconf (_SC_NPROCESSORS_CONF)); => 6  
printf("%ld\n", sysconf(_SC_NPROCESSORS_ONLN));  => 6


Example 2 (2 cpu sockets, 2 cores for each cpu socket):

linux-q55j:/home/cat # cat /proc/cpuinfo
processor       : 0
model name      : Intel(R) Xeon(R) CPU           E5502  @ 1.87GHz
physical id     : 0
core id         : 0
cpu cores       : 2

processor       : 1
model name      : Intel(R) Xeon(R) CPU           E5502  @ 1.87GHz
physical id     : 0
core id         : 2
cpu cores       : 2

processor       : 2
model name      : Intel(R) Xeon(R) CPU           E5502  @ 1.87GHz
physical id     : 1
core id         : 0
cpu cores       : 2

processor       : 3
model name      : Intel(R) Xeon(R) CPU           E5502  @ 1.87GHz
physical id     : 1
core id         : 2
cpu cores       : 2

linux-q55j:/home/cat # cat /proc/stat
cpu  597925 23710 191645 443151716 77080 2412 10769 0
cpu0 251568 8192 71852 110625120 54392 107 2444 0
cpu1 127831 7165 67476 110785569 18740 1994 5079 0
cpu2 115977 4925 17693 110872516 2652 2 87 0
cpu3 102548 3426 34623 110868509 1294 308 3158 0

printf("%ld\n", sysconf (_SC_NPROCESSORS_CONF)); => 4
printf("%ld\n", sysconf(_SC_NPROCESSORS_ONLN));  => 4

 

II. dmidecode
dmidecode collects information from System BIOS based on the SMBIOS/DMI standard, e.g. processor, memory. It is kind of decode of DMI.

This is how to get the information of CPU using dmidecode:
dmidecode -t processor

A simple explanation of DMI and SMBIO.

              -------
              | DMI |
              -------
                   /\
                   ||
                   \/
   --------------------
    |SMBIOS Extensions|
   --------------------
   --------------------
    | Motherboard BIOS |
   --------------------

SMBIOS: System Management BIOS
DMI: Desktop Management Interface


출처: http://heidydogdog.appspot.com/?p=105001

'<프로그래밍> > ___Unix/Linux' 카테고리의 다른 글

vim replace  (0) 2013.03.11
nfs 설정  (0) 2013.03.05
오픈소스 프로젝트에 참여하기위한 diff와 patch 사용법  (0) 2013.03.05
비교  (0) 2013.03.05
vim 다중 창. 창 분할  (0) 2013.02.26
Posted by JinnyDown
,

diff -urN chiki-2.0.orig chikichiki-2.0 > chikichiki.diff

'<프로그래밍> > ___Unix/Linux' 카테고리의 다른 글

nfs 설정  (0) 2013.03.05
cpu 개수 구하기  (0) 2013.03.05
비교  (0) 2013.03.05
vim 다중 창. 창 분할  (0) 2013.02.26
vim 설정 참고  (0) 2011.03.28
Posted by JinnyDown
,

diff - 서로 다른 두파일이나 폴더에 대한 비교할때 쓰는 명령어
location /usr/bin/diff
# diff [option] file1 file2
 diff [option] dir1 dir2
 
option
- c : 차이점 비교
- d : 상세 비교
- l : 주로 폴더에 사용하며, 서브디렉까지 상세 비교
diff3 => 3개의 파일 비교 시 사용
 
cmp - 두개의 파일을 비교하여 다른점을 확인 할 때 쓰는 명령어
# cmp [option] file1 file2
option
- l : 틀린 문자의 개수를 출력하고 각각의 틀린 문자에 대한 8진수 값을 출력
- s : 아무런 메시지를 보여주지 않고 종료 코드만을 넘겨줌
종료코드에서 0은 파일이 같음을 1은 파일이 다를 때 2는 파일에 접근할 수 없을때를 의미
 
comm - 두 파일의 행 단위를 비교할때 사용
# comm [option] file1 file2
option
-1 : 두개를 비교하되 파일 1에만 있는 것은 출력하지 않기
-2 : 두개를 비교하되 파일 2에만 있는 것은 출력하지 않기 
-3 : 두개를 비교하여 파일1과 파일2에 모두 존재하는 라인은 출력하지 않기

출처: http://blog.naver.com/songbongsang?Redirect=Log&logNo=100099157657

Posted by JinnyDown
,

git clean –f –d

Posted by JinnyDown
,