리눅스에서 sh 파일을 실행할때 가끔 다음과 같은 에러가 발생하는 경우가 있다.

  • /bin/bash^M: bad interpreter: No such file or directory

VI로 확인을 해보아도 스크립트내용은 이상이 없는데, 다음 명령어로 해당 sh 파일을 열어보도록 하자.

  • vi -b <file>

확인을 해보면 개행마다 ^M이라는 이상한 문자가 붙어있는 것을 볼 수 있다.

원인으로는 이 파일이 아마도 윈도우즈에서 생성되어서 개행마다 carriage return character 인 "^M"이 붙어서 리눅스에서 실행시 에러를 낸다.

참고로 윈도우즈의 개행은 CR LF 이고, 리눅스에서는 LF 이다.

  • CR (carriage return)
  • LF (line feed)
위의 해결책은 vi -b 로 진입하여 CR에 해당하는 "^M" 문자를 모두 삭제하거나, 리눅스에서 새로 파일을 만들어 작성하여 실행하면 제대로 동작한다.

vi 에서 수정시에는 다음을 참고한다.
  • :%s/^M$//
  • 참고로 ^M 문자는 Ctrl + V, Ctrl + M을 차례로 누르면 된다.



Posted by leechwin
,

Ubuntu 내 Dash home에서 약어로 프로그램을 찾아 실행하는 등의 작업을 할때, 프로그램을 삭제하였는데 메뉴에 남아있거나, 보이기 싫은 경우가 있다.



이럴때에는 다음 디렉토리에서 해당하는 프로그램을 찾아 삭제하면 Dash home에서 보이지 않게 된다.

  • /usr/share/applications
  • /usr/local/share/applications
  • /.local/share/applications
  • /.local/share/desktop-directories


'OS > Linux' 카테고리의 다른 글

Bash Strict Mode  (0) 2016.01.03
[Ubuntu] sh 파일 실행시 "/bin/bash^M" 에러가 발생하는 경우  (0) 2015.12.29
[Shell] Bash shell 팁  (0) 2015.12.20
[Ubuntu] time  (0) 2015.12.20
[Ubuntu] disk usage  (0) 2015.12.20
Posted by leechwin
,

[Shell] Bash shell 팁

OS/Linux 2015. 12. 20. 18:39

Bash Shell에서 편리한 팁들

  • Tab : argument 완성
  • Ctrl + R : command history 에서 검색
  • Ctrl + W : 마지막 단어 삭제
  • Ctrl + U : 라인 전체 삭제
  • Ctrl + A : 라인 시작점으로 이동
  • Ctrl + E : 라인 끝지점으로 이동
  • "cd -" : 이전 디렉토리로 이동


'OS > Linux' 카테고리의 다른 글

[Ubuntu] sh 파일 실행시 "/bin/bash^M" 에러가 발생하는 경우  (0) 2015.12.29
[Ubuntu] Dash home에서 불필요한 프로그램 shortcut 삭제  (0) 2015.12.24
[Ubuntu] time  (0) 2015.12.20
[Ubuntu] disk usage  (0) 2015.12.20
UNIX TOOLBOX  (2) 2015.08.26
Posted by leechwin
,

[Ubuntu] time

OS/Linux 2015. 12. 20. 18:04

특정 명령의 실행시간을 알고 싶을때 time 명령을 통해 확인 가능하다.

  • time [command]
  • ex) time du -sh * | sort -n -r


'OS > Linux' 카테고리의 다른 글

[Ubuntu] Dash home에서 불필요한 프로그램 shortcut 삭제  (0) 2015.12.24
[Shell] Bash shell 팁  (0) 2015.12.20
[Ubuntu] disk usage  (0) 2015.12.20
UNIX TOOLBOX  (2) 2015.08.26
[Ubuntu] libssl-dev  (0) 2014.08.17
Posted by leechwin
,

[Ubuntu] disk usage

OS/Linux 2015. 12. 20. 17:31

현재 디렉토리 혹은 하위의 디렉토리의 disk usage 관련 정보를 shell에서 du 명령을 통해 확인 가능하다.


Usage: du [OPTION]... [FILE]... 

    or:  du [OPTION]... --files0-from=F

Summarize disk usage of the set of FILEs, recursively for directories.


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

  -0, --null            end each output line with NUL, not newline

  -a, --all             write counts for all files, not just directories

      --apparent-size   print apparent sizes, rather than disk usage; although

                          the apparent size is usually smaller, it may be

                          larger due to holes in ('sparse') files, internal

                          fragmentation, indirect blocks, and the like

  -B, --block-size=SIZE  scale sizes by SIZE before printing them; e.g.,

                           '-BM' prints sizes in units of 1,048,576 bytes;

                           see SIZE format below

  -b, --bytes           equivalent to '--apparent-size --block-size=1'

  -c, --total           produce a grand total

  -D, --dereference-args  dereference only symlinks that are listed on the

                          command line

  -d, --max-depth=N     print the total for a directory (or file, with --all)

                          only if it is N or fewer levels below the command

                          line argument;  --max-depth=0 is the same as

                          --summarize

      --files0-from=F   summarize disk usage of the

                          NUL-terminated file names specified in file F;

                          if F is -, then read names from standard input

  -H                    equivalent to --dereference-args (-D)

  -h, --human-readable  print sizes in human readable format (e.g., 1K 234M 2G)

      --inodes          list inode usage information instead of block usage

  -k                    like --block-size=1K

  -L, --dereference     dereference all symbolic links

  -l, --count-links     count sizes many times if hard linked

  -m                    like --block-size=1M

  -P, --no-dereference  don't follow any symbolic links (this is the default)

  -S, --separate-dirs   for directories do not include size of subdirectories

      --si              like -h, but use powers of 1000 not 1024

  -s, --summarize       display only a total for each argument

  -t, --threshold=SIZE  exclude entries smaller than SIZE if positive,

                          or entries greater than SIZE if negative

      --time            show time of the last modification of any file in the

                          directory, or any of its subdirectories

      --time=WORD       show time as WORD instead of modification time:

                          atime, access, use, ctime or status

      --time-style=STYLE  show times using STYLE, which can be:

                            full-iso, long-iso, iso, or +FORMAT;

                            FORMAT is interpreted like in 'date'

  -X, --exclude-from=FILE  exclude files that match any pattern in FILE

      --exclude=PATTERN    exclude files that match PATTERN

  -x, --one-file-system    skip directories on different file systems

      --help     display this help and exit

      --version  output version information and exit 


  • ex) 현재 디렉토리의 하위 디렉토리의 용량을 순서대로 조회
    • du -sh * | sort -n -r


'OS > Linux' 카테고리의 다른 글

[Shell] Bash shell 팁  (0) 2015.12.20
[Ubuntu] time  (0) 2015.12.20
UNIX TOOLBOX  (2) 2015.08.26
[Ubuntu] libssl-dev  (0) 2014.08.17
[Ubuntu] build-essential  (3) 2014.08.17
Posted by leechwin
,

UNIX TOOLBOX

OS/Linux 2015. 8. 26. 17:45

Unix/Linux/BSD command 를 잘 정리해놓은 링크

PDF버전


'OS > Linux' 카테고리의 다른 글

[Ubuntu] time  (0) 2015.12.20
[Ubuntu] disk usage  (0) 2015.12.20
[Ubuntu] libssl-dev  (0) 2014.08.17
[Ubuntu] build-essential  (3) 2014.08.17
[Ubuntu] Terminal 관련 단축키  (0) 2014.06.08
Posted by leechwin
,

 https 서비스 제공시 인증서가 필요한데, StartSSL에서 무료로 발행하는 인증서를 사용할 경우, linux, mac에서는 문제가 없는데, windows 크롬에서 Insecure Contents로 인식되어 안전하지 못한 사이트로 인식되는 경우가 있다.

 크롬에서는 SHA-1 알고리즘의 인증서를 신뢰하지않고 Insecure Contents에러를 내도록 바뀌었는데, StartSSL에서 SHA-2 알고리즘으로 생성한 인증서를 windows 크롬에서 SHA-1 알고리즘으로 인식하여 Insecure Contents 에러를 발생한다.

 StartSSL에서 인증서 발급시 윈도우즈 알고리즘에 대한 API에 대한 이슈로 수정중이라고 하는데, 제일 깔끔한 방법은 SSL2BUY 등의 사이트에서 유료결재를 하여 인증을 하면 문제가 발생하지 않는다. 공짜는 참 힘들다. 


Posted by leechwin
,

 잘못된 링크나 팝업으로 잘못 들어가서 Search Protect라는 adware가 설치되고, 윈도우 시스템이 이상해졌다.

 브라우져의 새창의 링크가 이상한곳으로 설정되는건 물론 전체적으로 시스템이 느려지고, 아무 관련없을것 같은 시너지프로그램에서 마우스 랙이 생겨 느리게 움직이는 현상이 나타났다.

 우측 하단의 툴바에는 다음과 같은 아이콘이 생겼는데, IE의 프로그램인양 생겼다. 

 

 이 프로그램을 죽이려면 다음은 작업을 해야한다.

  • Process Explore 프로그램등으로 현재 실행중인 HpUI관련 프로세스를 모두 죽인다.

  • C:\Program Files 폴더 하위에서 "HpUI"란 용어로 검색을 한다.


    • 만약 검색결과가 나오지 않으면 "Tab"이란 용어로 검색한다.

      • 폴더명을 xxxTab등으로 변조하여 설치되는 경우가 있다.

  • 프로그램이 설치된 폴더를 삭제한다.


 Search Protect를 삭제한 후 everything이라는 프로그램도 설치되어 있는지 확인하자. Search Protect와 쌍으로 설치되고 있는 프로그램으로 방화벽의 기록을 보면 그이름도 구린냄새가 많이 난다.

 

 설치되어 있는지 확인해 보려면 C:\User\{사용자계정}\AppData 폴더 하위에 everything이라는 폴더가 있는지 확인하면 된다.

 해당 폴더가 존재하면 해당 폴더에 들어가서 uninstall을 수행하고 해당 폴더를 삭제한다. 

  


쓰레기 ADWare는 예방이 최선인듯 하다.





Posted by leechwin
,

 파일삭제시 해당파일이 다른 곳에서 실행되고 있거나, 다른 프로세스에서 사용하고 있는 경우 해당 파일을 삭제 할 수 없는 경우가 있다.

 그럴 경우 Unlocker라는 툴을 이용하여 해당 파일의 핸들러들을 모두 해제하여 삭제를 하게 할 수 있다.


  • Unlocker
  • 사용법
    • Unlocker설치후 파일 삭제가 안되는 경우 마우스 우클릭의 메뉴중 Unlocker를 실행하여 해당 파일을 잡고 있는 프로세스들을 해제한 후 삭제를 진행 할 수 있다.


Posted by leechwin
,

 Windows 에서 브라우져로 Web 에 연결된 MS 의 Excel, PPT 등을 열때 다음과 같은 에러로 열리지 않는경우가 있다.


 "이 웹 서버는 SSL(Secure Sockets Layer)을 사용하지 않으며 기본 인증에 의해 제어되기 때문에 기본적으로 액세스가 비활성화되어 있습니다."


 참 굉장히 짜증나는 상황이 발생하는데, SSL 에 기본인증을 사용할 수 없다는 나름 보안과 인증을 신경쓴 부분이라 해결하려면 windows 의 레지스터를  다음과 같이 수정해야 한다.

  1. Windows 시작버튼 > 프로그램 및 파일 검색에 regedit 을 입력하여 실행
  2. 다음 경로로 이동
    1. HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\WebClient\Parameters
  3. 편집 메뉴에서 새로 만들기로 DWORD32 BasicAuthLevel 을 입력
  4. 값데이터로 2 를 입력
  5. 다음 경로로 이동
    1. Office 2010 일 경우
      1. HKEY_CURRENT_USER\Software\Microsoft\Office\14.0\Common\Internet
    2. Office 2013 일 경우
      1. HKEY_CURRENT_USER\Software\Microsoft\Office\15.0\Common\Internet
    3. 편집 메뉴에서 새로 만들기로 DWORD32BasicAuthLevel 을 입력
    4. 값데이터로 2 를 입력



Reference: http://support.microsoft.com/kb/2123563/ko




Posted by leechwin
,