Presentation is loading. Please wait.

Presentation is loading. Please wait.

LINUX 설치 와 VI editor 사용.

Similar presentations


Presentation on theme: "LINUX 설치 와 VI editor 사용."— Presentation transcript:

1 LINUX 설치 와 VI editor 사용

2 LINUX UNIX 형태의 공개 운영체제 주로 서버용으로 쓰이나 점차 개인사용자를 위한 편의를 늘려가고 있음
종류 : redhat, ubuntu, fedora, suse, 등

3 Korea (fedora mirror sites)
페도라 프로젝트 사이트 Korea (fedora mirror sites) ftp.kaist.ac.kr

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18 주의 사항 MS 윈도우와의 멀티부팅 시스템 환경 설정 외에는 root 사용 자제 윈도우 설치 후 리눅스 설치
추가 파티션 혹은 HDD 필요 시스템 환경 설정 외에는 root 사용 자제 시스템 손상 가능 사용자 계정을 추가하여 사용

19 VMware (가상 머신 소프트웨어)

20 기초 명령어 vi gcc g++ pwd ls mkdir <이름> rmdir <이름>
현재 위치 보기 ls 현재 위치의 내용 보기 mkdir <이름> 디렉토리 생성 rmdir <이름> 디렉토리 삭제 cat <파일 이름> 파일 내용 보기 cp <복사할 파일> <복사할 위치> 파일 복사 mv <파일 이름> 이동 rm <파일 이름> 삭제 startx x-window 실행 cd <경로> 경로로 이동 vi gcc g++ chmod 파일/디렉토리 권한 변경 ln 링크 passwd <사용자계정> 암호 변경 useradd 사용자추가 root만 사용 가능 man <명령어> 명령어 메뉴얼 출력

21 ls 현재 위치의 내용 보기

22 mkdir <이름> 디렉토리 생성

23 cat <파일 이름> 파일 내용 보기

24 pwd 현재 위치 보기 cd <경로> 경로로 이동

25 mv <파일 이름> 이동

26 rm <파일 이름> 삭제

27 chmod 파일/디렉토리 권한 변경

28 man <명령어> 명령어 메뉴얼 출력

29 man <명령어> 명령어 메뉴얼 출력

30 사용자 추가 및 암호 설정 root로 로그인 # adduser test # passwd test

31 위치 이동 MS-WINDOW 역슬러시[\]로 경로 구분 C:\HND\ LINUX 슬러시로 경로 구분 /home/test/

32 VI editor Visual Editor 리눅스에서 사용하는 텍스트 편집기 키보드만으로 거의 모든 작업 처리 가능

33 VI 실행 vi [filename] (예 : vi test2)

34 VI Mode 입력 모드 명령 모드 ex 모드

35 Insert mode 입력 모드

36 VI Mode 명령 모드

37 VI Mode ex 모드

38 GNU Compiler Collection
C, C++, JAVA, Fortran 지원 gcc GNU C 컴파일러 g++ GNU C++ 컴파일러

39 파일 작성 & 저장 (1) 명령모드에서 ‘i’키를 눌러 입력모드로 전환 (2) 문서 작성
(3) ESC키를 눌러 명령모드로 전환 (4) “:”키로 ex모드 전환 (5) ”wq” 입력(w : 저장 / q : 종료)

40 EX 모드 기본 명령어 q : 종료 w : 저장 wq : 저장 후 종료 set nu : 열 숫자 표시

41 키워드 검색 명령모드 ‘/’키 혹은 ‘?’키를 눌러 검색 검색된 키워드간의 이동은 “n”, “N”키로 이동
‘/’는 커서 위치에서 밑으로 검색 ‘?’는 커서 위치에서 위로 검색 검색된 키워드간의 이동은 “n”, “N”키로 이동 n : 다음 키워드 N : 이전 키워드

42 컴파일 소스코드의 확장은 ‘cpp’ 사용 C++ 컴파일에는 g++를 사용 g++ [소스파일]
예) test1.cpp, cal.cpp C++ 컴파일에는 g++를 사용 g++ [소스파일] 처리 결과로 ‘a.out’ 파일이 생성됨 g++ –o [출력파일] [소스파일] a.out 대신 생성될 파일 이름 지정 예) g++ –o output.exe test1.cpp output.exe 파일 생성 실행 : ./output.exe

43 실습 Create a file “guessNumber.cpp” using the following program into a directory of your Linux system Edit it to add information on author, date, time, and the assignment. Change all messages shown on the screen from English to Korean. Create an executable, following the build procedure that we discussed in the class and create an executable program. Run the program and have it validated by TA during your lab hours.

44 실습 // Randomly generate numbers between 1 and 1000 for user to guess.
#include <iostream> using std::cin; using std::cout; using std::endl; #include <cstdlib> using std::rand; #include <ctime> void guessGame(); // function prototype bool isCorrect( int, int ); // function prototype int main() { srand( time( 0 ) ); // seed random number generator guessGame(); return 0; // indicate successful termination } // end main // guessGame generates numbers between 1 and 1000 // and checks user's guess void guessGame() int answer; // randomly generated number int guess; // user's guess char response; // 'y' or 'n' response to continue game // loop until user types 'n' to quit game do { // generate random number between 1 and 1000 // 1 is shift, 1000 is scaling factor answer = 1 + rand() % 1000; // prompt for guess cout << "I have a number between 1 and 1000.\n" << "Can you guess my number?\n" << "Please type your first guess." << endl << "? "; cin >> guess; // loop until correct number while ( !isCorrect( guess, answer ) ) // prompt for another game cout << "\nExcellent! You guessed the number!\n" << "Would you like to play again (y or n)? "; cin >> response; cout << endl; } while ( response == 'y' ); } // end function guessGame // isCorrect returns true if g equals a // if g does not equal a, displays hint bool isCorrect( int g, int a ) { // guess is correct if ( g == a ) return true; // guess is incorrect; display hint if ( g < a ) cout << "Too low. Try again.\n? "; else cout << "Too high. Try again.\n? "; return false; } // end function isCorrect


Download ppt "LINUX 설치 와 VI editor 사용."

Similar presentations


Ads by Google