1 / 35

Basic Unix Commands and Concepts Part 2

Basic Unix Commands and Concepts Part 2. logue 08 김도국. Saving Your Output. Redirection! $ ls / usr /bin > ~/Binaries 기본적으로 덮어쓰기로 설정되어 있다 . $ noclobber =1 위의 명령으로 덮어쓰기를 방지. 명령. 출력을 저장할 파일. Saving Your Output. $ ls /bin >> ~/Binaries 기존 파일에 내용을 추가하는 방법

wade-barton
Download Presentation

Basic Unix Commands and Concepts Part 2

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Basic Unix Commandsand Concepts Part 2 logue 08 김도국

  2. Saving Your Output • Redirection! • $ ls /usr/bin > ~/Binaries • 기본적으로 덮어쓰기로 설정되어 있다. • $ noclobber=1 • 위의 명령으로 덮어쓰기를 방지 명령 출력을 저장할 파일

  3. Saving Your Output • $ ls /bin >> ~/Binaries • 기존 파일에 내용을 추가하는 방법 • 리눅스의 출력 스트림에는 표준 출력과 표준 에러가 있음 • 지금까지의 방법에서는 표준 에러는 리다이렉트하지 않음

  4. Saving Your Output • $ gccinvinitjig.c >& error-msg • 표준 출력, 표준 에러 모두 리다이렉트 • $ gccinvinitjig.c 2> error-msg • 표준 에러만 리다이렉트 • $ gccinvinitjig.c 2>error-msg >/dev/null • 표준출력은 버리고,표준에러 리다이렉트

  5. Saving Your Output test.py

  6. Saving Your Output

  7. Saving Your Output

  8. Saving Your Output

  9. Saving Your Output

  10. Saving Your Output

  11. Saving Your Output • Pipe(|)

  12. What Is a Command? • $ ls • $ /bin/ls • $ export PATH=$PATH : /usr/sbin 추가하려는 명령의 경로

  13. Background Command • $ fg (%)1 • 1번 작업으로 복귀 • $ jobs • 현재 배경작업의 수를 확인 • $ kill %1

  14. Background Command

  15. Background Command

  16. Manual Pages • $ man ls • $ man 1 ls • 1 : 사용자 명령 • 2 : 유닉스 시스템 호출 • 5 : 파일 형식 • 8 : 시스템 관리 명령

  17. Manual Pages • $ apropos edit • $ export MANPATH=/usr/man:/usr/local/man

  18. File Ownership and Permissions • 읽기 권한 : 파일 내용을 볼 수 있다. • 쓰기 권한 : 파일을 변경하거나 지울 수 있다. • 실행 권한 : 파일을 실행할 수 있다.디렉토리의 경우 • 읽기 권한 : 디렉토리의 내용을 볼 수 있다. • 쓰기 권한 : 파일을 추가하거나 지울 수 있다. • 실행 권한 : 파일 정보를 볼 수 있다.

  19. File Ownership and Permissions • logue는 읽고,쓰고,실행할 수 있다. • Sparcs에 속하는 계정은 읽을 수 있다. • 그 외의 계정은 읽을 수 있다. • 소유자는 logue, 그룹은 sparcs이다.

  20. Changing the Ownership • # chown bin sampsoft • root만이 chown을 실행할 수 있다. • # chgrp bin sampsoft • 파일의 소유자면 chgrp로 자신이 속한 다른 그룹으로 파일의 그룹 소유권을 변경하는 것이 가능하다.

  21. Changing the Permission • $ chmod +x header • $ chmod –x header • $ chmodu+x header • $ chmodugo+rwx header

  22. Changing the Permission • $ chmod 555 header • $ chmod 444 header • $ umask 027

  23. Changing the Permission • setUID- 실행할 때 파일 소유자의 권한을 임의로 가진다. • $ chmod 4xxx file/directory

  24. Changing the Permission • setGID- 실행할 때 해당 그룹에 포함된 계정은 사용자 권한을 임의로 가진다. • $ chmod 2xxx file/directory

  25. Changing the Permission • Sticky bit- 삭제에 대한 권한은 root와 소유자만이 가진다. • $ chmod 1xxx file/directory

  26. Startup Files

  27. Startup Files .bashrc의 예 • RS1=‘/u$’ : # 프롬프트에 사용자의 로그인명을 포함한다. • HISTSIZE=50 : 위 화살표로 살펴볼 수 있는 명령을 50개로 제한 • PATH=/usr/local/bin:/usr/bin:/bin:/usr/bin/X11명령을 찾기 위해 검색하는 모든 디렉토리 • stty erase “^H” : 백스페이스 키를 제대로 동작하게 해준다.

  28. Important Directories • /bin : ls와 같은 가장 중요한 유닉스 명령이 위치 • /usr/bin : 기타 명령어를 포함 • /usr/sbin : 시스템 관리를 위한 명령어가 위치 • /boot : 부팅 중 사용되는 커널과 기타 파일들 • /etc : 네트워킹, NFS, 메일 등의 하위시스템에서 사용하는 파일들이 위치 • /var : 다양한 유틸리티에서 사용하는 로그 파일과 같은 관리용 파일

  29. Daemon Programs • 항상 백그라운드에서 실행되는 프로그램 • 네트워크를 통해 클라이언트의 여러 요청에 서비스하기 위한 서버 프로그램 • /etc/inittab, /etc/inetd.conf파일을 통해 데몬의 실행을 살펴볼 수 있다. • 부팅시자동실행되는 데몬 • 단독으로 실행,중지할 수 있는 데몬

  30. Daemon Programs

  31. Daemon Programs • 단독 데몬의 실행과 중지, 재시작 • # service (daemonname) start | stop | restart • 부팅시자동실행되는데몬의 관리 • # ntsysv : 현재 레벨의 데몬 관리 지정 • # ntsysv –level3 : 3번 레벨의 데몬 관리 지정

  32. Daemon Programs • $ nohap (command) & • 해당 명령을 daemon program처럼 백그라운드에서 지속적으로 동작하게 한다. • 흔한 백그라운드 작업과 다른 점은 로그아웃 시에도 작업이 계속된다는 점이다.

  33. Processes • 자신의 리소스를 지니고 있는 독립된, 실행 중인 프로그램을 일컫는다. • $ ps

  34. Processes • $ ps ax | more • 실행 중인 모든 프로세스를 살펴볼 수 있다. • $ kill(process-id)

  35. ReferenceRunning Linux 4th EditionGoogle Thank you for listening!

More Related