📄 878.html
字号:
background="images/back.gif" tppabs="http://www.linuxhero.com/docs/images/back.gif" border=0>
<TBODY>
<TR>
<TD vAlign=top width="80%">
<DIV align=center>
<FORM action="search.html" tppabs="http://www.linuxhero.com/docs/search.html" method=get>
</FORM>
<TABLE cellSpacing=0 cellPadding=0 width="95%"
border=0><TBODY>
<TR>
<TD background="images/bgi.gif" tppabs="http://www.linuxhero.com/docs/images/bgi.gif"
height=30></TD></TR></TBODY></TABLE>
<TABLE cellSpacing=0 cellPadding=3 width="95%"
align=center border=0>
<TBODY>
<TR>
<TD>
<TABLE cellSpacing=0 cellPadding=3 width="100%"
border=0>
<TBODY>
<TR>
<TD vAlign=top>
<p><FONT class=normalfont><B><font color=blue>磁带驱动器的使用</font></B></FONT><BR><FONT class=smallfont color=#ff9900>2004-04-23 15:18 pm</FONT><BR><FONT class=normalfont>作者:作者<br>来自:Linux知识宝库<br>联系方式:无名<br><br>注:只有一个磁带驱动器
磁带操作命令:
1.重新拉紧磁带
mt -f /dev/rmt/0 retension
2.回绕磁带
mt -f /dev/rmt/0 rewind
3.显示磁带驱动器状态
mt -f /dev/rmt/0 status
tar命令:
使用tar命令复制文件或者目录树到单个磁带。优点:在UNIX系统中都可用。缺点:不知道文件系统的边界,全路径名长不能超过255个字符,
不能复制空目录或者设备文件这样的特殊文件,不能用来创建多个磁带卷。
1.复制文件到磁带
1)切换到包含有需要复制文件的目录
2)在磁带驱动器中插入可以写入的磁带
3)输入 tar cvf /dev/rmt/0 filenme filename ...
其中, c (复制)选项复制指定的文件,v(详细)选项显示复制文件的信息,f(文件)选项后面跟随的是tar文件写入的磁带设备名。指定的文件名
复制到磁带,覆盖磁带上任何已存在的文件。
注:使用c选项复制文件到磁带将破坏磁带上已有的任何文件。如果要保留这些文件,用r选项。可以使用通配符(? *)
4)从驱动器中取出磁带,将文件名写在磁带的标签上。
2.列出磁带上的文件
1)插入磁带到磁带驱动器。
2)输入 tar tvf /dev/rmt/0
其中, t(列表)选项列出指定的文件,vv(详细)选项显示文件的全部信息,f(文件)选项后面跟随的是tar文件写入的磁带设备名。
3.添加文件到磁带
1)切换到包含有需要复制文件的目录。
2)在磁带驱动器中插入可以写入的磁带
3)输入 tar rvf /dev/rmt/0 filename filename...
指定的文件添加到磁带上已有文件的后面。
4)从驱动器中取出磁带,将文件名写在磁带的标签上。
注:如果使用n(不回绕)选项做为磁带设备名的一部分,可以自制多个tar文件集到磁带。输入 tar cvf /dev/rmt/0n filenae ,当该文件自制
完毕时磁带不回绕,下一次使用磁带时,文件在当前文件集的结尾写入。
4.从磁带获取文件集的结尾写入
1)切换到包含有需要复制文件的目录。
2)在磁带驱动器中插入磁带。
3)输入 tar xvf /dev/rmt/0
指定驱动器中磁带上的所有文件复制到当前目录中。
从磁带中获取单个文件,输入 tar xvf /dev/rmt/n filename filename ...
从磁带中展开指定的文件名,放入当前工作目录。
5.从磁带上递归读取目录和子目录
1)更换目录到要自制文件的父目录
tar xvf /dev/rmt/0 filename
将恢复filename到当前目录。
2)输入 tar xvf /dev/rmt/0 directory-name ,从磁带中递归复制该目录和它的所有子目录。
cpio命令
cpio命令复制文件,特殊文件和需要多个磁带的文件系统,提供从SunOS5.x复制文件到SunOS4.x系统的兼容性。优点:比tar命令能更有效地打
包数据到磁带;恢复文件时能跳过磁带上的坏区;提供以下不同的头格式(tar ustar crc odr bar)写入文件的选项,方便在不同系统类型之
间的移植;以及创建多个磁带卷。
使用cpio命令创建存档时,该命令从标准输入获得文件和路径名列表并写到标准输出。输出通常重定向为文件或者设备。
1.复制目录中的所有文件到磁带
1)在磁带驱动器中插入写保护打开的磁带
2)输入 ls|cpio -oc > /dev/rmt/0
其中,o选项复制文件;c选项以ASCII的形式写头信息。该命令覆盖磁带上的所有文件,并显示的块的总数。
3)从驱动器中取出磁带,将文件名写在磁带的标签上。
2.列出磁带上的文件
1)插入磁带到磁带驱动器中。
2)输入 cpio -civt
其中,i选项读磁带内容;v选项显示输出;t选项列出指定驱动器中磁带上的文件内容。
3.从磁带获取所有文件
如果存档使用相对名,则输出文件在当前目录中以目录创建。如果存档使用绝对路径名创建,则重新创建文件时使用该全路径名。
DANGER:使用绝对路径名是危险的,因为可能覆盖初始文件。
1)切换到需要放置文件的目录。
2)在磁带驱动器中插入磁带
3)输入 cpio -icv
4.从磁带获取文件子集
1)切换到需要放置文件的目录
2)在磁带驱动器中插入磁带
3)输入 cpio -icv "*file"
与该模式匹配的所有文件自制到当前目录。可以多种模式,但是每一种模式都必须用双引号包含。
pax命令
用来复制文件、特殊文件或者需要多卷磁带的文件系统,当在该系统和POSIX之间复制文件时也可用该命令。
缺点:不知道系统边界、全路径名不能超过255个字符。
1.复制目录中的所有文件到磁带
1)切换到包含有需要复制文件的目录
2)在磁带驱动器中插入写保护打开的磁带。
3)输入 pax -w -f /dev/rmt/0
-w选项将当前目录内容写入磁带,-f选项标识磁带驱动器。
4)输入 pax -l -f /dev/rmt/0
-l选项列出磁带上的文件,验证文件已复制。
5)从驱动器中取出磁带,将文件名写在磁带的标签上。
注:当使用pax命令复制文件到单卷磁带时,还可以使用tar命令显示文件列表和从磁带获取文件。
2.获取磁带上的所有文件
1)切换到需要放置文件的目录。
2)在磁带驱动器中插入磁带。
3)输入 pax -r -f
-r选项读取磁带内容写入当前目录,-f选项标识磁带驱动器。
4)输入ls -l。列出当前目录中的文件,并显示其权限以验证文件复制。
一. tar
1.压缩一组文件为tar.gz后缀。
# tar cvf backup.tar /etc
#gzip -q backup.tar
或
# tar cvfz backup.tar.gz /etc/
2.释放一个后缀为tar.gz的文件。
#gunzip backup.tar.gz
#tar xvf backup.tar
或
# tar xvfz backup.tar.gz
3.用一个命令完成压缩
#tar cvf - /etc/ | gzip -qc > backup.tar.gz
4.用一个命令完成释放
# gunzip -c backup.tar.gz | tar xvf -
5.如何解开tar.Z的文件?
# tar xvfz backup.tar.Z
或
# uncompress backup.tar.Z
#tar xvf backup.tar
6.如何解开.tgz文件?
#gunzip backup.tgz
7.如何压缩和解压缩.bz2的包?
#bzip2 /etc/smb.conf
这将压缩文件smb.conf成smb.conf.bz2
#bunzip2 /etc/smb.conf.bz2
这将在当前目录下还原smb.conf.bz2为smb.conf
注: .bz2压缩格式不是很常用,你可以man bzip2
二. rpm
1.安装一个包
# rpm -ivh
2.升级一个包
# rpm -Uvh
3.移走一个包
# rpm -e
4.安装参数
--force 即使覆盖属于其它包的文件也强迫安装
--nodeps 如果该RPM包的安装依赖其它包,即使其它包没装,也强迫安装。
5.查询一个包是否被安装
# rpm -q
6.得到被安装的包的信息
# rpm -qi
7.列出该包中有哪些文件
# rpm -ql
8.列出服务器上的一个文件属于哪一个RPM包
#rpm -qf
9.可综合好几个参数一起用
# rpm -qil
10.列出所有被安装的rpm package
# rpm -qa
11.列出一个未被安装进系统的RPM包文件中包含有哪些文件?
# rpm -qilp
</FONT><br>
</TD>
</TR>
<TR>
<TD colSpan=2><FONT
class=middlefont></FONT><BR>
<FONT
class=normalfont>全文结束</FONT> </TD>
</TR>
<TR>
<TD background="images/dot.gif" tppabs="http://www.linuxhero.com/docs/images/dot.gif" colSpan=2
height=10></TD></TR></TBODY></TABLE></TD></TR></TBODY></TABLE></DIV></TD>
<TD vAlign=top width="20%"
background="images/line.gif" tppabs="http://www.linuxhero.com/docs/images/line.gif" rowSpan=2>
<DIV align=center>
<table class=tableoutline cellspacing=1 cellpadding=4
width="100%" align=center border=0>
<tr class=firstalt>
<td noWrap background="images/bgline.gif" tppabs="http://www.linuxhero.com/docs/images/bgline.gif" colspan=2 height=21>
<font class=normalfont><b>所有分类</b></font></td>
</tr>
<tr class=secondalt> <td noWrap width=27%> <font class=normalfont>1:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type1.html" tppabs="http://www.linuxhero.com/docs/type1.html">非技术类</a></font></td> </tr> </table></td></tr><tr class=firstalt> <td noWrap width=27%> <font class=normalfont>2:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type2.html" tppabs="http://www.linuxhero.com/docs/type2.html">基础知识</a></font></td> </tr> </table></td></tr><tr class=secondalt> <td noWrap width=27%> <font class=normalfont>3:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type3.html" tppabs="http://www.linuxhero.com/docs/type3.html">指令大全</a></font></td> </tr> </table></td></tr><tr class=firstalt> <td noWrap width=27%> <font class=normalfont>4:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type4.html" tppabs="http://www.linuxhero.com/docs/type4.html">shell</a></font></td> </tr> </table></td></tr><tr class=secondalt> <td noWrap width=27%> <font class=normalfont>5:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type5.html" tppabs="http://www.linuxhero.com/docs/type5.html">安装启动</a></font></td> </tr> </table></td></tr><tr class=firstalt> <td noWrap width=27%> <font class=normalfont>6:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type6.html" tppabs="http://www.linuxhero.com/docs/type6.html">xwindow</a></font></td> </tr> </table></td></tr><tr class=secondalt> <td noWrap width=27%> <font class=normalfont>7:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type7.html" tppabs="http://www.linuxhero.com/docs/type7.html">kde</a></font></td> </tr> </table></td></tr><tr class=firstalt> <td noWrap width=27%> <font class=normalfont>8:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type8.html" tppabs="http://www.linuxhero.com/docs/type8.html">gnome</a></font></td> </tr> </table></td></tr><tr class=secondalt> <td noWrap width=27%> <font class=normalfont>9:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type9.html" tppabs="http://www.linuxhero.com/docs/type9.html">输入法类</a></font></td> </tr> </table></td></tr><tr class=firstalt> <td noWrap width=27%> <font class=normalfont>10:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type10.html" tppabs="http://www.linuxhero.com/docs/type10.html">美化汉化</a></font></td> </tr> </table></td></tr><tr class=secondalt> <td noWrap width=27%> <font class=normalfont>11:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type11.html" tppabs="http://www.linuxhero.com/docs/type11.html">网络配置</a></font></td> </tr> </table></td></tr><tr class=firstalt> <td noWrap width=27%> <font class=normalfont>12:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type12.html" tppabs="http://www.linuxhero.com/docs/type12.html">存储备份</a></font></td> </tr> </table></td></tr><tr class=secondalt> <td noWrap width=27%> <font class=normalfont>13:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type13.html" tppabs="http://www.linuxhero.com/docs/type13.html">杂项工具</a></font></td> </tr> </table></td></tr><tr class=firstalt> <td noWrap width=27%> <font class=normalfont>14:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type14.html" tppabs="http://www.linuxhero.com/docs/type14.html">编程技术</a></font></td> </tr> </table></td></tr><tr class=secondalt> <td noWrap width=27%> <font class=normalfont>15:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type15.html" tppabs="http://www.linuxhero.com/docs/type15.html">网络安全</a></font></td> </tr> </table></td></tr><tr class=firstalt> <td noWrap width=27%> <font class=normalfont>16:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type16.html" tppabs="http://www.linuxhero.com/docs/type16.html">内核技术</a></font></td> </tr> </table></td></tr><tr class=secondalt> <td noWrap width=27%> <font class=normalfont>17:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type17.html" tppabs="http://www.linuxhero.com/docs/type17.html">速度优化</a></font></td> </tr> </table></td></tr><tr class=firstalt> <td noWrap width=27%> <font class=normalfont>18:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type18.html" tppabs="http://www.linuxhero.com/docs/type18.html">apache</a></font></td> </tr> </table></td></tr><tr class=secondalt> <td noWrap width=27%> <font class=normalfont>19:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type19.html" tppabs="http://www.linuxhero.com/docs/type19.html">email</a></font></td> </tr> </table></td></tr><tr class=firstalt> <td noWrap width=27%> <font class=normalfont>20:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type20.html" tppabs="http://www.linuxhero.com/docs/type20.html">ftp服务</a></font></td> </tr> </table></td></tr><tr class=secondalt> <td noWrap width=27%> <font class=normalfont>21:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type21.html" tppabs="http://www.linuxhero.com/docs/type21.html">cvs服务</a></font></td> </tr> </table></td></tr><tr class=firstalt> <td noWrap width=27%> <font class=normalfont>22:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type22.html" tppabs="http://www.linuxhero.com/docs/type22.html">代理服务</a></font></td> </tr> </table></td></tr><tr class=secondalt> <td noWrap width=27%> <font class=normalfont>23:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type23.html" tppabs="http://www.linuxhero.com/docs/type23.html">samba</a></font></td> </tr> </table></td></tr><tr class=firstalt> <td noWrap width=27%> <font class=normalfont>24:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type24.html" tppabs="http://www.linuxhero.com/docs/type24.html">域名服务</a></font></td> </tr> </table></td></tr><tr class=secondalt> <td noWrap width=27%> <font class=normalfont>25:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type25.html" tppabs="http://www.linuxhero.com/docs/type25.html">网络过滤</a></font></td> </tr> </table></td></tr><tr class=firstalt> <td noWrap width=27%> <font class=normalfont>26:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type26.html" tppabs="http://www.linuxhero.com/docs/type26.html">其他服务</a></font></td> </tr> </table></td></tr><tr class=secondalt> <td noWrap width=27%> <font class=normalfont>27:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type27.html" tppabs="http://www.linuxhero.com/docs/type27.html">nfs</a></font></td> </tr> </table></td></tr><tr class=firstalt> <td noWrap width=27%> <font class=normalfont>28:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type28.html" tppabs="http://www.linuxhero.com/docs/type28.html">oracle</a></font></td> </tr> </table></td></tr><tr class=secondalt> <td noWrap width=27%> <font class=normalfont>29:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type29.html" tppabs="http://www.linuxhero.com/docs/type29.html">dhcp</a></font></td> </tr> </table></td></tr><tr class=firstalt> <td noWrap width=27%> <font class=normalfont>30:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type30.html" tppabs="http://www.linuxhero.com/docs/type30.html">mysql</a></font></td> </tr> </table></td></tr><tr class=secondalt> <td noWrap width=27%> <font class=normalfont>31:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type31.html" tppabs="http://www.linuxhero.com/docs/type31.html">php</a></font></td> </tr> </table></td></tr><tr class=firstalt> <td noWrap width=27%> <font class=normalfont>32:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type32.html" tppabs="http://www.linuxhero.com/docs/type32.html">ldap</a></font></td> </tr> </table></td></tr> </table>
</DIV></TD></TR>
<TR vAlign=top>
<TD width="80%">
<DIV align=center><BR>
</DIV>
</TD></TR></TBODY></TABLE></TD></TR>
</TABLE></TD></TR>
</TABLE>
<TABLE cellSpacing=0 cellPadding=4 width="100%" bgColor=#eeeeee
border=0><TBODY>
<TR>
<TD width="50%">
<P><FONT class=middlefont>版权所有 © 2004 <A
href="mailto:bjchenxu@sina.com">linux知识宝库</A><BR>
违者必究. </FONT></P>
</TD>
<TD width="50%">
<DIV align=right><FONT class=middlefont>Powered by: <A
href="mailto:bjchenxu@sina.com">Linux知识宝库</A> Version 0.9.0 </FONT></DIV>
</TD></TR></TBODY></TABLE>
<CENTER></CENTER></TD></TR>
</TABLE></CENTER></BODY></HTML>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -