View
2
Download
0
Category
Preview:
Citation preview
SSE2030: Introduction to Computer Systems, Spring 2019, Jinkyu Jeong (jinkyu@skku.edu)
LAB Introduction
Prof. Jinkyu Jeong (Jinkyu@skku.edu)TA -- Donghyun Kim (wadong100@gmail.com)
TA – Jiwon Woo (jiwon.woo@csi.skku.edu)Computer Systems Laboratory
Sungkyunkwan Universityhttp://csl.skku.edu
SSE2030: Introduction to Computer Systems, Spring 2019, Jinkyu Jeong (jinkyu@skku.edu) 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/
SSE2030: Introduction to Computer Systems, Spring 2019, Jinkyu Jeong (jinkyu@skku.edu) 3
Virtual Machine
• Virtual Box– https://www.virtualbox.org/wiki/Downloads
• VMware– https://www.vmware.com/kr/products/workstation-
player/workstation-player-evaluation.html
SSE2030: Introduction to Computer Systems, Spring 2019, Jinkyu Jeong (jinkyu@skku.edu) 4
Ubuntu• Operating System based on Linux Kernel(Which is Unix-like OS)
• Downloads– https://www.ubuntu.com/download
• Recommended System Requirements
SSE2030: Introduction to Computer Systems, Spring 2019, Jinkyu Jeong (jinkyu@skku.edu)
GUI vs CLI
• Graphical User Interface (GUI)
– Windowing Systems …
• Command Line Interface (CLI)
– Unix-Shell, Command Prompt …
SSE2030: Introduction to Computer Systems, Spring 2019, Jinkyu Jeong (jinkyu@skku.edu) 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
SSE2030: Introduction to Computer Systems, Spring 2019, Jinkyu Jeong (jinkyu@skku.edu) 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
SSE2030: Introduction to Computer Systems, Spring 2019, Jinkyu Jeong (jinkyu@skku.edu) 8
Files
SSE2030: Introduction to Computer Systems, Spring 2019, Jinkyu Jeong (jinkyu@skku.edu) 9
Vim
• Vi IMproved
• Text Editor program for Unix
• sudo apt-get install vim
SSE2030: Introduction to Computer Systems, Spring 2019, Jinkyu Jeong (jinkyu@skku.edu) 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 창 간 이동
SSE2030: Introduction to Computer Systems, Spring 2019, Jinkyu Jeong (jinkyu@skku.edu) 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
SSE2030: Introduction to Computer Systems, Spring 2019, Jinkyu Jeong (jinkyu@skku.edu) 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
SSE2030: Introduction to Computer Systems, Spring 2019, Jinkyu Jeong (jinkyu@skku.edu) 13
Exercise 2
• Copy and Remove files– cd, cp, rm
dir_A
dir_B
file_1Copy
file_2Copy
dir_D
file_1 file_2Remove
SSE2030: Introduction to Computer Systems, Spring 2019, Jinkyu Jeong (jinkyu@skku.edu) 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
SSE2030: Introduction to Computer Systems, Spring 2019, Jinkyu Jeong (jinkyu@skku.edu) 15
GCC
• GNU C Compiler
• sudo apt-get update
• sudo apt-get install build-essential
• gcc –o test test.c
• https://modoocode.com/14
Recommended