- 1、本文档共11页,可阅读全部内容。
- 2、有哪些信誉好的足球投注网站(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。
- 3、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载。
- 4、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
Linux操作系统基础教程
提到Linux操作系统,就不能不提UNIX和GNU。UNIX是由ATTBell实验室于1969年开发的多用户、多任务操作系统,是目前广泛使用的商业操作系统。而GNU则开始于1984年,RichardStallman发起的GNU计划,目的是为了创建一套完全自由的操作系统(《GNU宣言》)。GNU是“GNU’sNotUnix”的递归缩写。(通用公共许可GNUGeneralPublicLicense,GPL,反版权copyleft,自由软件基金会
FreeSoftwareFoundation,FSF)。
1991年,LinusTorvalds编写了与UNIX兼容的LINUX操作系统并在GPL条款下发布。1992年,Linux与其他GNU软件结合,产生了完全自由的操作系统,所以Linux操作系统又被称为“GNU/Linux”。
三大主流shell
查看文件/etc/shell,可列出操作系统所包含的shell
Bourneshell——也称sh,是Version7Unix默认的UnixShell。
BourneAgainShell——多数Linux操作系统的默认shell,是Bourneshell(UCBerleley)的扩展,是Bourneagain/Bornagainshell的双关语,1987年由BrianFox创造。
Cshell,TCshell——模仿C的语法,开发与BSD系统,脱胎于第六版UNIX的/bin/sh,也是Bourneshell的前身,加入了alias,commandhistory等功能。
Kornshell是第一个UNIXshell,它完全向上兼容Bourneshell并包含了许多Cshell的特性。
查看用户的默认shell,请查看文件/etc/passwd
每个进程都有一个进程号pid,可用pstree或者ps–ef命令查看
常用Linux命令
uname
ls
ps
date
who
pwd
mkdir
rmdir
rm
touch
id
group
su
which
where
CShell
shbangline
#!/bin/csh或者#!/bin/tcsh
comments
#thisiscommentline
wildcards
localvariables
setvariable=valuesettom=”tom”
globalvariablessetenvvariablevaluesetenvtomtom
extractthevariablevalueecho$variable_nameecho$name
echo$PRINTER
userinput
echo“whatisyourname?”setname=$
arguments
scriptnamearg1arg2arg3echo$1,$2,$3
echo$*
arrays
setword_list=(word1,word2word3)echo$world_list[2]
echo$word_listecho$word_list[*]
commandsubstitution
Setvariable_name=`command`
Echo$variable_name
arithmetic
@n=5+5echo$n
operators
Logicsign:==,!=,,=,,=,,||,!
conditionalstatements
Loops
Filetesting
–r filereadablebycurrentuser
-w filewritablebycurrentuser
-x fileexecutablebycurrentuser
-e fileexists
-o fileownedbycurrentuser
-z fileiszerolength?
-d fileisdirectory?
-f fileisaplainfile
Bourneshell
theshbangline
#!/bin/sh
comments
#thistextisnot
#interpretedbytheshell
wildcards
*,?,
displayingoutput
echo“Whatisyourname?”
localvariablesvariable_name=valuename=
文档评论(0)