8. CLI: Command Line Interface
What's CLI, definition, purpose etc..
CLI는 GUI와 달리, 마우스와 각종 UI컴포넌트 대신, 표준 입출력 시스텝을 통한 입력과 그에 따른 결과를 출력하는 형태로 나타난다.
컴퓨터의 시작이 GUI가 아닌 CLI이었다는점, 마우스나 터치같은 직관적인 UI형태는 시대를 거쳐 후에 나타난 것.
CLI는 강력하고 빠른 배치 작업들을 수행할 수 있고, 특히 가장 많이 보편적으로 사용되는 Unix/Linux 시스템을 알기 위해서도 많은 부분을 CLI를 필요로하기 떄문에 여전히 유용하다. 접근성도 좋다는데 원격으로 서버에 접근할 수 있다고한다.
GUI: graphic user interface, we're probably more familir with it, but need more explanation! do some research!
Linux != Unix they're created by different people at different times.
linux, unix, windows차이? 일반적으로 서버 작업 할 때 보통 linux서버라 가정하에 작업한다고 함.
we can use "terminal" to use(?)access? CLI. 터미널에서 CLI를 사용하는 것과 GUI를 작동하는 것이 동일.
what's a directory?
common commands(of unix/linux) we can use:
pwd command: print working directory; tells which directory I am currently located in
ls command: list contents of current directory: "파일보기" 기능 you may see the same files you can find on a regular file explorer, which can be regarded as "GUI" with the graphics(file pictures/graphics)
ls -al 과 ls -la는 같다고 보면 됨..
숨겨진 파일 혹은 폴더도 노출 l(i)s(t) -a(ll)l(ist)
clear: simply clears all
cd command: used for navigation between directories and folders; 디렉토리로 "이동" how you type: "cd foldernameiscasesensitive"
cd /User/hongshik/codes/newDir 주소를 명확히 쓰면 바로 한 번에 이동 가능!
cd command variations:
파일명 앞에 .. 또는 ~ 등 기호들이 있는데
cd ..: takes you back to the previous directory you were in; 부모디렉토리
cd /: root directory ("c directory for windows"), directory that's at the top of everything; 루트 디렉토리(시스템 최상위 디렉토리)
~: 홈 디렉토리 의미
.: 현재 디렉토리
cp command: copy files (how you type: cp test /home/jyshimmy/Downloads)
rm command: remove or delete files (be careful to use rm command, there's no turning back) 휴지통에 들어가지도 않아 복원 불가!
mkdir command: make directory; create a new folder 디렉토리 생성
rmdir command: remove diretory; delete an empty folder
**different between rm command and rmdir?
rm -r foldername deletes non-empty folder
rm -rf (rf stands for recursive forced)
mv 파일 및 디렉토리 옮기기
touch command: 빈 파일 생성 touch filename
cat command: one of the most frequently used command in Linux/Unix like operating systems. cat command allows us to create single or multiple files, view contain of file, concatenate files and redirect output in terminal or files.
mv command:
man command: manuals for CLI, type man nameofcommandyouwanttostudy it will give info of that command you typed in
q: quit
more advanced commands:
that deal with "authorization"
sudo command: super user do한다 관리자 권한으로 무언가를 시도할 때 사용하는 명령어. 가능한 user권한으로 해결 할 수 있어야함.
chown command
CLI를 이용해 GUI 프로그램 실행을 더 간편하게 하는 법:
현재 폴더를 macOS Finder에서 보기: open . ("."은 현재 폴더를 의미)
현재 폴더를 VS Code 에디터로 열기: code .
현재 폴더를 Windows 파일 관리자에서 보기: explorer .
자주 사용하게 될 CLI 프로그램
버전 관리 시스템(Version Control System): git
패키지 매니저: Homebrew(macOS)
텍스트 에디터: vim
클라우드 서비스 관리: AWS CLI
git에 대해서
- Why use version contorl?
- store different versions
- restore previous versions
- understand what happend (may see the changes made in codes)
- collaboration (with other people)
- backup
- GitHub
- one kind of Version Control System
- a social platform for git users (리액트(페북이 만듬) 같은 유명 오픈소스도 깃허브를 사용함)
- open source:
- repository: 다양한 브랜치(단계)가 있다.
- master branch: 사용자(end user)들에게 직접 배포해야할 프로그램 소스코드가 들어가는 데
- develop branch: 개발중인 버젼의 소스코드가 들어있는 브랜치; 여기서 충분한 테스트를 거쳐 버그를 확인한 후 마스터로 머징할 수 있어야해. 여기서 안정화가 되면 마스터 브랜치로 머징한다.
- feature branch: 하나 하나의 기능을 담고 있는 곳. 게임 프로그램이라하면, 기사 직업만 있는데 마법사 직업을 추가한다면, 마법사의 기능을 추가... 브랜치에 어떤 기능을 추가할 때, 새로운(미세) 기능?을 짜는 데라고 생각하면 될듯?
- features by workflow:
- distribution -
- data assuarance -
- staging area - 버전 관리를 받게 하려면 staging area에 올리는 과정이 필요. "git add"를 이용해 working directory에서 staging area로 옮길 수 있게됨. staging area에 올라와있어야 repository에 commit(making snapshot of...)이 가능함. 명령어 쓰는 법: git commit -m "Add headline to index page"반드시 commit msg를 써줘야함. 커밋 메시지는 협업할 때 작업기록을 추적하는데 중요.
- repository: 작업기록과 작업흐름(git workflow)을 모두 포함하고 있는 개념. 각 commit기록을 볼 수 있음.
- branching and merging - 브랜치로부터 가지를 새로 치는게 브랜칭, 그 가지를 다시 기존 브랜치로 합치는게 머징.
clone은 local repository가 없을 때 현재 remote repository에 있는 걸 그대로 로컬로 복사하는 작업이고, pull은 local repository와 remote repository가 연결돼있는 상태에서, remote repository에서 업데이트된 사항이 있을 때 가져오는 명령어가 pull입니다
git init과 git clone의 차이?
git을 사용하는 이유는 변경사항을 추적하기 위해. git이 폴더를 감싸고 있어. add를 해야 git의 스테이지(기록하기 전에 모아놓는 공간?)에 추가되고 추적을 시작한다
'깃허브 사용방법'이나 '깃 동작과정' 검색하면 그림이 나와서 그걸 참조하시면 이해에 도움이 되실 거에요.
git status는 어디서 해야하나?
pro git이라는 책 보면 좀 나온다는....
branden macmillan - dog trainner, this random ad came up but I liked it lol
오늘의 숙제: 터미널에서 직접 명령어 연습해보기!!
연습할땐 터미널과 홈디렉토리를 같이 켜놓은 상태로 하면 한 눈에 결과를 볼 수 있어 편리하다!