阅读时间: 4 分钟
Linux操作系统是一个类似Unix的开源操作系统。它最初是由Linus Torvalds在1991年9月17日开发的,其特点是自由和开源的操作系统,在GNU通用公共许可证下,源代码可以被修改并分发到任何人的商业或非商业的。
参考资料。Linux操作系统
Linux操作系统的议程
- 5W's 1H ◦操作系统介绍
- Linux简介(5W's h)
4W1H的实践
下面,你要学习的课题。
Linux在哪里使用?
我为什么要学习Linux?
谁开发了Linux?
在现实世界中,Linux是如何获得普及的?
什么是Linux?
一个开源的操作系统和社区开发的操作系统,用于计算机、服务器、大型机、移动设备和嵌入式设备。
操作系统如Ubuntu, Debian, Fedora, OpenSuse, Redhat, Android等。
什么是Unix?
Unix是一种只安装在特定硬件上的操作系统,Unix在1970年代中期为多用户和多任务而开发。Unix主要由Sun Solaris使用,只支持少数文件系统。
操作系统,如IBM AIX, Solaris, HP-UX, Darwin等。
Linux在哪里使用?
网络服务
网络
数据库
科学计算
为什么我应该学习Linux?
Linux是服务器的标准。这是没有办法的事。长期以来,Linux一直是最流行的HTTP服务器软件,它牢牢建立在Linux内核之上。
企业用户可能会倾向于Windows,因为与Windows的工作站兼容,但服务器管理员广泛地在Linux中工作,如你想了解并与服务器一起工作,你需要了解Linux。
为什么是Linux?
价格 - 免费
简易性 - 对用户不友好
可靠性--可运行多年
软件 - 大部分是企业级的软件
多任务处理 - 最适合多任务处理
安全性 - 非常安全
开放源代码 - 是的!大量的发行版
在现实世界中,Linux是如何获得普及的?
费用正确
可见的源代码
Linux提倡开放源代码,并对写在它上面的应用程序进行免费。
如何访问终端?
现在你在GUI中,在许多方面这与Windows或Mac OSX操作系统非常相似,访问终端你需要在左边的启动栏中寻找下面的图标。
现在,我们将看到Linux的基本命令
文件权限
文件权限显示为 ls -l:
student$ ls -l
total 64
-rwxrwxr-x 1 student student 832 Oct 2 16:26 backup.sh -rwxr-xr-x 1 student student 70 Mar 6 2016 hello.pl -rwxr-xr-x 1 student student 30832 Mar 6 2016 largefile.txt -rwxr-xr-x 1 student student 53 Mar 6 2016 quote.txt -rwxr-xr-x 1 student student 142 Mar 6 2016 records.data -rw-rw-r-- 1 student student 8 Oct 15 08:54 regex.txt -rwxr-xr-x 1 student student 53 Mar 6 2016 sed.out -rwxr-xr-x 1 student student 76 Mar 6 2016 wallquote.txt
基础知识。
r - read w - write x - execute
第一个字符可以是普通文件
d - directory l - symbolic link b - block file c - character device file p - named pipe s - socket
Chmod命令
用chmod改变文件的权限。
SUID和SGID
SUID(Set User ID)是一个访问标志,它允许可执行文件以可执行文件所有者或组的权限执行。
SGID(设置组ID)使文件和子目录继承该目录的GID。
SUID可执行文件
当普通用户执行需要高权限的程序时,SUID是必要的,例如修改/etc/shadow的密码工具。
$ ls -l /usr/bin/passwd
-rwsr-xr-x 1 root root 54256 Oct 16 19:37 /usr/bin/passwd
用s代替所有者的x权限表示
程序的SUID。
根据名称/内容的模式搜索文件
使用Linux命令行(shell)的人的一项常见任务是搜索具有
特定名称或包含特定文本
的文件/目录
。为了
完成这个任务
,有两个命令你应该熟悉一下
。
按名称查找文件
find /var/www -name '*.css'
This will print out the full path/filename to all files under /var/www that end in .css. Example output: /var/www/html/text-cursor.css
/var/www/html/style.css
文件操作
文件和目录(文件夹的另一个名称)是Linux的核心,因此能够
从命令行中
创建、查看、移动和
删除它们是非常重要的,而且功能相当强大。这些文件操作命令允许
你执行与图形化文件资源管理器相同的任务。
Create an empty text file called myFile: **touch** myFile Rename myFile to myFirstFile: **mv** myFile myFirstFile View the contents of a file: **cat** myFirstFile View the content of a file with pager (one screenful at a time): **less** myFirstFile View the first several lines of a file: **head** myFirstFile View the last several lines of a file: **tail** myFirstFile
**vi** myFirstFile
See what files are in your current working directory: **ls** Create an empty directory called myFirstDirectory: **mkdir** myFirstDirectory Create multi path directory: (creates two directories, src and myFirstDirectory) **mkdir -p** src/myFirstDirectory Move the file into the directory: **mv** myFirstFile myFirstDirectory/ You can also rename the file: **user@linux-computer:~$ mv myFirstFile secondFileName** Change the current working directory to myFirstDirectory: **cd** myFirstDirectory Delete a file: **rm** myFirstFile Move into the parent directory (which is represented as ..): **cd** .. Delete an empty directory: **rmdir** myFirstDirectory Delete a non-empty directory (i.e. contains files and/or other directories): **rm -rf** myFirstDirectory.
文件系统
- Linux将一切都视为文件
- 每个操作系统都使用称为文件系统的结构在磁盘驱动器上存储数据。文件系统由文件、目录以及访问和定位它们所需的信息组成。
- 不同类型的文件系统:EXT2, EXT3, XFS, windows:NTFS、FAT32
- Linux文件系统在目录和文件的层次结构中存储信息