31
Linux Taesoo Kwon Dept. of Compupter Science Hanyang University

Linux - Hanyangcalab.hanyang.ac.kr/courses/SP_taesoo/prct_01.pdf · 2014. 12. 21. · Which Linux Distribution is better? > 300 Linux Distributions Slackware (one of the oldest, simple

  • Upload
    others

  • View
    18

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Linux - Hanyangcalab.hanyang.ac.kr/courses/SP_taesoo/prct_01.pdf · 2014. 12. 21. · Which Linux Distribution is better? > 300 Linux Distributions Slackware (one of the oldest, simple

Linux

Taesoo Kwon

Dept. of Compupter ScienceHanyang University

Page 2: Linux - Hanyangcalab.hanyang.ac.kr/courses/SP_taesoo/prct_01.pdf · 2014. 12. 21. · Which Linux Distribution is better? > 300 Linux Distributions Slackware (one of the oldest, simple

What is Unix?

A multi-task and multi-user Operating System Developed in 1969 at AT&T’s Bell Labs by

Ken Thompson (Unix) Dennis Ritchie (C) Douglas Mcllroy (Pipes - Do one thing, do it well) Re-written in C in 1972 (The first OS written in C)

Some other variants: System V, Solaris, SCO Unix, SunOS, 4.4BSD, FreeBSD, NetBSD, OpenBSD, BSDI

Linux, MacOS

Page 3: Linux - Hanyangcalab.hanyang.ac.kr/courses/SP_taesoo/prct_01.pdf · 2014. 12. 21. · Which Linux Distribution is better? > 300 Linux Distributions Slackware (one of the oldest, simple

What is Linux?

A clone of Unix Developed in 1991 by Linus Torvalds, a Finnish

graduate student Inspired by and replacement of Minix Linus' Minix became Linux Open source development model Consist of

Linux Kernel GNU (GNU is Not Unix) Software Software Package management Others

http://www.linuxdevices.com/files/misc/ibm-watchpad.jpg

Page 4: Linux - Hanyangcalab.hanyang.ac.kr/courses/SP_taesoo/prct_01.pdf · 2014. 12. 21. · Which Linux Distribution is better? > 300 Linux Distributions Slackware (one of the oldest, simple

What is Linux?

Originally developed for 32-bit x86-based PC

Ported to other architectures, eg. Alpha, VAX, PowerPC,

IBM S/390, MIPS, IA-64 PS2, TiVo, cellphones,

watches, Nokia N810, NDS, routers, NAS, GPS, …

Page 5: Linux - Hanyangcalab.hanyang.ac.kr/courses/SP_taesoo/prct_01.pdf · 2014. 12. 21. · Which Linux Distribution is better? > 300 Linux Distributions Slackware (one of the oldest, simple

Which Linux Distribution is better? > 300 Linux Distributions

Slackware (one of the oldest, simple and stable distro.) Redhat

RHEL (commercially support) Fedora (free)

CentOS (free RHEL, based in England) SuSe ( based in German) Gentoo (Source code based) Debian (one of the few called GNU/Linux) Ubuntu Knoppix (first LiveCD distro.) …

Page 6: Linux - Hanyangcalab.hanyang.ac.kr/courses/SP_taesoo/prct_01.pdf · 2014. 12. 21. · Which Linux Distribution is better? > 300 Linux Distributions Slackware (one of the oldest, simple

Which Linux Distribution is better?

Source:http://futurist.se/gldt/

CentOS

Ubuntu

Knoppix

Gentoo

Slackware

Redhat

Debian

Page 7: Linux - Hanyangcalab.hanyang.ac.kr/courses/SP_taesoo/prct_01.pdf · 2014. 12. 21. · Which Linux Distribution is better? > 300 Linux Distributions Slackware (one of the oldest, simple

Which Linux Distribution is better? Ask yourself these questions (from LAH)

Is it going to be around in 5 yrs? Is it giong to stay on top of the latest security

patches? Is it going to release updated software promptly? If I have problems, will the vendor talk to me?

We will use Ubuntu

Page 8: Linux - Hanyangcalab.hanyang.ac.kr/courses/SP_taesoo/prct_01.pdf · 2014. 12. 21. · Which Linux Distribution is better? > 300 Linux Distributions Slackware (one of the oldest, simple

Linux installation

Page 9: Linux - Hanyangcalab.hanyang.ac.kr/courses/SP_taesoo/prct_01.pdf · 2014. 12. 21. · Which Linux Distribution is better? > 300 Linux Distributions Slackware (one of the oldest, simple

Page 9

방법 1: VirtualBox 에 Ubuntu 12.04 LTS 설치

Ubuntu Desktop 최 신 버 전 받 기 (32-bit) http://www.ubuntu.com/getubuntu/download

VirtualBox 에 서 우 분 투 (Ubuntu) 용 가 상 머 신 만 들 기

– http://www.psychocats.net/ubuntu/virtualbox

– http://www.deltalounge.net/wpress/2012/06/virtualbox-install-ubuntu-12-04/

기 본 설 정 에 서 는 가 상 머 신 의 해 상 도 가 데 스 크 탑 해 상 도 와 다 름

– 해 결 방 법

– Download the guest edition for your virtualbox version!● visit http://download.virtualbox.org/virtualbox/4.1.20/● download VBoxGuestAdditions_4.1.20.iso

– 게 스 트 에 디 션 설 치

– http://www.dedoimedo.com/computers/virtualbox-guest-addons.html

– (see “Install Guest Additions on Linux guest” section)

Page 10: Linux - Hanyangcalab.hanyang.ac.kr/courses/SP_taesoo/prct_01.pdf · 2014. 12. 21. · Which Linux Distribution is better? > 300 Linux Distributions Slackware (one of the oldest, simple

Page 10

방법 3: LinuxConsole.zip

http://www.virtualbox.org 접속

Page 11: Linux - Hanyangcalab.hanyang.ac.kr/courses/SP_taesoo/prct_01.pdf · 2014. 12. 21. · Which Linux Distribution is better? > 300 Linux Distributions Slackware (one of the oldest, simple

Page 11

Download VirtualBox 페이지에서 windows hosts ->x86/amd64 클릭 후 다운로

Page 12: Linux - Hanyangcalab.hanyang.ac.kr/courses/SP_taesoo/prct_01.pdf · 2014. 12. 21. · Which Linux Distribution is better? > 300 Linux Distributions Slackware (one of the oldest, simple

Page 12

설치 과정은 생략Next 버튼 클릭… ..

Page 13: Linux - Hanyangcalab.hanyang.ac.kr/courses/SP_taesoo/prct_01.pdf · 2014. 12. 21. · Which Linux Distribution is better? > 300 Linux Distributions Slackware (one of the oldest, simple

Page 13

USB 메모리에 담아온 LinuxConsole.zip 파일을 압축 해제한다 .http://calab.hanyang.ac.kr/courses/SP_taesoo/LinuxConsole.zip

Page 14: Linux - Hanyangcalab.hanyang.ac.kr/courses/SP_taesoo/prct_01.pdf · 2014. 12. 21. · Which Linux Distribution is better? > 300 Linux Distributions Slackware (one of the oldest, simple

Page 14

Virtualbox 실행 후 새로 만들기 (N) 를 눌르면 가상 머신 만들기 창이 뜸

이름을 입력하고 종류와 버전에 리눅스와 우분투를 선택그리고 다음 버튼 클릭

Page 15: Linux - Hanyangcalab.hanyang.ac.kr/courses/SP_taesoo/prct_01.pdf · 2014. 12. 21. · Which Linux Distribution is better? > 300 Linux Distributions Slackware (one of the oldest, simple

Page 15

메모리를 설정 후 다음 버튼을 누릅니다 .

Page 16: Linux - Hanyangcalab.hanyang.ac.kr/courses/SP_taesoo/prct_01.pdf · 2014. 12. 21. · Which Linux Distribution is better? > 300 Linux Distributions Slackware (one of the oldest, simple

Page 16

기존 가상 하드 드라이브 파일 사용에 체크 하고 폴더 아이콘을 누릅니다 .

Page 17: Linux - Hanyangcalab.hanyang.ac.kr/courses/SP_taesoo/prct_01.pdf · 2014. 12. 21. · Which Linux Distribution is better? > 300 Linux Distributions Slackware (one of the oldest, simple

Page 17

압축 해제한 ubuntu.vdi 파일을 선택하고 열기합니다 .

Page 18: Linux - Hanyangcalab.hanyang.ac.kr/courses/SP_taesoo/prct_01.pdf · 2014. 12. 21. · Which Linux Distribution is better? > 300 Linux Distributions Slackware (one of the oldest, simple

Page 18

선택된 파일을 확인 후 만들기 버튼을 누릅니다 .

Page 19: Linux - Hanyangcalab.hanyang.ac.kr/courses/SP_taesoo/prct_01.pdf · 2014. 12. 21. · Which Linux Distribution is better? > 300 Linux Distributions Slackware (one of the oldest, simple

Page 19

VirtualBox 관리자의 좌측 목록에 생성된 2 번째에서 입력한 이름이 적힌 목록을 더블 클릭하여 실행합니다 .

Page 20: Linux - Hanyangcalab.hanyang.ac.kr/courses/SP_taesoo/prct_01.pdf · 2014. 12. 21. · Which Linux Distribution is better? > 300 Linux Distributions Slackware (one of the oldest, simple

Page 20

ubuntu 12.04 이 실행되는 화면이 나옵니다 .초기 유저 아이디는 hanyang 이며

초기 유저 패스워드도 hanyang 입니다 .

Page 21: Linux - Hanyangcalab.hanyang.ac.kr/courses/SP_taesoo/prct_01.pdf · 2014. 12. 21. · Which Linux Distribution is better? > 300 Linux Distributions Slackware (one of the oldest, simple

Page 21

• 수업 중 사용할 유틸리티 미리 설치 • sudo apt-get install gcc cmake build-essentials vim• sudo apt-get upgrade• sudo apt-get update

• 우분투 종료 명령어• sudo shutdown –h now

• 수업 후 백업하여 다음시간에 이어서 실습하시기 바랍니다 .• ubuntu.vdi 파일을 (C:\user\ 사용자이름 \VirtualBox

VMs\ubuntu.vdi) 개인 USB 메모리에 백업해서 다음 시간에 가져와서 다시 실습하시면 됩니다 .

Page 22: Linux - Hanyangcalab.hanyang.ac.kr/courses/SP_taesoo/prct_01.pdf · 2014. 12. 21. · Which Linux Distribution is better? > 300 Linux Distributions Slackware (one of the oldest, simple

Page 22

Let's learn Unix shell commands(These days, everybody uses GUI.But shell commands are still absolutely useful for programmers!)

● ls

● ls -l

● mkdir ttt

● cd ttt

● rm abc

● cd ~

● cat abc

● find /usr/include

● find . -iname “*.txt”

● grep “asdf” *.txt

http://freeengineer.org/learnUNIXin10minutes.html

디 렉 토 리 이 동

파 일 목 록

디 렉 토 리 만 들 기

홈 디 렉 토 리 로 이 동

파 일 보 기

파 일 에 서 문 자 열 검 색

파 일 찾 기 ( 서 브 디 렉 토 리 포 함 )

파 일 삭 제

Page 23: Linux - Hanyangcalab.hanyang.ac.kr/courses/SP_taesoo/prct_01.pdf · 2014. 12. 21. · Which Linux Distribution is better? > 300 Linux Distributions Slackware (one of the oldest, simple

Fish vs. Fishing

Google “linux package management” rpm “linux package management” apt-get linux OR windows linux faq filetype:pdf

Info Text-base, menu-based help from GNU $ ls --help $ man ls

Page 24: Linux - Hanyangcalab.hanyang.ac.kr/courses/SP_taesoo/prct_01.pdf · 2014. 12. 21. · Which Linux Distribution is better? > 300 Linux Distributions Slackware (one of the oldest, simple

Fish vs. Fishing (cont)

Manpage $ man ls $ man mkdir $ man man $ man -k mkdir

Manpage sections 1 User-level cmds and

apps /bin/mkdir

2 System calls int mkdir(const char *, …);

3 Library calls int printf(const char *, …);

4 Device drivers and network protocols /dev/tty

5 Standard file formats /etc/hosts

6 Misc. files and docs man locale

7 System admin. Cmds /sbin/reboot

$ manpath

Page 25: Linux - Hanyangcalab.hanyang.ac.kr/courses/SP_taesoo/prct_01.pdf · 2014. 12. 21. · Which Linux Distribution is better? > 300 Linux Distributions Slackware (one of the oldest, simple

Basic Commands

ls $ ls -l $ ls -a $ ls -la $ ls -l --sort=time $ ls -l --sort=size -r

cd $ cd /usr/bin

pwd $ pwd

~ $ cd ~

~user $ cd ~weesan

What will “cd ~/weesan” do?

which $ which ls

whereis $ whereis ls

apt-get $ sudo apt-get install cmake

find $ find / | grep stdio.h $ find /usr/include | grep stdio.h $ find . -iname “*.txt” | xargs

grep “asdf”

Page 26: Linux - Hanyangcalab.hanyang.ac.kr/courses/SP_taesoo/prct_01.pdf · 2014. 12. 21. · Which Linux Distribution is better? > 300 Linux Distributions Slackware (one of the oldest, simple

Basic Commands (cont) echo

$ echo “Hello World” $ echo -n “Hello World” $ echo -e “Hello\n World”

cat $ cat /etc/passwd $ cat /proc/cpuinfo $ echo “hello world” > foo $ cat foo

cp $ cp foo bar $ cp -a foo bar

mv $ mv foo bar

mkdir $ mkdir foo

rm $ rm foo $ rm -rf foo $ rm -i foo $ rm -- -foo

More will be covered later chmod, chown, passwd...

Page 27: Linux - Hanyangcalab.hanyang.ac.kr/courses/SP_taesoo/prct_01.pdf · 2014. 12. 21. · Which Linux Distribution is better? > 300 Linux Distributions Slackware (one of the oldest, simple

Basic Commands (cont)

zip $ zip a.zip file1 file2

unzip $ unzip a.zip

tar $ tar cvfp lab1.tar lab1

gzip $ gzip -9 lab1.tar

untar & ungzip $ tar xvfz lab1.tar.gz

touch $ touch foo $ cat /dev/null > foo

Page 28: Linux - Hanyangcalab.hanyang.ac.kr/courses/SP_taesoo/prct_01.pdf · 2014. 12. 21. · Which Linux Distribution is better? > 300 Linux Distributions Slackware (one of the oldest, simple

Basic Commands (cont)

Disk usage $ df -h /

File space usage $ du -h ~/

Advance stuff $ ssh eon who $ ssh eon ‘cd .html ; tar cvfp - cs183 | gzip -9c’ | tar

xvfpz - $ ssh kilo-1 ‘tar cvfp - /extra/weesan’ | tar xvfp - -C /

Page 29: Linux - Hanyangcalab.hanyang.ac.kr/courses/SP_taesoo/prct_01.pdf · 2014. 12. 21. · Which Linux Distribution is better? > 300 Linux Distributions Slackware (one of the oldest, simple

Stop displaying texts

Ctrl +c (stop the current process) Ctrl +s (start flow control - try it!!!) Ctrl +q (stop flow control)

Page 30: Linux - Hanyangcalab.hanyang.ac.kr/courses/SP_taesoo/prct_01.pdf · 2014. 12. 21. · Which Linux Distribution is better? > 300 Linux Distributions Slackware (one of the oldest, simple

Quiz

1. How do you get help about the command cp?

2. How do you display a listing of file details such as date, size, and access permissions?

3. How do you display the first 15 lines of stdio.h? (hint : use the “head” command)

Page 31: Linux - Hanyangcalab.hanyang.ac.kr/courses/SP_taesoo/prct_01.pdf · 2014. 12. 21. · Which Linux Distribution is better? > 300 Linux Distributions Slackware (one of the oldest, simple

Page 31

감사합니다 .

• 강의 시간이 끝나면 PC 전원을 꼭 꺼주시기 바랍니다 .

• 가지고 오신 쓰레기는 나가시면서 꼭 쓰레기통에 넣어주시기 바랍니다 .