Week 2
Review
關於上週 PreTest 結論
Topic : What Unix / Why Linux
Ref: Ch1
Basic Unix Concept
Ref : Ch2
A kind of Operating System!
The operating system
Concept: Computers had to be hard-wired for every application prior to
operating systems.
A system that was not so complicated was necessary.
Can use of compilers for installing software on the various
platforms.
Unix history and background.
Concept: UNIX has been around since 1969.
UNIX began as a development platform for programmers.
It developed later in the powerful operating system it is due to
its popularity in the research and university environments.
Free software for four free features:
Free to research
Free to distribution
Free to use
Free to improve
C and Unix
Concept: C makes it possible to port any software to any hardware simply
by compiling the C program on the hardware that it will be
running on.
Notes: C was originally named B, then New B, then ultimately C.
The Growth of Unix
Concept: Berkeley Software Distribution began offering its own flavor of
Unix.
Notes: Prior to BSD Unix the BSD distribution included Pascal.
Unix was introduced at Berkeley when Ken Thompson of Bell
Labs took it there while a guest lecturer on operating
systems in 1975.
UNIX Today
Concept: Unix is now available for virtually all platforms that have a need
for it.
Unix as a Cultural Phenomenon
Richard Stallman of MIT .
He was very disappointed that major software vendors would license their
software and hide the code from other programmer
Concept: Unix as we know it has been affected by three major
movements.
Notes: Individual movements are covered below.
1. The Free Software Movement
Concept: Richard Stallman created a new project, which he called GNU or
“GNUs Not Unix”.
His objective was to create a new Unix-like operating system
with no Unix proprietary code.
Notes: The GNU General Public License, or GPL, later helped
launch the Linux operating system that is so popular today.
2. Linux and FreeBSD
Linux
Concept: The GNU project did not have a working kernel for
its Unix implementation; Linus Torvald’s Linux provided
the kernel.
Notes: Linus used the USENET newsgroup to gather support
for completing the kernel for his Linux operating system.
The first stable kernel was released in 1994.
http://video.google.com/googleplayer.swf?
docId=1061159908534146317&hl=en
FreeBSD
Concept: A variant of the popular BSD Unix is FreeBSD. It is
not, however, always free since it is often used as part of
another system that is proprietary.
Notes: FreeBSD is preferred by many users since it uses
original BSD Unix code.
3. The Open Source Movement
Concept: Since it was possible to charge for software under the GPL the
concept of Free software was changed to Open Source.
Notes: Eric Raymond, a programmer and author, wrote a famous
article called the “Cathedral and the Bazaar” to note the
advantages of open source software.
Flavors of Unix
Concept: In 1978 Bell Labs began to charge for Unix so
The University of California at Berkeley created it own free
version to counter that policy.
Notes: Many efforts, including Sun’s Solaris OS, have been
made to combine the two variations of Unix with some
success. POSIX compliance has greatly enhanced the
combining of the two flavors.
The Unix Philosophy
Concept: Keep it small.
Keep it consistent.
Keep it configurable.
Keep it non-captive.
Keep it automatable.
Notes: Using these principles the spirit of Unix will continue to
remain the best over-all operating system in the World.
What is an Operating System?
Concept: An operating system is the software who
se function is to enable other programs to use the computer's hardwar
e.
Notes: The operating system is responsible for c
ontrolling the processor, the hard disk(s), and the memory installed in t
he computer.
It is also responsible for any peripheral
devices which may be attached,
such as printers, external disk drives, m
odems, network cards, video or sound cards, and anything else
that can be added to a computer either
temporarily or permanently.
Structure of a Unix Operating System
Concept: All Unix variants have the same general s
tructure.
Notes: Unix is a modular operating system; you
can install as many modules as you like to perform a wide array of func
tions,
or you can install as few modules as are
needed to keep the machine running.
The modular nature of Unix makes it extr
emely flexible,
since you need only run the software nec
essary for your current requirements.
The operating system has three general
components: the kernel, the shell, and the file system.
start stop
The Kernel
Concept: The kernel can be thought of as the "traff
ic cop" of the operating system.
Its primary job is to manage the flow of e
lectrical signals through the computer's hardware.
Notes: Most people probably never issue an ope
rating system command directly to the kernel.
This is due to the user interface, a piece
of software that makes dealing with the operating system and kernel e
asier for humans.
The user interface for non-GUI Unix syste
ms is the shell.
The Shell (6)
Concept: The term "shell" is generally used to desc
ribe a text-based user interface, such as those traditionally found on U
nix systems.
Notes: The bash shell is the default user interfac
e on a Linux system.
Other Unices allow the user or system ad
ministrator to select their default shell.
bsh -- bourne shell -- Unix
bash -- bourne again shell -- Linux
csh -- c shell
ksh -- korn shell
tcsh -- enhanced c shell
zsh -- enhanced bourne shell
ls /bin/*sh
env 查詢目前使用者, 環境參數
echo $SHELL
The File System (4)
Concept: The Unix operating system handles every
thing as a file.
Notes: This section introduces links and pipes an
d explains their uses in a Unix system.
/opt 公用程式目錄
/mnt 外接裝置掛載點 cdrom
/bin 相關的標準指令 /sbin
/usr 歷代管理者主要系統安裝或系統轉換
時,
所產生的安裝檔或程式檔.
/lib 程式庫, library code
/etc 系統相關設定檔
/home 使用者帳號位置,所存放的集中處.
/dev 所有裝置的識別,
/var 系統服務所需的暫存檔
/tmp 可刪除的暫存檔
link : 實體鏈結 (hard link) : 限同一磁區中
執行
ln FA FB
標記鏈結 (Symbolic link) : 不同磁區
中執行
ln -s F
A FB
通常會
有 -> 的標記
pipe : ls -l | more
Users
Accounts
Concept:A user can login to a Unix system provided the
y have an account on the Unix system.
Notes: An account contains these five distinct compon
ents:
1) A user name (info)
2) A password
3) A user ID
4) One or more Group memberships
5) A home directory
/etc/passwd
The Superuser (root)
Concept: The superuser account is all-powerful. It can re
ad, write, or execute any file on the system, including users' private fil
es.
Notes: The superuser account was created for th
e unique requirements of system administration.
The person who manages a Unix system
must be able to access every file on the machine immediately,
and cannot be hampered by file permiss
ions.
useradd -g users -d /home/帳號 帳號
(英文)
adduser --gid 100 --home /home/帳
號 帳號
ls /home
passwd 帳號
userdel -r 帳號
Logging into Your Account
This part covers what one will experience when logging
into a Unix system either via the X-Windows GUI or via a shell prompt.
Logging into Your Account
Concept: You may log into a Unix system using either a
GUI or a command line interface.
In either case you will be provided with a
place to enter your user ID and password.
Notes: You must verify that your assigned user I
D and password work before you can continue with course exercises.
Logging Out of Your Account
Concept: Unix accounts must be logged out of when you
are done working in order to maintain security over the entire system
Notes: It is especially important to log out if you
use machines in a lab or public setting, such as a library or Internet ca
f?.
Leaving your account logged on means t
hat some random person could masquerade as you and create a great
deal of trouble.
Homework :
請本週於自家電腦切實完成 Unix-Like 作業系統環境,
安裝作業系統方式及種類不限定, 請自行選定後安裝或完成 Live CD 的製作亦可.
請就上課所瞭解部份, 及你收集相關資料所得,
簡易比較 實際安裝在電腦中的 Unix-like 作業系統 與 Live CD 的方式 有何差異
處,
請於 eCampus 中提出你的想法與見解.
Preview
Preview : Understanding Unix Commands
Ref: Ch3