본문 바로가기

부스트캠프 AI Tech/Product Serving

Linux & Shell

Linux

  • Debian, Ubuntu, Redhat, CentOS 등 분파가 나뉨

 

Shell Command

  • man : manual docstring
  • echo 'shell command' : command의 결과 출력
  • bash '*.sh' : shell script 실행
  • cat a.txt b.txt > c.txt (overwrite), cat a.txt b.txt >> c.txt (append)
  • find . -name "file_name"
  • export : 환경 변수
    • ~/.bashrc 에 저장 후 source ~/.bashrc : 즉시 적용
  • alias : alias
  • sort : 행 단위 정렬
  • uniq : 중복 제거
  • grep : 패턴과 매칭되는 라인 검색 (grep -option "pattern" file_name)
  • cut : 파일의 특정 필드 추출 cut -d sperator -f 잘라낼 field
  • stdin - 0, stdout - 1, stderr - 2
  • Redirection : (> - overwrite, >> - append), 출력값을 다른 파일이나 스트림으로 전달
  • Piple : 출력값을 입력으로 사용할 때 (ls | grep "test") - ls의 출력값에서 "test" 패턴 검색
  • curl : 웹 서버의 request가 제대로 작동되는지 확인
  • df : 사용중인 디스크 용량
  • scp : 호스트 간 파일 복사
    • scp local_path user@ip:remote_dir (local => remote)
    • scp sender@ip:remote_dir receiver@ip:target_remote_dir (remote => remote)
  • nohub : 터미널 종료 후에도 백그라운드에서 작업 실행 (755 권한 필요)

 

Shell Script

  • #!/bin/bash : Shebang (이 script를 bash shell로 해석
  • START=$(date + %s) : date를 %s(unix timestamp)로 변환하여 START에 저장

'부스트캠프 AI Tech > Product Serving' 카테고리의 다른 글

MLflow  (0) 2022.02.16
Docker  (0) 2022.02.15