Linux2010. 3. 2. 18:29
alias make='make -j'
를 해놨는데

gmake는 symbolic link로 make로 되어있다.

하지만 alias 특성상, 명령줄 치환을 하기 때문에
입력 당시 gmake가 비록 링크 추적으로 인해서 make가 실행되겠지만,
그렇다고 해서 make가 make -j로 치환되지는 않는다.

2010/03/02 - [프로그램 사용/gcc] - make, gmake
2010/02/26 - [Linux] - make를 더욱 빠르게 하기!


Posted by 구차니
Linux2010. 2. 26. 20:55
find는 기본적으로 하위 디렉토리를 뒤지도록 되어있기 때문에
강제로 현재 디렉토리만 검색을 하기 위해서는 옵션을 해주어야 한다.

아쉽게도 non-recursive 이런 옵션은 없고
-maxdepth 숫자
라는 옵션이 존재한다.

예를 들어 현재 디렉토리에서 크기가 0인 파일을 찾기 위해서는
$ find ./ -maxdepth 1 -size 0c
이라고 하면된다.

find: warning: you have specified the -maxdepth option after a non-option argument -size, but options are not positional (-maxdepth affects tests specified before it as well as those specified after it).  Please specify options before other arguments.

maxdepth는 옵션이고
size는 옵션이 아니므로 순서를 반대로 하면 경고를 발생시킨다.



-maxdepth levels
    Descend at most levels (a non-negative integer) levels of directories below the command line arguments. '-maxdepth 0' means only apply the tests and actions to the command line arguments.

[링크 : http://linux.die.net/man/1/find]

[링크 : http://www.unix.com/unix-dummies-questions-answers/423-using-find-command-only-current-directory.html]
Posted by 구차니
Linux2010. 2. 26. 15:46
bash 에서 history 라고 입력하면
현재까지 입력했던 목록들이 나온다.

그 중에 원하는 번호를 실행하려면
!n
이라고 입력하면된다.

예를 들어 432번에 원하는 명령어가 있다면
!432 이라고 입력하면 된다.

[링크 : http://linux.die.net/man/1/bash]
[링크 : http://www.solanara.net/solanara/bash]
Posted by 구차니
Linux2010. 2. 23. 18:05
일반적으로 패치는 diff -urN 옵션으로 만드는데
-u는 Unified의 약자이다.

아무튼 대충
diff -urN linux-2.6.17.14_stm22_0039_STFAE_ORI/.config.old linux-2.6.17.14_stm22_0039_STFAE/.config.old
--- linux-2.6.17.14_stm22_0039_STFAE_ORI/.config.old    2007-11-29 16:36:18.000000000 +0900
+++ linux-2.6.17.14_stm22_0039_STFAE/.config.old        2009-05-27 15:27:09.000000000 +0900
@@ -1,7 +1,7 @@
 #
 # Automatically generated make config: don't edit
 # Linux kernel version: 2.6.17.14
-# Thu Nov 29 16:36:17 2007
+# Wed May 27 15:27:09 2009
 #
 CONFIG_SUPERH=y
 CONFIG_RWSEM_GENERIC_SPINLOCK=y
요런식으로 내용이 나오는데, 아래와 같은 의미이다.

비교된 파일은 --- linux-2.6.17.14_stm22_0039_STFAE_ORI/.config.old 파일로 부터 (원본)
+++ linux-2.6.17.14_stm22_0039_STFAE/.config.old 파일을 보고 작성되었으며 (수정본)

@@ -1,7 +1,7 @@
--- 파일의 1에서 7라인이 삭제되고  (~라인 까지가 아니다)
+++ 파일의 1에서 7라인이 추가된다. (~라인 까지가 아니다)
(7개 라인이라는데 8개 라인인 이유는, 추가/삭제된 표시 때문이다. 이를 제외하면 원래 길이인 7줄이 나온다)

삭제된 내용은 -# Thu Nov 29 16:36:17 2007
추가된 내용은 +# Wed May 27 15:27:09 2009
이다.

The unified output format starts with a two-line header, which looks like this:

--- from-file from-file-modification-time
+++ to-file to-file-modification-time

You can change the header's content with the `-L label' or `--label=label' option; see See section Showing Alternate File Names.

Next come one or more hunks of differences; each hunk shows one area where the files differ. Unified format hunks look like this:

@@ from-file-range to-file-range @@
 line-from-either-file
 line-from-either-file...

The lines common to both files begin with a space character. The lines that actually differ between the two files have one of the following indicator characters in the left column:

`+'    A line was added here to the first file.
`-'    A line was removed here from the first file.

[링크 : http://www.chemie.fu-berlin.de/chemnet/use/info/diff/diff_3.html]


2009/06/10 - [Linux] - diff 로 patch 파일 만들기

Posted by 구차니
Linux2010. 2. 23. 10:18
Posted by 구차니
Linux2010. 2. 22. 13:21
리다이렉션은, 데이터의 흐름(?)을 다른 곳으로 돌려주는 것을 의미한다.

일반적으로
fd = 0 은 stdin(입력)
fd = 1 은 stdout(표준출력)
fd = 2 는 stderr(표준에러출력)
으로 설정되는데, 이러한 출력을 다른 곳으로 돌려주는 역활을 한다.

예를들어,
에러만 파일에 저장하려면
make 2> err.log

일반메시지만 저장하려면
make > err.log

둘다 저장하려면
make > err.log 2>&1

으로 하면된다.

make 2>&1 err.log
라고 하면 에러가나니, 반드시 파일명과 함께 리다이렉션시킬 방향을 별도로 적어 주어야 한다.


REDIRECTION
       Before  a command is executed, its input and output may be redirected using a special notation interpreted by the
       shell.  Redirection may also be used to open and close files for the current shell  execution  environment.   The
       following  redirection  operators may precede or appear anywhere within a simple command or may follow a command.
       Redirections are processed in the order they appear, from left to right.

       In the following descriptions, if the file descriptor number is omitted, and the first character of the  redirec-
       tion  operator is <, the redirection refers to the standard input (file descriptor 0).  If the first character of
       the redirection operator is >, the redirection refers to the standard output (file descriptor 1).

       The word following the redirection operator in the following descriptions, unless otherwise noted,  is  subjected
       to  brace  expansion,  tilde  expansion,  parameter  expansion, command substitution, arithmetic expansion, quote
       removal, pathname expansion, and word splitting.  If it expands to more than one word, bash reports an error.

       Note that the order of redirections is significant.  For example, the command

              ls > dirlist 2>&1

       directs both standard output and standard error to the file dirlist, while the command

              ls 2>&1 > dirlist

       directs only the standard output to file dirlist, because the standard error was duplicated  as  standard  output
       before the standard output was redirected to dirlist.

[링크 : http://linux.die.net/man/1/bash]


'Linux' 카테고리의 다른 글

diff의 -u 옵션 출력 내용 읽기 how read diff unified format?  (0) 2010.02.23
configure 관련 문서 모음  (0) 2010.02.23
리눅스 드라이버 / 모듈  (0) 2010.02.19
bash shell - TMOUT 환경변수  (0) 2010.02.18
chmod(3)  (0) 2010.02.18
Posted by 구차니
Linux2010. 2. 19. 21:46
리눅스 모듈관련 명령어

모듈은 드라이버 이다.
랜카드 드라이버라던가, 사운드 카드, 그래픽 카드들은 모듈 형태로 일반적으로
리눅스 상에 탑재가 되는데, 이러한 것들의 목록은

lsmod 로 받아올 수 있다.
그리고 갱신시에는 modprobe를 하며, 이러한 의존성 정보는
/lib/modules/{'uname -r'}/modules.dep 파일로 저장되어 있다.

모듈을 삽입하거나 빼내는데에는 insmod / rmmod로 실행하며
일시적으로 모듈을 넣기 때문에 재부팅 시에는 삽입되지 않으므로 modules.dep에 넣어둬야 한다(확인필요)

모듈의 정보는
modinfo {모듈명}
으로 받아낼수 있으며
모듈의 버전 자체는 알아내기 힘든 것으로 보인다.(vermagic 에 커널 버전 정보는 존재한다)

[링크 : http://linux.die.net/man/8/modinfo]
[링크 : http://linux.die.net/man/8/modprobe]
[링크 : http://linux.die.net/man/8/lsmod]
[링크 : http://linux.die.net/man/8/insmod]
[링크 : http://linux.die.net/man/8/rmmod]
[링크 : http://linux.die.net/man/5/modules.dep]

'Linux' 카테고리의 다른 글

configure 관련 문서 모음  (0) 2010.02.23
bash 리다이렉션(redirection)  (0) 2010.02.22
bash shell - TMOUT 환경변수  (0) 2010.02.18
chmod(3)  (0) 2010.02.18
scp를 통한 대역폭 제한 복사(scp with bandwidth limit)  (2) 2010.02.16
Posted by 구차니
Linux2010. 2. 18. 22:19
리눅스 마스터 공부하다가 나온녀석으로,
일정시간이 흐른뒤 자동으로 로그아웃 시키는 데 사용하는 환경변수이다.
단위는 초단위이며, bash shell 에서 지원한다.

TMOUT

If set to a value greater than zero, TMOUT is treated as the default timeout for the read builtin. The select command terminates if input does not arrive after TMOUT seconds when input is coming from a terminal. In an interactive shell, the value is interpreted as the number of seconds to wait for input after issuing the primary prompt. Bash terminates after waiting for that number of seconds if input does not arrive.


[링크 : http://linux.die.net/man/1/bash]


'Linux' 카테고리의 다른 글

bash 리다이렉션(redirection)  (0) 2010.02.22
리눅스 드라이버 / 모듈  (0) 2010.02.19
chmod(3)  (0) 2010.02.18
scp를 통한 대역폭 제한 복사(scp with bandwidth limit)  (2) 2010.02.16
Xwindow 해상도 설정하기  (0) 2010.02.16
Posted by 구차니
Linux2010. 2. 18. 10:30
리눅스 마스터 시험 공부를 하다가
잘 쓰지 않는 녀석중 하나인 Set UID, Set GID 그리고 sticky bit에 대한 문제가 있었다.

flag octal value purpose
S_ISUID 04000 set user ID on execution
S_ISGID 02000 set group ID on execution
S_ISVTX 01000 sticky bit
S_IRUSR, S_IREAD 00400 read by owner
S_IWUSR, S_IWRITE 00200 write by owner
S_IXUSR, S_IEXEC 00100 execute/search by owner
S_IRGRP 00040 read by group
S_IWGRP 00020 write by group
S_IXGRP 00010 execute/search by group
S_IROTH 00004 read by others
S_IWOTH 00002 write by others
S_IXOTH 00001 execute/search by others

sticky bit는   chmod 1000 으로 설정하고
set user id는 chmod 4000 으로 설정하는데
그렇다면 그 값은 어디서 나온건지 궁금해서 검색하게 되었다.

[링크 : http://linux.die.net/man/3/chmod]
[링크 : http://en.wikipedia.org/wiki/Chmod]
Posted by 구차니
Linux2010. 2. 16. 16:38
시스템 이전 혹은 백업을 위해 복사를 할때
생각보다 IO로 인해 시스템이 버벅되는 경우가 있다.
물론 야간에 작업을 해야 하는게 정석이긴 하지만, 적절선에서 이전을 하고 싶다면

cp 대신 scp를 이용해서 대역폭을 제한하여 복사할 수 있다.

scp - secure copy (remote file copy program)

-l limit
Limits the used bandwidth, specified in Kbit/s.
-r' Recursively copy entire directories.

[링크 : http://linux.die.net/man/1/scp]

주의사항
1. 속도제한은 -l (소문자 L 이다)
2. 속도제한시 단위는 Kb/s 이다. 즉, -l 1000 하면 125KB/s 로 제한된다.(단위 주의!)
3. 복사시 파일의 권한은 scp 명령어 실행한 사용자를 따른다. (root로 실행시 root로 파일이 생성됨)

'Linux' 카테고리의 다른 글

bash shell - TMOUT 환경변수  (0) 2010.02.18
chmod(3)  (0) 2010.02.18
Xwindow 해상도 설정하기  (0) 2010.02.16
리눅스 시리얼로 파일 전송하기  (0) 2010.02.11
쉘 스크립트의 결과를 알록달록하게 컬러로 출력하기  (0) 2010.02.05
Posted by 구차니