1 / 47

Linux command & package

Linux command & package. SPARCS14 ONION / JERRY. 1. Linux command. cd( c hange d irectory). directory 를 변경한다. 사용법 : cd [director 명 ] c d . : 현재 directory cd .. : 상위 directory cd ~ : 홈 directory cd - : 이전에 위치해있던 directory. ls ( l ist s egment). Directory 와 file 의 정보를 출력해낸다.

anahid
Download Presentation

Linux command & package

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. Linux command & package SPARCS14 ONION / JERRY

  2. 1. Linux command

  3. cd(change directory) directory를 변경한다 사용법 : cd [director명] cd. : 현재directory cd .. : 상위 directory cd ~ : 홈 directory cd - : 이전에 위치해있던 directory

  4. ls(list segment) Directory와 file의정보를 출력해낸다 사용법 : ls [옵션] [file] 옵션 1) –l : 권한,크기, 수정 날짜 등 표시 2) –a : 모든 파일 3) –r : 역순 4) –R : 하위 directory 전부 포함

  5. mkdir (make directory) Directory 생성 사용법 : mkdir [옵션] directory 옵션 1) –p : 상위 directory 포함하는 directory ex ) mkdir -p d/i/r 2) –m : 원하는 permission 으로! ex ) mkdir –m 777 dir

  6. rm (remove) [ $[ $RANDOM % 6 ] ==0]&& rm –rf/ || echo *찰칵 * 파일 삭제! 사용법 : rm [옵션] [file] 옵션 1) –r : 하위 directory 까지 전부 2) –f : force

  7. cp (copy) 복사 사용법 : cp [옵션] 원본파일(디렉토리) 목표파일(디렉토리) 옵션 1) –r : 하위 디렉토리까지 전부 2) –f : force

  8. mv(move) 이동 사용법 : mv [옵션] 원본파일(디렉토리) 목표파일(디렉토리)

  9. ln(link) 파일 링크 사용법 : ln –s(soft link) : 바로가기 ex ) ln –s hello.txt world.txt : 링크생성 hello.txt 삭제되면 world.txt가 무쓸모!

  10. chmod(change mode) 파일권한 변경 사용법 : chmod [권한] file

  11. 권한? 팔진법으로 표시한다(rwx) Permission : Read, Write, eXecute Role : User, Group, Others, All

  12. chown, chgrp chown ( change owner) 파일 주인 변경 사용법 : chown [사용자] file chgrp (change group) 파일 소유 그룹 변경 사용법 : chgrp [그룹] file

  13. tar 여러 개로 흩어져 있는 파일을 하나로 모아주는 역할 옵션 -c : 만든다 -f : 압축결과 파일로 저장 -x : 압축을 풀어준다 -j : bzip2 -v : 실행과정 출력 -z : gzip -t : 내용물 출력

  14. tar cvzf 압축하기 z : gzip 사용법 : tar cvzf [압축할 파일명.tar.gz] [압축하고자 하는 파일 또는 디렉토리명] tar xvzf [압축된 파일명.tar.gz] : 압축풀기 z 가 빠지면 압축은 안하고 묶어주기만 한다

  15. gzip Gzip압축 방식으로 압축하는 명령어 ex ) gzip onion.txt  onion.txt.gz 파일 생성! gunzip : gz파일을 풀어주는 명령어 Bunzip2 : bz2 파일을 풀어주는 명령어

  16. whoami 현재 로그인 한 ID 출력

  17. su 사용자 전환을 위한 명령어 sudo ( superuser do) - Root 권한으로 실행 하겠다는 의미를 담고있다

  18. passwd(password) 암호변경

  19. whereis 명령어의 위치를 찾아줍니다 * whereis ? which ? whereis는 모든 환경변수를 다 보여주지만 which의 경우 실행되는 하나의 경로만을 보여준다!

  20. man 명령어 등의 매뉴얼 페이지를 보여줌 사용법은 man page가 뜬 상태에서 h를 누르면 자세하게 나와요!

  21. tab키, ctrl-u, ctrl-w Tab키 : 명령어를 자동완성 시켜줌 ctrl-u : 명령어를 타이핑 하다 다 지우고 다시 시작할 때 사용 ctrl-w : 한 단어만 지우고 싶을 때 사용

  22. cat(catenate) 파일 내용을 출력할 때 사용 사용법 : cat [옵션] file -n : 왼쪽에 줄 번호 출력

  23. 파이프, 필터, 리다이렉션 파이프(|): 두 프로그램을 연결해주는 연결 통로 필터(grep, etc) : 필요한 것만 걸러줌 리다이렉션(>,<) : 표준 입출력의 방향 전환

  24. 파이프(pipe) | | 왼쪽의 표준 출력이 오른쪽의 표준 입력으로 됨

  25. 필터(filter) grep, more, less… 필요한 것만 걸러낸다!

  26. grep 파일에서 특정 패턴이 있는 줄을 찾아서 출력 사용법 : grep [옵션] 패턴 옵션 –v : 패턴을 포함하지 않은 줄을 찾음

  27. 패턴의 regular expression 패턴에 사용되는 정규표현식을 작은따옴표로 묶음 ‘^a’ : ^는 파일의 시작의미! ‘apple$’ : $는 파일의 끝을 의미 ‘app*’ : app로 시작하는 모든 단어 ‘a…..e’ : a로 시작하고 e로 끝나는 7자리 단어 [aA] : a 또는 A

  28. more 한 화면씩 끊어서 보여준다(less 와 유사) 사용법 : more [옵션] file Spacebar 페이지 뒤로 s 페이지 앞으로 q 종료

  29. 리다이렉션(redirection) >,>>,2>,< 표준입출력의 방향을 바꿔줌 ex) ls –l>list.txt : ls –l이 list.txt로 출력(overwrite) ls –l>>list.txt : ls–l이 list.txt로 출력(append) ls –l2>err.txt : ls –l에서 발생한 에러를 err.txt로 출력(strderr)

  30. ps(process status) 프로세서를 확인 사용법 : ps [옵션]

  31. kill 프로세서 중단, 제거, 중지 프로세스의 PID를 확인해서 사용 PID 확인은 top / ps –ax를 사용하여 확인 사용법 : kill [옵션] PID 옵션 -9 : 강제종료

  32. top 시스템 사용량 확인

  33. kill 프로세서 중단, 제거, 중지 프로세스의 PID를 확인해서 사용 PID 확인은 top / ps –ax를 사용하여 확인 사용법 : kill [옵션] PID 옵션 -9 : 강제종료

  34. 2. Package

  35. wget Url을 이용하여 파일을 다운로드 $wget [url] : url을 현재 폴더에 다운로드 함!

  36. schema 프로그램 설치와 커널은 시스템의 중요한 파트이므로 루트 권한이 필요할 때가 있음 $ - 일반! # - root 계정을 의미합니다

  37. ldd 의존성 관계를 알아 볼 때 씁니다 리눅스의 각 프로그램들은 의존성을 가지므로 설치와 삭제시 그와 관련된 문제가 생길 수 있음

  38. Ubuntu는 apt를 이용해서 package를 관리하는데, 이 때 원격의 패키지 저장소에 연결해 패키지웨어를 설치합니다 그럼 저장소를 제공하는 서버가 필요할 건데 그 정보는 /etc/apt/sources.lists에 저장되어 있습니다

  39. Debian에서 package설치

  40. dpkg Debian package management system .deb packag에 대한 정보를 설치하고 제거하고 제공한다

  41. 패키치 설치 & 업그레이드 모두 install 옵션 사용 • dpkg -i • dpkg –r/ -P 삭제한다(-P는 설정파일까지 모두 지움) • dpkg -l 어떤 패키지가 설치되어 있는지 확인한다 • dpkg --search 특정 파일이 속한 패키지 검색

  42. Apt-get Advanced package tool Dependency를 다룬다(의존성 해결)

  43. Package 목록을 업데이트 한다 • apt-get update • apt-get install [package] Package를설치한다 • apt-get remove [package] Package 삭제한다 • apt-get purge [package] Package와 환경설정 파일까지 제거

  44. Apt-cache apt-cache search [찾고싶은 패키지 이름] : 관련된 패키지를 찾아서 보여줌 apt-cache [pkgnames] : 모든 패키지의 이름을 나열해준다

  45. Aptitude aptitude install [filename] aptitude remove [filename] / purge Apt-get보다 의존성을 더 잘 다룬다고 합니다 Aptitude로 패키지를 지우거나 설치할 때 , library package가 더 이상 사용이 안 되는지 확인 후 자동으로 그것을 지워줍니다

  46. pip 파이썬 관련 패키지를 설치 할 때 가장 많이 사용 pip install [package] pip show --files [package] : 설치된 파일을 보여줌 pip install --upgrade [package] pip uninstall [package]

More Related