Linux实验报告中南大学胡小龙.docx

上传人:b****4 文档编号:4012403 上传时间:2023-05-06 格式:DOCX 页数:26 大小:598.32KB
下载 相关 举报
Linux实验报告中南大学胡小龙.docx_第1页
第1页 / 共26页
Linux实验报告中南大学胡小龙.docx_第2页
第2页 / 共26页
Linux实验报告中南大学胡小龙.docx_第3页
第3页 / 共26页
Linux实验报告中南大学胡小龙.docx_第4页
第4页 / 共26页
Linux实验报告中南大学胡小龙.docx_第5页
第5页 / 共26页
Linux实验报告中南大学胡小龙.docx_第6页
第6页 / 共26页
Linux实验报告中南大学胡小龙.docx_第7页
第7页 / 共26页
Linux实验报告中南大学胡小龙.docx_第8页
第8页 / 共26页
Linux实验报告中南大学胡小龙.docx_第9页
第9页 / 共26页
Linux实验报告中南大学胡小龙.docx_第10页
第10页 / 共26页
Linux实验报告中南大学胡小龙.docx_第11页
第11页 / 共26页
Linux实验报告中南大学胡小龙.docx_第12页
第12页 / 共26页
Linux实验报告中南大学胡小龙.docx_第13页
第13页 / 共26页
Linux实验报告中南大学胡小龙.docx_第14页
第14页 / 共26页
Linux实验报告中南大学胡小龙.docx_第15页
第15页 / 共26页
Linux实验报告中南大学胡小龙.docx_第16页
第16页 / 共26页
Linux实验报告中南大学胡小龙.docx_第17页
第17页 / 共26页
Linux实验报告中南大学胡小龙.docx_第18页
第18页 / 共26页
Linux实验报告中南大学胡小龙.docx_第19页
第19页 / 共26页
Linux实验报告中南大学胡小龙.docx_第20页
第20页 / 共26页
亲,该文档总共26页,到这儿已超出免费预览范围,如果喜欢就下载吧!
下载资源
资源描述

Linux实验报告中南大学胡小龙.docx

《Linux实验报告中南大学胡小龙.docx》由会员分享,可在线阅读,更多相关《Linux实验报告中南大学胡小龙.docx(26页珍藏版)》请在冰点文库上搜索。

Linux实验报告中南大学胡小龙.docx

Linux实验报告中南大学胡小龙

 

Unix/Linux实验报告

 

中南大学信息科学与工程学院

实验一Linux的安装(课后)

1、实验目的

(1)了解硬盘分区的概念和方法;

(2)掌握硬盘的分区规划;

(3)掌握Linux操作系统的安装和配置过程。

2、实验设备

一台pc机、RedHatLinux7.2以上版本、VMwareWorkstationv5.5

3、实验原理

Linux可以以多种方式安装在PC机上:

(1)独立分区安装、

(2)DOS分区安装和(3)虚拟机VMWare下安装。

鉴于VMware下安装对原来系统影响较小且不影响本实验目的,因此采用VMWare下安装方式。

4、实验步逐

(1)在WindowsXP下安装VMware5.5

(2)配置虚拟机

(3)启动虚拟机

(4)启动Linux安装过程

(5)安装过程配置

(6)安装后配置

(7)第1次启动VMWare下Linux操作系统

5、实验记录

(1)记录详细安装过程

(2)安装过程中出现的问题及其解决措施

Linux安装:

(1)语言选择:

(2)键盘配置:

(3)鼠标配置:

(4)选择安装还是升级:

(5)安装类型:

(6)磁盘分区设置:

(7)为系统分区:

(8)添加分区:

(9)引导装载程序配置:

(10)网络配置:

(11)防火墙配置:

(12)语言支持的选择:

(13)时区配置:

(14)设置根口令

(15)选择软件包组:

(16)准备安装:

应该看到一个安装RedHatLinux做准备的屏幕。

当你重新引导系统后,一份完整的安装日志可在/root/install.log中找到,以备今后参考。

要取消安装进程,按计算机的重新启动按钮,或者使用[Control]-[Alt]-[Delete]组合键来重启计算机。

(17)安装软件包:

(18)创建引导盘:

(19)视频卡配置:

(20)配置显示器:

(21)定制配置:

(22)安装完成

 

实验2Linux基本操作

1、实验目的

(1)复习Linux基本命令。

(2)掌握常用Linux命令

2、实验内容

(1)练习命令行模式下的常用命令:

man:

命令帮助

ALT-Fx:

虚终端切换

常用命令:

cat、Ls、ps、chmod、kill、ln、cp、mv、rm、cd、pwd、mkdir、chown、who、w、wc、whoami、date、uname等

命令实例:

root@soamazing-desktop:

~#touchtest

root@soamazing-desktop:

~#cattest

aaaaa

root@soamazing-desktop:

~#ls

test公共的模板视频图片文档下载音乐桌面

root@soamazing-desktop:

~#psman

PIDTTYSTATTIMECOMMAND

753tty7-0:

10/usr/bin/X:

0-nr-verbose-auth/var/run/gdm/auth-fo

--Ss+0:

10-

1081pts/0-0:

00bash

--Ss0:

00-

1138pts/0-0:

00psman

--R+0:

00-

root@soamazing-desktop:

~#ls-l

total36

-rw-r--r--1rootroot62011-04-1222:

20test

drwxr-xr-x2rootroot40962011-04-1215:

40公共的

drwxr-xr-x2rootroot40962011-04-1215:

40模板

drwxr-xr-x2rootroot40962011-04-1215:

40视频

drwxr-xr-x2rootroot40962011-04-1215:

40图片

drwxr-xr-x2rootroot40962011-04-1215:

40文档

drwxr-xr-x2rootroot40962011-04-1215:

40下载

drwxr-xr-x2rootroot40962011-04-1215:

40音乐

drwxr-xr-x2rootroot40962011-04-1215:

40桌面

root@soamazing-desktop:

~#chmod888test

chmod:

invalidmode:

`888'

Try`chmod--help'formoreinformation.

root@soamazing-desktop:

~#chmod--help

Usage:

chmod[OPTION]...MODE[,MODE]...FILE...

or:

chmod[OPTION]...OCTAL-MODEFILE...

or:

chmod[OPTION]...--reference=RFILEFILE...

ChangethemodeofeachFILEtoMODE.

-c,--changeslikeverbosebutreportonlywhenachangeismade

--no-preserve-rootdonottreat`/'specially(thedefault)

--preserve-rootfailtooperaterecursivelyon`/'

-f,--silent,--quietsuppressmosterrormessages

-v,--verboseoutputadiagnosticforeveryfileprocessed

--reference=RFILEuseRFILE'smodeinsteadofMODEvalues

-R,--recursivechangefilesanddirectoriesrecursively

--helpdisplaythishelpandexit

--versionoutputversioninformationandexit

EachMODEisoftheform`[ugoa]*([-+=]([rwxXst]*|[ugo]))+'.

Reportchmodbugstobug-coreutils@gnu.org

GNUcoreutilshomepage:

//www.gnu.org/software/coreutils/>

GeneralhelpusingGNUsoftware:

//www.gnu.org/gethelp/>

Reportchmodtranslationbugsto

//translationproject.org/team/>

root@soamazing-desktop:

~#ls-l

total36

-rw-r--r--1rootroot62011-04-1222:

20test

drwxr-xr-x2rootroot40962011-04-1215:

40公共的

drwxr-xr-x2rootroot40962011-04-1215:

40模板

drwxr-xr-x2rootroot40962011-04-1215:

40视频

drwxr-xr-x2rootroot40962011-04-1215:

40图片

drwxr-xr-x2rootroot40962011-04-1215:

40文档

drwxr-xr-x2rootroot40962011-04-1215:

40下载

drwxr-xr-x2rootroot40962011-04-1215:

40音乐

drwxr-xr-x2rootroot40962011-04-1215:

40桌面

root@soamazing-desktop:

~#chmodu-w,g+w,o+wtest

root@soamazing-desktop:

~#ls-l

total36

-r--rw-rw-1rootroot62011-04-1222:

20test

drwxr-xr-x2rootroot40962011-04-1215:

40公共的

drwxr-xr-x2rootroot40962011-04-1215:

40模板

drwxr-xr-x2rootroot40962011-04-1215:

40视频

drwxr-xr-x2rootroot40962011-04-1215:

40图片

drwxr-xr-x2rootroot40962011-04-1215:

40文档

drwxr-xr-x2rootroot40962011-04-1215:

40下载

drwxr-xr-x2rootroot40962011-04-1215:

40音乐

drwxr-xr-x2rootroot40962011-04-1215:

40桌面

root@soamazing-desktop:

~#chmodu+w,g-w,o-wtest

root@soamazing-desktop:

~#ls-l

total36

-rw-r--r--1rootroot62011-04-1222:

20test

drwxr-xr-x2rootroot40962011-04-1215:

40公共的

drwxr-xr-x2rootroot40962011-04-1215:

40模板

drwxr-xr-x2rootroot40962011-04-1215:

40视频

drwxr-xr-x2rootroot40962011-04-1215:

40图片

drwxr-xr-x2rootroot40962011-04-1215:

40文档

drwxr-xr-x2rootroot40962011-04-1215:

40下载

drwxr-xr-x2rootroot40962011-04-1215:

40音乐

drwxr-xr-x2rootroot40962011-04-1215:

40桌面

root@soamazing-desktop:

~#ln

ln:

missingfileoperand

Try`ln--help'formoreinformation.

root@soamazing-desktop:

~#ln--help

Usage:

ln[OPTION]...[-T]TARGETLINK_NAME(1stform)

or:

ln[OPTION]...TARGET(2ndform)

or:

ln[OPTION]...TARGET...DIRECTORY(3rdform)

or:

ln[OPTION]...-tDIRECTORYTARGET...(4thform)

Inthe1stform,createalinktoTARGETwiththenameLINK_NAME.

Inthe2ndform,createalinktoTARGETinthecurrentdirectory.

Inthe3rdand4thforms,createlinkstoeachTARGETinDIRECTORY.

Createhardlinksbydefault,symboliclinkswith--symbolic.

Whencreatinghardlinks,eachTARGETmustexist.Symboliclinks

canholdarbitrarytext;iflaterresolved,arelativelinkis

interpretedinrelationtoitsparentdirectory.

Mandatoryargumentstolongoptionsaremandatoryforshortoptionstoo.

--backup[=CONTROL]makeabackupofeachexistingdestinationfile

-blike--backupbutdoesnotacceptanargument

-d,-F,--directoryallowthesuperusertoattempttohardlink

directories(note:

willprobablyfaildueto

systemrestrictions,evenforthesuperuser)

-f,--forceremoveexistingdestinationfiles

-n,--no-dereferencetreatdestinationthatisasymlinktoa

directoryasifitwereanormalfile

-i,--interactivepromptwhethertoremovedestinations

-s,--symbolicmakesymboliclinksinsteadofhardlinks

-S,--suffix=SUFFIXoverridetheusualbackupsuffix

-t,--target-directory=DIRECTORYspecifytheDIRECTORYinwhichtocreate

thelinks

-T,--no-target-directorytreatLINK_NAMEasanormalfile

-v,--verboseprintnameofeachlinkedfile

--helpdisplaythishelpandexit

--versionoutputversioninformationandexit

Thebackupsuffixis`~',unlesssetwith--suffixorSIMPLE_BACKUP_SUFFIX.

Theversioncontrolmethodmaybeselectedviathe--backupoptionorthrough

theVERSION_CONTROLenvironmentvariable.Herearethevalues:

none,offnevermakebackups(evenif--backupisgiven)

numbered,tmakenumberedbackups

existing,nilnumberedifnumberedbackupsexist,simpleotherwise

simple,neveralwaysmakesimplebackups

Reportlnbugstobug-coreutils@gnu.org

GNUcoreutilshomepage:

//www.gnu.org/software/coreutils/>

GeneralhelpusingGNUsoftware:

//www.gnu.org/gethelp/>

Reportlntranslationbugsto

//translationproject.org/team/>

root@soamazing-desktop:

~#who

roottty72011-04-1222:

11(:

0)

rootpts/02011-04-1222:

12(:

0.0)

root@soamazing-desktop:

~#whoami

root

root@soamazing-desktop:

~#

 

(2)编辑器vi的使用:

使用vi建立并修改一个文本文件

root@soamazing-desktop:

~#vitest

(3)档案管理

rpm、gzip、tar等命令

(4)网络命令

telnet、ftp、talk

3、实验记录

(1)在实验过程中,注意记录实验现象

(2)使用过程体会、心得、技巧

 

实验3Linux系统管理

1、实验目的

(1)掌握Linux基本系统管理命令

(2)掌握基本管理方法

(3)初步了解Linux中与系统管理相关的有关配置文件

2、实验内容

(1)用户管理

adduser、useradd、passwd等

观察:

/etc/passwd文件

(2)文件系统管理

df、du命令使用

mount、umount命令使用:

安装usb盘或者光盘,查看分析/etc/fstab文件

(3)存储器

free:

了解存储器使用情况

(4)关机

halt、shutdown–h、init0

reboot、shutdown-rnow

并比较它们之间的差别

Halt实际上调用了shutdown-h,shutdown命令安全地将系统关机,-h指定延时时间,init0改变的是系统的级别。

Reboot调用shutdown。

Shutdown-h指定延时时间。

(5)网络配置

netconfig的使用

(6)启动配置

/etc/inittab:

查看、修改并观察其响应

3、实验记录

(1)在实验过程中,注意记录实验现象

(2)使用过程体会、心得、技巧

实验4LinuxShell程序设计

1、实验目的

(1)掌握Linuxshell程序运行方法

(2)掌握LinuxShell程序基本语法

(3)了解Linux环境变量

(3)编写简单Linuxshell程序

2、实验内容

(1)查看/etc/.profile文件:

相当于DOS下autoexe.bat

(2)通配符“*”、“?

”、“[]”的使用

$ls[a-c]*和$ls[a,m,t]*命令

(3)重定向和管道的使用

ls|more

cat>test.txt

(4)变量

$lookup=/usr/mydir

$echo$lookup

$exportlookup:

让进程使用

(5)编辑并运行以下程序(shell程序控制结构)

1fortest

#!

/bin/bash

forainxyz

do

echonowa=$a

done

2fortest1

#!

/bin/bash

fora

do

echonowa=$a

done

3functest

#!

/bin/bash

setup()

{

echosetup…

}

do_date()

{

date

}

chgdir()

{

cd$1

}

do_date

setup

chgdir

4paramtest

#!

/bin/bash

echofilename:

$0

echoarguments:

$*

echonumberarg:

$#

echoarg2:

$2

shift

echonumberarg:

$#

echoarg2:

$2

sethello,everone

echoargs:

$*

echoarg2:

$2

5untiltest

#!

/bin/bash

number=0

until(test$number–gt5)

do

echo“$number”

number=`expr$number+1`

done

3、实验要求

(1)每个shell程序事例运行多遍,并给不同参数

(2)详细记录程序调试及运行结果

实验5Linux高级程序设计

1、实验目的

(1)了解Linux操作系统下应用程序开发流程

(2)掌握gun工具链的使用

(3)了解Linux高级编程技巧(例如IPC机制、系统调用等)

2、实验内容

(1)编写一个简单的C语言程序,编写Makefile文件。

了解编译过程,并用gdb进行调试。

#include

intmain(void)

{

printf("HelloWorld!

");

}

调试:

gcchelloworld.c

a.out

(2)以下任选其一:

1.编写一个多进程通信程序,采用MessageQueue或sharedMemory或者MapedFile机制进行通信

2.编写一个多线程程序(pthread),实现2程同步互斥

源代码:

  #include

  #include

  #defineBUFFER_SIZE16

  structprodcons

  {

  //缓冲区相关数据结构

  intbuffer[BUFFER_SIZE];

  pthread_mutex_tlock;

  intreadpos,writepos;

  pthread_cond_tnotempty;

  pthread_cond_tnotfull;

  };

  voidinit(structprodcons*b)

  {

  pthread_mutex_init(&b->lock,NULL);

  pthread_cond_init(&b->notempty,NULL);

  pthread_cond_init(&b->notfull,NULL);

  b->readpos=0;

  b->writepos=0;

  }

  

  voidput(structprodcons*b,intdata)

  {

  pthread_mutex_lock(&b->lock);

  if((b->writ

展开阅读全文
相关资源
猜你喜欢
相关搜索
资源标签

当前位置:首页 > 自然科学 > 物理

copyright@ 2008-2023 冰点文库 网站版权所有

经营许可证编号:鄂ICP备19020893号-2