210 likes | 322 Views
Lab1. Linux Basic Commands, Shell and Kernel Compiling. Chulmin Kim cmkim@core.kaist.ac.kr Computer Engineering Research Lab. EECS, KAIST. Contents. 1. Objectives. 2. Environment Configuration. 3. Basic Commands and Shell. 4. About Kernel. 5. Summary and Policies.
E N D
Lab1 Linux Basic Commands, Shell and Kernel Compiling Chulmin Kim cmkim@core.kaist.ac.kr Computer Engineering Research Lab. EECS, KAIST
Contents 1 Objectives 2 Environment Configuration 3 Basic Commands and Shell 4 About Kernel 5 Summary and Policies
Objectives of Lab1-1 • Linux? • Operating System for general PC or Embedded Device • Based on UNIX • GNU support • Various Distributions : Fedora, Debian, Ubuntu, OpenSUSE, Redhat • Characteristics • Multiusers • Opensource • Low cost (almost zero, while WIN7 cost about 200,000 won)
Objectives of Lab1-1 • Internal of Linux : Kernel
Objectives of Lab1-1 • Get used to Linux! • Opensource-Based • Do-It-Yourself • As you wish • Lots of Tools, Simulators, Benchmarks and ETC already optimized to Linux • Sometimes, you can do your job more efficiently. • Using shell commands shown in this lab.
Environment • Screenshots 3. Type ID & PW 1. SET Machine IP 2. Click Open 4. Then, you will see the prompt.
Environment • Caution! • After accessing your machine, • Change the password of your machine using ‘passwd’ • Basically, it is ‘monday or tuesday or thursday’. However, it is too easy, right? • Never reboot, or shutdown! • … sorry for this. Someone else might use your machine.
Basic Commands & Shell • What is Shell? • Command Interpreter • Connecting User and Kernel • Monitoring Status of Machine • Not only executing simple commands such as cp, mkdir,,,, • You can see more than you expect • Species : Bash, Csh, Ksh, Zsh…. • We will use Bash!
Basic Commands & Shell • What is Shell? • Command Interpreter • Connecting User and Kernel • Monitoring Status of Machine • Not only executing simple commands such as cp, mkdir,,,, • You can see more than you expect • Species : Bash, Csh, Ksh, Zsh…. • We will use Bash!
Basic Commands & Shell • Commands on Shell • Simple Commands • cp, rm, mkdir, rmdir, mv, ln, ls (FILE) • more, cat, grep, dmesg (print out on console) • ps, w, top, uname, whoami, date, uptime (system state) • chown, chmod (authorization) • useradd, userdel, passwd (users) • Ping, ifconfig, netstat, route, iptables (network) • AND SO ON… Lots of things are there~
Basic Commands & Shell • Shell Script (Very Much Important for this lab) • It is a file usually named xxx.sh • Should do `chmod 755 xxx.sh` to execute it. • Always start with #!/bin/bash (when using bash) • Similar with C programming • For do done : irritation • If then fi : condition • Echo ~= printf • Can execute commands of shell • Cd, cp, mkdir ….
Basic Commands & Shell • Shell Script (Very Much Important for this lab) • Examples shown in the material • Changing gif -> jpg • Googling as much as you can. #!/bin/bash # 파일 확장자 바꾸기. # rfe old_extension new_extension # 예제: # 현재 디렉토리의 모든 *.gif 파일을 *.jpg로 바꾸기 # rfe gif jpg if [ $# -ne 2 ] then echo "사용법: `basename $0` old_file_suffix new_file_suffix" exit 1 fi for filename in *.$1 # 첫 번째 인자로 끝나는 파일들을 찾아서 do mv $filename ${filename%$1}$2 # 파일 이름에서 첫 번째 인자 부분을 떼어내고 두 번째 인자를 붙인다. done
About Kernel • What is Kernel? • Core Part of OS • Managing and monitoring resources • Allocating resources to users • Deal with Process, File System, Memory, Network…
About Kernel • Kernel Compiling • Why do we need Compiling of Kernel? • To use some special features of devices, options usually disabled in default should be enabled. • For the light environment such as Embedded System, we should minimize the kernel as much as possible. • Fast Booting Time • Avoid to execute processes which will never be used. Options for Linux Kernel -> After executing ‘make menuconfig’
About Kernel • Steps for Kernel Compiling • Kernel Configuration • Make Menuconfig • Check Dependencies • Make Dep • Kernel Compile • Make bzImage or Make install • Module Compile and Install • Make modules && make modules_install • Boot using the newly-created kernel. • Modify /boot/grub/grub.conf, then reboot. • Choosing the kernel version you want to boot with
Summary of LAB1-1 • Prob1. Printing Out Directories as a tree structure. • Example result (tree command in linux) • Hints for Shell Script • Recursive! • For, if(to check it is directory or not), cd, let…
Summary of LAB1-1 • Prob2. Automatic Backup using Script and Cron • Hints for Cron • Crond, crontab, (automatic execution) • Tar,gz (archiving) • Date (for filename indicating time information)
Summary of LAB1-1 • Prob3. Measuring Network Performance • Ab result • Useful keyword • For, if • Grep • echo ….. >> result.txt
Summary of LAB1-1 • Prob4. Imagine your own script! • Whatever you want • You can bring a script from web. • You should modify reasonably. • Also, you should notify what you’ve modified. • For all exp problems, • Ok to refer scripts from web or books • Modify as much as you can for your report. • You should understand every line of scripts
Policies of LAB1-1 • Pre-Report • Individual Work • Due Date : Before you finish your experiment. • Main-Report • 1 per each group • Due Date : 3/4 • Grading Policy • Total 100 points • Average : 80 points • If there is no global policy, • Pre : 30%, Demo : 30%, Main & Source Code: 40% • Report Delay : 10%/day • Copy : 0 points without exception. (both sides)
Thank You ! Please, check the board and reply your team information at the notice. (http://core.kaist.ac.kr/~EE505)