리눅스에서 설정파일이나 스크립트 파일을 수정한 뒤에 재부팅을 하지않고, 수정내용을 바로 적용하려면 source 명령을 수행하면 된다.

source 명령은 bash 내부 명령으로 포함되어있다.


  • $ source <script file>


Posted by leechwin
,

리눅스에서는 로그파일을 실시간으로 확인하는 방법중에 하나로 tail 명령에 대해 알아보자.


  • Tail
    • $ tail -f <대상파일>
    • 위와 같이 실행하면 대상 파일의 마지막 10라인을 출력하며, 해당 파일에 추가되는 행을 계속 출력하여 준다.


  • 옵션
    • f: 파일의 마지막 10라인을 실시간으로 계속 해서 출력한다.
    • n: 기본 10라인이 아닌 n 만큼의 라인을 출력한다.
      • $ tail -n 20 <대상파일>


  • Help 문서

  •  Usage: tail [OPTION]... [FILE]...

     Print the last 10 lines of each FILE to standard output.

     With more than one FILE, precede each with a header giving the file name.


     With no FILE, or when FILE is -, read standard input.


     Mandatory arguments to long options are mandatory for short options too.

      -c, --bytes=[+]NUM       output the last NUM bytes; or use -c +NUM to

                                 output starting with byte NUM of each file

      -f, --follow[={name|descriptor}]

                               output appended data as the file grows;

                                 an absent option argument means 'descriptor'

      -F                       same as --follow=name --retry

      -n, --lines=[+]NUM       output the last NUM lines, instead of the last 10;

                                 or use -n +NUM to output starting with line NUM

          --max-unchanged-stats=N

                               with --follow=name, reopen a FILE which has not

                                 changed size after N (default 5) iterations

                                 to see if it has been unlinked or renamed

                                 (this is the usual case of rotated log files);

                                 with inotify, this option is rarely useful

          --pid=PID            with -f, terminate after process ID, PID dies

      -q, --quiet, --silent    never output headers giving file names

          --retry              keep trying to open a file if it is inaccessible

      -s, --sleep-interval=N   with -f, sleep for approximately N seconds

                                 (default 1.0) between iterations;

                                 with inotify and --pid=P, check process P at

                                 least once every N seconds

      -v, --verbose            always output headers giving file names

      -z, --zero-terminated    line delimiter is NUL, not newline

          --help     display this help and exit

          --version  output version information and exit



Posted by leechwin
,

리눅스에서는 파일이나 디렉토리를 연결하는 링크의 개념이 있는데, 이 링크를 'ln' 명령으로 만들 수 있다.

링크는 하드링크(hard link)와 심볼릭링크(symbolic link) 2개의 종류로 만들 수 있다.

  • 하드링크
    • 하드링크 생성
      • $ ln <source> <target>
    • 하드링크는 원본파일과 동일한 내용의 다른 파일이다.
    • 원본파일의 내용이 변경되면 하드링크된 파일의 내용도 자동으로 변경된다.
    • 디렉토리는 하드링크 할 수 없다.


  • 심볼릭링크
    • 심볼릭링크 생성
      • $ ln -s <source> <target>
    • 심볼릭링크는 기존 파일을 가리키도록 링크만 되어있는 특별한 유형의 파일로 '바로가기'와 비슷한 파일이다.
    • 디렉토리도 심볼릭링크 가능하다.
    • 심볼릭 링크가 가리키고있는 파일이 변경되거나 삭제되면, 제동작을 하지 못하고, 해당링크는 'dangling soft link' 라고 한다.

  • Help 문서

  •  Usage: ln [OPTION]... [-T] TARGET LINK_NAME   (1st form)

      or:  ln [OPTION]... TARGET                  (2nd form)

      or:  ln [OPTION]... TARGET... DIRECTORY     (3rd form)

      or:  ln [OPTION]... -t DIRECTORY TARGET...  (4th form)

     In the 1st form, create a link to TARGET with the name LINK_NAME.

     In the 2nd form, create a link to TARGET in the current directory.

     In the 3rd and 4th forms, create links to each TARGET in DIRECTORY.

     Create hard links by default, symbolic links with --symbolic.

     By default, each destination (name of new link) should not already exist.

     When creating hard links, each TARGET must exist.  Symbolic links

     can hold arbitrary text; if later resolved, a relative link is

     interpreted in relation to its parent directory.


     Mandatory arguments to long options are mandatory for short options too.

          --backup[=CONTROL]      make a backup of each existing destination file

      -b                          like --backup but does not accept an argument

      -d, -F, --directory         allow the superuser to attempt to hard link

                                    directories (note: will probably fail due to

                                    system restrictions, even for the superuser)

      -f, --force                 remove existing destination files

      -i, --interactive           prompt whether to remove destinations

      -L, --logical               dereference TARGETs that are symbolic links

      -n, --no-dereference        treat LINK_NAME as a normal file if

                                    it is a symbolic link to a directory

      -P, --physical              make hard links directly to symbolic links

      -r, --relative              create symbolic links relative to link location

      -s, --symbolic              make symbolic links instead of hard links

      -S, --suffix=SUFFIX         override the usual backup suffix

      -t, --target-directory=DIRECTORY  specify the DIRECTORY in which to create

                                    the links

      -T, --no-target-directory   treat LINK_NAME as a normal file always

      -v, --verbose               print name of each linked file

          --help     display this help and exit

          --version  output version information and exit

     



Posted by leechwin
,

Synergy 의 client 중에 하나가 Mac 일경우, Mac 스크린락이 동작하면 Synergy Host 에서 키가 동작하지 않아 난감한 상황이 닥치곤 한다.

이때에는 Mac 에서 다음과 같은 방법으로 설정하여 Mac의 자동실행 항목으로 Synergy 를 등록하면 Mac 에 스크린락이 동작하여도 Synergy Host 의 키입력이 동작한다.


Mac 에서 자동실행 항목 등록 방법

  1. 시스템 환경설정 클릭
  2. 현재 사용자의 로그인 항목 탭 클릭
  3. 하단에 '+' 버튼 클릭
  4. 응용 프로그램에서 Synergy 항목을 선택 후 추가
  5. 로그인할때 자동으로 실행됩니다. 목록에 Synergy 가 추가되었다면, 이후 스크린락이 동작하여도 Synergy 도 정상 동작한다.


Posted by leechwin
,

특정 Dom 이나 전체 Window 에 Drag&Drop 동작을 막고 싶은경우, dragoverdrop 이벤트에 핸들러를 추가하는 방법으로 처리하는경우가 있는데, 이렇게 해도 잘 안되는 경우가 있다.

window.addEventListener('dragover', (e) => {
  e.stopPropagation();
  e.preventDefault();
}, false);

window.addEventListener('drop', (e) => {
  e.stopPropagation();
  e.preventDefault();
}, false);

이런경우에는 drag&drop 시에 drag 되는 data 를 유지하기 위해 사용되는 DataTransfer 객체값을  수정해주면 제대로 동작한다.

window.addEventListener('dragover', (e) => {
  e.stopPropagation();
  e.preventDefault();
  e.dataTransfer.effectAllowed = 'none';
  e.dataTransfer.dropEffect = 'none';
}, false);

window.addEventListener('drop', (e) => {
  e.stopPropagation();
  e.preventDefault();
  e.dataTransfer.effectAllowed = 'none';
  e.dataTransfer.dropEffect = 'none';
}, false);

위와 같이 effectAllowed 와 dropEffect 속성을 'none' 으로 수정하여 적용하면 Drag&Drop 동작이 적용되지 않는다.

  • effectAllowed
    • 드래그 효과를 제한할 수 있고, 다음과 같은 문자열 값이 사용된다.
    • none, copy, link, move, copyLink, copyMove, linkMove, all
  • dropEffect
    • 마우스를 놓았을 때 발생하는 효과

Reference


'Web' 카테고리의 다른 글

개발 블로그 링크  (0) 2020.07.05
[Chrome] DNS_PROBE_FINISHED_NXDOMAIN 오류  (0) 2019.04.09
[Javascript] 함수 Performance 체크  (0) 2016.12.25
[Bootstrap] Input 태그의 Clear 버튼  (0) 2016.12.16
[FONTAWESOME] icon 제공 라이브러리  (0) 2016.12.16
Posted by leechwin
,