CSE 311 Introduction to Operating Systemscsl.skku.edu/uploads/SSE2030S19/LAB0_Introduction.pdf ·...

15
SSE2030: Introduction to Computer Systems, Spring 2019, Jinkyu Jeong ([email protected]) LAB Introduction Prof. Jinkyu Jeong ([email protected] ) TA -- Donghyun Kim ([email protected] ) TA – JiwonWoo ([email protected] ) Computer Systems Laboratory Sungkyunkwan University http://csl.skku.edu

Transcript of CSE 311 Introduction to Operating Systemscsl.skku.edu/uploads/SSE2030S19/LAB0_Introduction.pdf ·...

Page 1: CSE 311 Introduction to Operating Systemscsl.skku.edu/uploads/SSE2030S19/LAB0_Introduction.pdf · 2019. 3. 20. · SSE2030: Introduction to Computer Systems, Spring 2019, Jinkyu Jeong(jinkyu@skku.edu)

SSE2030: Introduction to Computer Systems, Spring 2019, Jinkyu Jeong ([email protected])

LAB Introduction

Prof. Jinkyu Jeong ([email protected])TA -- Donghyun Kim ([email protected])

TA – Jiwon Woo ([email protected])Computer Systems Laboratory

Sungkyunkwan Universityhttp://csl.skku.edu

Page 2: CSE 311 Introduction to Operating Systemscsl.skku.edu/uploads/SSE2030S19/LAB0_Introduction.pdf · 2019. 3. 20. · SSE2030: Introduction to Computer Systems, Spring 2019, Jinkyu Jeong(jinkyu@skku.edu)

SSE2030: Introduction to Computer Systems, Spring 2019, Jinkyu Jeong ([email protected]) 2

Installation

• Install Ubuntu on Virtual Box– Install Virtual Box(or VMware)– Download Ubuntu .iso file– Create a New Virtual Machine

– https://itsfoss.com/install-linux-in-virtualbox/

Page 3: CSE 311 Introduction to Operating Systemscsl.skku.edu/uploads/SSE2030S19/LAB0_Introduction.pdf · 2019. 3. 20. · SSE2030: Introduction to Computer Systems, Spring 2019, Jinkyu Jeong(jinkyu@skku.edu)

SSE2030: Introduction to Computer Systems, Spring 2019, Jinkyu Jeong ([email protected]) 3

Virtual Machine

• Virtual Box– https://www.virtualbox.org/wiki/Downloads

• VMware– https://www.vmware.com/kr/products/workstation-

player/workstation-player-evaluation.html

Page 4: CSE 311 Introduction to Operating Systemscsl.skku.edu/uploads/SSE2030S19/LAB0_Introduction.pdf · 2019. 3. 20. · SSE2030: Introduction to Computer Systems, Spring 2019, Jinkyu Jeong(jinkyu@skku.edu)

SSE2030: Introduction to Computer Systems, Spring 2019, Jinkyu Jeong ([email protected]) 4

Ubuntu• Operating System based on Linux Kernel(Which is Unix-like OS)

• Downloads– https://www.ubuntu.com/download

• Recommended System Requirements

Page 5: CSE 311 Introduction to Operating Systemscsl.skku.edu/uploads/SSE2030S19/LAB0_Introduction.pdf · 2019. 3. 20. · SSE2030: Introduction to Computer Systems, Spring 2019, Jinkyu Jeong(jinkyu@skku.edu)

SSE2030: Introduction to Computer Systems, Spring 2019, Jinkyu Jeong ([email protected])

GUI vs CLI

• Graphical User Interface (GUI)

– Windowing Systems …

• Command Line Interface (CLI)

– Unix-Shell, Command Prompt …

Page 6: CSE 311 Introduction to Operating Systemscsl.skku.edu/uploads/SSE2030S19/LAB0_Introduction.pdf · 2019. 3. 20. · SSE2030: Introduction to Computer Systems, Spring 2019, Jinkyu Jeong(jinkyu@skku.edu)

SSE2030: Introduction to Computer Systems, Spring 2019, Jinkyu Jeong ([email protected]) 6

Shell vs Terminal

• Shell– A Program provides Interface to Operating System's

Services– bash, ksh, sh …

• Terminal– Used for Entering data into, Displaying or Printing data

from a Computing System

Page 7: CSE 311 Introduction to Operating Systemscsl.skku.edu/uploads/SSE2030S19/LAB0_Introduction.pdf · 2019. 3. 20. · SSE2030: Introduction to Computer Systems, Spring 2019, Jinkyu Jeong(jinkyu@skku.edu)

SSE2030: Introduction to Computer Systems, Spring 2019, Jinkyu Jeong ([email protected]) 7

Shell Commands

명령어 사용법 용도 많이 쓰이는 옵션

ls [옵션] [파일명] 파일 리스팅 -a -l

mkdir [옵션] [파일명] 디렉토리 생성 -p

cd [디렉토리명] 디렉토리 이동 .현재 ..상위 ~홈 –이전

pwd 현재 디렉토리 경로 출력

rm [옵션] [파일명] 파일 제거 -r -f

cp [옵션] [src파일] [dest파일] 파일 복사 -r -f

mv [옵션] [src파일] [dest파일] 파일 이동

chmod [권한] [파일명] 권한변경

find [옵션] [파일명] 파일명 찾기 -name

grep [옵션] [패턴] [파일명] 파일 내부 탐색 -n -r

tar [옵션] [파일명] 파일 압축/해제 -cvzf -xvzf -C

shutdown 시스템 종료

reboot 다시시작

diff [파일명] [파일명] 비교 -i -q

Page 8: CSE 311 Introduction to Operating Systemscsl.skku.edu/uploads/SSE2030S19/LAB0_Introduction.pdf · 2019. 3. 20. · SSE2030: Introduction to Computer Systems, Spring 2019, Jinkyu Jeong(jinkyu@skku.edu)

SSE2030: Introduction to Computer Systems, Spring 2019, Jinkyu Jeong ([email protected]) 8

Files

Page 9: CSE 311 Introduction to Operating Systemscsl.skku.edu/uploads/SSE2030S19/LAB0_Introduction.pdf · 2019. 3. 20. · SSE2030: Introduction to Computer Systems, Spring 2019, Jinkyu Jeong(jinkyu@skku.edu)

SSE2030: Introduction to Computer Systems, Spring 2019, Jinkyu Jeong ([email protected]) 9

Vim

• Vi IMproved

• Text Editor program for Unix

• sudo apt-get install vim

Page 10: CSE 311 Introduction to Operating Systemscsl.skku.edu/uploads/SSE2030S19/LAB0_Introduction.pdf · 2019. 3. 20. · SSE2030: Introduction to Computer Systems, Spring 2019, Jinkyu Jeong(jinkyu@skku.edu)

SSE2030: Introduction to Computer Systems, Spring 2019, Jinkyu Jeong ([email protected]) 10

Vim

명령어 동작

dd, d 삭제

v 범위선택

yy, y 복사

p 붙여넣기

Ctrl + a 커서위치 숫자 증가

Ctrl + x 커서위치 숫자 감소

u 실행취소

Ctrl + r 취소명령 취소

명령어 동작 옵션

:w 저장

:q 끝내기

/[문자열] 앞으로 탐색

?[문자열] 뒤로 탐색

탐색 중 n, N 다음/이전 찾기

:%s/[찾을 문자열]

/[바꿀 문자열]/[옵션] 찾아 바꾸기 g, c, i

Ctrl + g 현재 파일명

:sp 창 나눔 (horizontal)

:vs 창 나눔 (virtical)

Ctrl + w w 창 간 이동

Page 11: CSE 311 Introduction to Operating Systemscsl.skku.edu/uploads/SSE2030S19/LAB0_Introduction.pdf · 2019. 3. 20. · SSE2030: Introduction to Computer Systems, Spring 2019, Jinkyu Jeong(jinkyu@skku.edu)

SSE2030: Introduction to Computer Systems, Spring 2019, Jinkyu Jeong ([email protected]) 11

Vim Setting

• Vim Preference Setting

set et ts=4set nuset mouse=aset autoindent

~/.vimrc명령어 동작

:set nu 줄번호 사용 설정

:set nonu 줄번호 사용 해제

:set mouse=a 마우스 사용 설정

:set mouse-=a 마우스 사용 해제

:set autoindent 자동 들여쓰기

:set smartindent 자동 들여쓰기

:set ts=[#] tapstop

:set sw=[#] shift width

:set et expand tap

Page 12: CSE 311 Introduction to Operating Systemscsl.skku.edu/uploads/SSE2030S19/LAB0_Introduction.pdf · 2019. 3. 20. · SSE2030: Introduction to Computer Systems, Spring 2019, Jinkyu Jeong(jinkyu@skku.edu)

SSE2030: Introduction to Computer Systems, Spring 2019, Jinkyu Jeong ([email protected]) 12

Exercise 1

• Make Directory and Use Vim for Writing Code– mkdir, cd, vi

dir_A

dir_B

file_1

#include <stdio.h>

int main(){printf(“UseVim to Write Code\n”);return 0;

}

file_1.c

Page 13: CSE 311 Introduction to Operating Systemscsl.skku.edu/uploads/SSE2030S19/LAB0_Introduction.pdf · 2019. 3. 20. · SSE2030: Introduction to Computer Systems, Spring 2019, Jinkyu Jeong(jinkyu@skku.edu)

SSE2030: Introduction to Computer Systems, Spring 2019, Jinkyu Jeong ([email protected]) 13

Exercise 2

• Copy and Remove files– cd, cp, rm

dir_A

dir_B

file_1Copy

file_2Copy

dir_D

file_1 file_2Remove

Page 14: CSE 311 Introduction to Operating Systemscsl.skku.edu/uploads/SSE2030S19/LAB0_Introduction.pdf · 2019. 3. 20. · SSE2030: Introduction to Computer Systems, Spring 2019, Jinkyu Jeong(jinkyu@skku.edu)

SSE2030: Introduction to Computer Systems, Spring 2019, Jinkyu Jeong ([email protected]) 14

Exercise 3

• Searching– find file ‘file_2.c’– find pattern ‘Vim’– find, grep

dir_A

dir_B

file_1 file_2

dir_D

file_2

Page 15: CSE 311 Introduction to Operating Systemscsl.skku.edu/uploads/SSE2030S19/LAB0_Introduction.pdf · 2019. 3. 20. · SSE2030: Introduction to Computer Systems, Spring 2019, Jinkyu Jeong(jinkyu@skku.edu)

SSE2030: Introduction to Computer Systems, Spring 2019, Jinkyu Jeong ([email protected]) 15

GCC

• GNU C Compiler

• sudo apt-get update

• sudo apt-get install build-essential

• gcc –o test test.c

• https://modoocode.com/14