POSIX CLI
생활코딩
<POSIX CLI1-1. 수업소개>
운영체제를 제어하는 두가지 방법
1. GUI(Graphic User Interface)
: 마우스, 아이콘
2. CLI(Command Line Interface)
: 명령어 이용
POSIX: Portable Operation System Interface - unix,linux,macOS를 제어가능
window는 CMD, PowerShell이라는 독자적인 방법을 가지고 있어서, POSIX와 호환불가.
<POSIX CLI1-2. 실습>
POSIX 호환 시스템인 unix, linux, macOS는 특별히 필요한 준비가 없다.
POSIX로 windows, IOS, Android를 제어하기 위해서는 emulator가 필요.
또는 POSIX 호환되는 server를 별도로 마련.(posix server에 원격으로 접속-secure shell 사용)
<POSIX CLI1-2.2. 실습준비 - Windows Git Bash>
구글검색: posix emulator for windows
cygwin추천.
이 강의에서는 git사용.
구글검색: git(https://git-scm.com/) - download
git bash 실행
<POSIX CLI1-3. 수업의 목적>
CRUD: Create, Read, Update, Delete
File | Directory | |
Create | editor | mkdir |
Read | editor, cat, ls | ls |
Update | editor, mv | mv |
Delete | rm | rm |
<POSIX CLI1-4. 디렉토리의 사용>
터미널 명령어
현재 디렉토리 확인: pwd(print working directory)
/ : root directory
cd : change directory
/c/Users/ddd : home directory
~ : home directory
cd ~ : home directory로 이동
<POSIX CLI1-5. 현재디렉토리의 상태보기와 명령어의 형식>
ls : 현재 폴더의 파일과 디렉토리 확인(file list)
명령어 --help : 명령어에 대한 간략한 사용법
man ls : ls에 대한 manual을 보여달라는 뜻
ls -l : list in long format ->q로 밖으로 빠져나옴.
touch showfile.txt : touch-make empty file
.filename : hidden file
ls -a : show all files
ls -l -a : 자세히 보면서 감춘 파일까지 보기 = ls -la
<POSIX CLI1-6. 디렉토리의 생로병사>
crud(create, read, update, delete)
mkdir : make directory
mkdir posix
./ :current directory
mv :move(rename)
mv dummy2 dummy
rm -r : remove directory
rm :remove file
<POSIX CLI1-7. 절대경로와 상대경로>
부모 디렉토리로 이동 cd ../ , cd ..
../ : parent directory
cd / root디렉토리로 이동(절대경로 이용)
cd .. parent디렉토리로 이동(상대경로 이용)
cd ./posix(상대경로 이용)
cd /Users/live/posix(절대경로 이용)
<POSIX CLI1-8. 파일생성과 읽기>
파일생성 위해 편집기 이용필요
nano라고 치면 편집기 열림
내용입력-ctrl+o(저장)0-파일제목입력(hello.txt)-enter
파일읽기 nano hello.txt-enter
cat hello.txt 터미널화면에 hello.txt의 파일내용을 출력
<POSIX CLI1-9. 파일수정과 삭제>
mv hello.txt hello_world.txt
ctrl+c 엔터없이 빠져나오기
rm hello_world.txt(파일삭제 tab키로 파일명 자동완성)
<POSIX CLI1-10. GUI VS CLI>
<POSIX CLI1-11. 순서대로 실행시키기>
ls -R 하위 디렉토리 파일까지 모두 보여줌
$ mkdir dummy;cd dummy;touch hello.txt;cd ..;ls -R 명령과 명령 사이구분 command seperator: ;
<POSIX CLI-12. 자동화-실패하면 멈추기>
clear(터미널 화면 모두 지우기>
&& : and operator
<POSIX CLI1-13. 수업을 마치며>-앞으로 공부할만한 주제 소개
program을 만들고 싶다면 shell script에 대해 공부하기.
컴퓨터에 기본적으로 내장되어 있지 않은 package를 설치-package manager(apt-get, yum, homebrew[맥], chocolatey[윈도우])]
maintain컴퓨터관리-data(storage[ssd,hard disc], memory), processor[cpu]
cli에서 이런걸 관리 하는 애가 top, htop
computer architecture컴퓨터 구조
network