本笔记以这里为蓝本,在这个基础上做了些删减以及补充。
原作者blog:
第一章:Unix简介
第二章:什么是Linux & Unix
1) 内核
作用是控制计算机,充当操作系统核心。除非关闭计算机系统,否则内核一直运行。
提供基本服务包括:
- 内存管理(虚拟内存管理,包括分页)
- 进程管理(进程创建、终止、调度)
- 进程间通信(本地、网络)
- 输入/输出(通过设备驱动程序,即实现与物理设备实际通信的程序)
- 文件管理
- 安全和访问控制
- 网络访问(如TCP/IP)
2) The main difference between Linux and other types of Unix:
Linux uses a particular kernel that is different from other Unix kernels.
3)Monolithic kernels vs Micro kernels(聚内核 vs 微内核)
聚内核:规模较大,由非常庞大的程序构成,该程序自身可以完成所有的事情。
优点:速度快,效率高
缺点:规模大,使用不方便,较难维护
微内核:规模较小,是一个非常小的程序,只能执行最基本的任务。为了执行其他功能,微内核要调用其他程序,这些程序称为服务器(servers)。
优点:模块化设计,易于理解、修改和定制。
缺点:速度慢,效率低
*some Unixes, such as the Mac OS, use a micro kernel.
4) UNIX = KERNEL + UTILITIES
5)名次解释/历史部分
UNIX:1969年,贝尔实验室(属于AT&T)一名研究员开发。
FSF:自由软件基金会(Free Software Foundation)
GNU:“GNU's Not Unix”的缩写。描述自由软件基金会所开发的一个完全类Unix操作系统的项目的名称。
copyleft:非盈利版权
GPL:General public license的缩写,通用公共许可证。The GPL says that anyone may distribute the software, view the source code, modify it, and distribute the changes. Furthermore - and this is the crucial part - no one who redistrubutes the software, including modified versions, can take away any of the freedoms or add any restructions of his own. The GPL ensures that, whenever anyone uses a free software to create a new product, the new product can not be distributed except under the GPL. In pratical terms, this means that if someone starts with free software, changes it and redistributes it, he must also release the source code.
BSD:Berkley Software Distribution,伯克利软件套件。1992年时,完全与UNIX分离。三个主要发行版:FreeBSD,NetBSD,OpenBSD
System V:AT&T公司1985年发布的UNIX
Linux:单内核,基于GNU GPL,1991年9月发行了第一版内核。
第三章:Unix连接
1) Host and Terminal
Computer = Terminal + Host(主机)
Terminal = Input facility +Output Facility
*Windows was created specifically for single-user PCs, Microsoft never completely separated the terminal from the host.
*Unix was designed as a multiuser system. This meant that more than one person could use a computer at the same time, as long as (1) each person had his own terminal, and (2) that terminal was connected to a host.
2) Console
所有连接到主机的终端中,有一台比较特殊,被认为是计算机本身的一部分,它是用来管理系统的,它被称为console。Typically, the console is used by the system administrator to manage the system.
* Today, the word "console" is often used as a synonym for "terminal".
3) Character Terminals and Graphical Terminals
* What's interesting is that, over thirty years later, the system still works well. Most of the time, text is all you need.
第四章:开始使用Unix
1) Unix区分大小写字母
2) 输入一个不存在的userid时,系统也会询问其密码。
3) 登陆之后先是的时间为上次登陆时间,注意核对。
4) 超级用户:使用root登陆的
5) shell提示:Bash和Korn Shell提示为$,C-shell提示为%,使用root登陆时,提示符均为#
6) 命令/程序
whoami:显示当前用户标识
who:显示所有当前登陆的用户标识
w:显示登录的用户及其在做什么
date:显示时间和日期
logout/exit:注销
login:注销后为登陆做准备(有的系统将临时改变用户标识,新用户注销后,将返回原始会话)
passwd:改变口令
last:查看上一次或最近几次登陆时间。(+用户标识,则只查看此用户信息.例如last yiran)
第五章:GUI:图形用户界面
1) GUI:图形用户界面. 读音为"G-U-I"或者"gooey".
* When you use Unix, you get a strong feeling that the desktop environment is separate from the actual operating system.
2) X-Window
X Window is a system that provides services to programs that work with graphical data.
- 通常称其为X
- 可移植,与硬件无关
- 它是几乎所有的GUI基础
-它允许在远程计算机上运行,并在自己的计算机上显示完整的图形输出
-Today, X is maintained by an independent group called X.Org
3) Window Manager(窗口管理器):提供实际GUI。
4) Layers of Abstraction
- Application Programs/User -
- Desktop Environment -
- Window Manager -
- X Window -
- Device Drivers In The Kernel -
- Hard Ware -
5) 两个流行的桌面环境
- KDE(Kool Desktop Environment):个人自由使用,不能用于商业用途. window manager - kwm
- Gnome(GNU Network Object Model Environment):比KDE更“自由”. window manager - Metacity
* Many non-technical people choose KDE, while others like Gnome.
第六章:Unix 工作环境
1) Process
A process is a program that is loaded into memory and ready to run, along with the program's data and the information needed to keep track of that program.
2) Timeslice and Scheduler
Unix uses a system in which each process in turn is allowed to use the processor for a very short interval, called a TimeSlice. A typical time slice would be 10 milliseconds. Once the timer slice is over, the current process is put on hold and a special service called the Scheduler decides which process to execute next.
3) CLI & GUI
- GUI : Graphical User Interface
- CLI : Command Line Interface (*usually called "command line")
4) Runtime Level
- Unix can boot as either a GUI-based system or as a CLI-system. Linux will boot, by default, into either runlevel 3 or runlevel 5. If your system is set to boot into runlevel 3, you will see a text-based login screen.
- Level 1 is used to be called System Maintenance Mode and is now called Single User Mode. Today this mode is not used much. Because modern Unix systems are so flexible that admins can do a lot of work even upgrades and maintenance while other users are logged in.
- The command to change runlevels is called init(superuser). eg., to shutdown a computer, "sudo init 0"
运行级别 | 描述 |
0 | 停机(关机) |
1 | 单用户模式:命令行 |
2 | Not standardized |
3 | 多用户模式:CLI |
4 | Not standardized |
5 | 多用户模式:GUI |
6 | 重新启动 |
5) 一些名词
- 加速键(accelerator key):(似乎就是快捷键的意思)
- 快捷键(shortcut key)
- 下拉菜单(pull-down menu)
- 弹出式菜单(pop-up menu):可以出现在任何地方,但是要一些特定的动作发生之后才会出现。
- 上下文菜单(context menu):弹出式菜单的一种,右键单击某项时
- 任务切换:改变活跃窗口的一种方式。快捷键alt+tab,逆序切换快捷键alt+shift+tab
- 工作空间(workspace):即桌面,默认提供4个桌面,可在右下角桌面图标上右键来增减桌面数量。
切换桌面快捷键:
KDE:ctrl+tab和ctrl+shift+tab
Gnome:ctrl+alt+up,ctrl+alt+down,ctrl+alt+left,ctrl+alt+right
6)Virtual Consoles(虚拟控制台)
#1-6全屏,基于文本终端,#7为图形终端。(与之前说过的控制台概念不一样,用虚拟终端更合适)
快捷键ctrl+atl+F1,2,3,4,5,6,7
7) 临时切换用户
su(substitute userid)
su (+用户名):切换到此用户,输入exit后回到原始用户。默认切换到root用户。例如"su Yiran"
su - (+用户名):切换用户并且切换工作环境。例如"su -Yiran"
exit: 退出切换时输入
8) 以超级用户执行一条命令
sudo(substitute the userid and do something,替换当前用户标识,然后做一些事情):默认用户标识为root。
sudo +command
输入过一次密码之后,在一定时间内不必再输入,大多数系统默认为5分钟
/etc/sudoers文件中,保存着可以使用sudo命令用户的列表。
9) less命令
Display the contents of a file, one screenful at a time. eg., "less /etc/passwd"
- Move forward: <space>
- Move back: <b>
- quit: <q>
10) Reboot and Shundown
- Reboot : "sudo reboot" or "sudo init 6"
- Shutdown"sudo shutdown now"(需要加时间参数) or "sudo init 0"
11) 系统上一些配置文件
/boot/grub/menu.lst 关于计算机可以引导的操作系统的信息
/etc/hosts 系统已知的一系列主机名称和ip地址
/etc/inittab 不同运行级别的定义
/etc/passwd 每个用户标识的基本信息(实际口令是加密的,保存在其他地方)
/etc/profile 当一个用户标识登录时,系统自动执行的命令
/etc/samba/smb.conf Samba的配置信息,Samba是一个允许Unix系统和Windows系统共享文件和打印机的工具