Linux操作系统基础教程提到Linux操作系统,就不能不提UNIX和GNU。UNIX是由AT&TBell实验室于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,可列出操作系统所包含的shellBourneshell——也称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命令查看1.常用Linux命令(1)uname(2)ls(3)ps(4)date(5)who(6)pwd(7)mkdir(8)rmdir(9)rm(10)touch(11)id(12)group(13)su(14)which(15)where2.CShell1.shbangline#!/bin/csh或者#!/bin/tcsh2.comments#thisiscommentline3.wildcards4.5.localvariablessetvariable=valuesettom=”tom”6.globalvariablessetenvvariablevaluesetenvtomtom7.extractthevariablevalueecho$variable_nameecho$nameecho$PRINTER8.userinputecho“whatisyourname?”setname=$<9.argumentsscriptnamearg1arg2arg3echo$1,$2,$3echo$*10.arrayssetword_list=(word1,word2word3)echo$world_list[2]echo$word_listecho$word_list[*]11.commandsubstitutiona)Setvariable_name=`command`b)Echo$variable_name12.arithmetic@n=5+5echo$n13.operatorsLogicsign:==,!=,>,>=,<,<=,&&,||,!14.conditionalstatementsa)Loopsb)Filetesting–rfilereadablebycurrentuser-wfilewritablebycurrentuser-xfileexecutablebycurrentuser-efileexists-ofileownedbycurrentuser-zfileiszerolength?-dfileisdirectory?-ffileisaplainfile3.Bourneshell1.theshbangline#!/bin/sh2.comments#thistextisnot#interpretedbytheshell3.wildcards*,?,4.displayingoutputecho“Whatisyourname?”5.localvariablesvariable_name=valuename=”MaoyingWoo”x=56.GlobalvariablesVARIABLE_NAME=valueexportVARIABLE_NAME7.extractingecho$variable_name8.readinguserinputecho“whatisyourname?”a)readnameb)readname1name2name39.argumentsa)scriptnamearg1arg2arg3b)echo$1$2$310.arrayssetword1word2word3echo$1$2$311.commandsubstitution``12.arithmeticn=`expr5+5`echo$n13.operators字符串运算:=,!=string数值运算:-e,-n逻辑运算:-a,-o,!关系运算:-gt,-ge,-lt,-le14.conditionalstatementssimilartocsh4.KornShell(KShell)1.shbangline#!/bin/ksh2.comments#thisprogramwilltestsomefiles3.wildcardsrm*;ls??;catfile[1-3];echo“Howareyou?”4.displayingoutputecho“whoareyou?”print“howareyou?”5.localvariablesvariable_name=valuetypesetvariable_name=valuee.g.,name=”JohnDoe”6.globalvariableexport$VARIABLE_NAME=valueexportPATH=/bin:/usr/bin:.7.extractingvaluesfromvariablenameecho$variable_nameechoname8.readinguserinputprint–n“Whatisyourname?”readname9.argumentsscriptnamearg1arg2arg3echo$1$2$310.arrayssetapplespearspeachesprint$1$2$311.arithmetictypeset–ivariable_name整型变量的设置12.commandsubstitutionvariable_name=`command`variable_name=$(co...