⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 doc139.htm

📁 Red Hat Linux 5.1安装指南
💻 HTM
字号:
<html>

<head>
<meta HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=gb2312">
<meta NAME="Author" CONTENT="Tang Jun">
<meta NAME="GENERATOR" CONTENT="Microsoft FrontPage 3.0">
<title>Linux 使用技巧集锦(二)</title>
<style>
<!--
        A:link {text-decoration: none; color: "blue"}
        A:visited {text-decoration: none; color: "#000000"}
        A:active {text-decoration: none;color:"green"}
        A:hover {text-decoration: underline; color: ff0000}
-->
</style>
<style type="text/css">

<!--
p{font-size:9pt;line-height;13pt;}
td {   font-size: 9pt ; line-height:13pt;

	    }


	A{text-transform: none;

	  text-decoration: none;font-size: 9pt ; line-height:13pt;}
 -->copyright fangame
</style>
</head>

<body TEXT="#000000" BGCOLOR="#FFEEDD" LINK="#0000EE" VLINK="#FF0000" ALINK="#FF0000">
<b><font SIZE="+2">

<p align="center">Linux 使用技巧集锦(二)</font></b> 作者: con <b>&nbsp;</b> 
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Linux 
使用技巧集锦的第二辑,主要是一些初学者容易遇到又不容易解决的问题,希望大家能喜欢。另外如果有错误的话欢迎来信指正,我将非常感谢。 
</p>

<p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <b>1. 重装Win9x后lilo失效无法启动Linux</b> 
<br>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 
只须先用软盘启动Linux然后运行一次lilo即可。对于RedHat可以用命令mkbootdisk来制作启动盘,例如:<br>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; mkbootdisk 
--devices /dev/fd0 2.0.34-1<br>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 其中2.0.34-1是 
/lib/modules下的一个目录。 </p>

<p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <b>2. 把dos/windows改为缺省启动的OS</b> 
<br>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; RedHat把Linux作为lilo缺省启动的OS,即出现 
boot: 提示符后直接回车启动Linux。如果想改为dos/Windows,修改文件/etc/lilo.conf,把有关启动dos的部分放在前面,再运行一次lilo即可。例如把lilo.conf从: 
</p>

<pre>
boot=/dev/hda
map=/boot/map
install=/boot/boot.b
prompt
timeout=50
image=/boot/vmlinuz-2.0.34-1
	label=linux
	root=/dev/hdc5
	read-only
other=/dev/hda1
        label=dos
        table=/dev/hda
</pre>

<p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;改为: </p>

<pre>
boot=/dev/hda
map=/boot/map
install=/boot/boot.b
prompt
timeout=50
other=/dev/hda1
        label=dos
        table=/dev/hda
image=/boot/vmlinuz-2.0.34-1
	label=linux
	root=/dev/hdc5
	read-only
</pre>

<p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <b>3. 去掉引导区内的lilo信息</b> 
<br>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 
安装lilo后如果硬盘数量或分区情况有改变的话将导致硬盘不能启动,这时只须用软盘启动dos再运行 
fdisk/mbr 即可。(这个方法还可清除任何引导区病毒) </p>

<p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <b>4. 让 X 支持 AGP 显卡</b> <br>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 下载一个 AX 4.1 即 
AcceleratedX 4.1 , 一个商业版的 X Server 。除 AGP 显卡外 AX 
还支持很多牌号的显卡。另外还可以用AX 带的设置程序 Xsetup 
方便的对分辨率,刷新率等参数进行设置。不过我也不知道用AGP卡效果如何,因为我现在还在用老掉牙的 
S3 765 。:(<br>
<br>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 按此下载 <a HREF="AX41.linux.cracked.tgz" tppabs="http://www.netease.com/%7Econ/other/AX41.linux.cracked.tgz">AX 4.1</a> </p>

<p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <b>5. 把 man 或 info 
的信息存为文本文件</b> <br>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 以 tcsh 为例: man tcsh | col 
-b &gt; tcsh.txt <br>
info tcsh -o tcsh.txt -s </p>

<p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <b>6. 用当前路径作提示符</b> <br>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 对 bash 来说,在 .bashrc 
里加一行:<br>
PS1=&quot;\$PWD\\$&quot; <br>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 对 tcsh 来说,在 .tcshrc 
里加一行:<br>
set prompt=&quot;%/&gt;&quot; </p>

<p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <b>7. 压缩可执行文件</b> <br>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Linux 下有一个类似 dos 
里的 pklite 和 lzexe 的命令 -- gzexe 。而且压缩率一般都可以超过 50% 
,在空间紧张时很有用。比如: </p>

<pre>
/dosc/temp# ls -al
total 148
-rwxr-xr-x   1 root     root       149564 Dec  8 15:33 gawk
/dosc/temp# gzexe gawk
gawk:                    54.5%
/dosc/temp# ls -al
total 216
-rwxr-xr-x   1 root     root        68710 Dec  8 15:36 gawk
-rwxr-xr-x   1 root     root       149564 Dec  8 15:33 gawk~
/dosc/temp#
</pre>

<p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <b>8. 查看 Linux 启动时的信息</b> 
<br>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Linux 
启动时屏幕显示的信息来不及看清就一闪而过,如果对这些信息感兴趣的话可以在启动完后用命令 
dmesg 查看。 </p>

<p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <b>9. 
处理文件名内含有特殊字符的文件</b> <br>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 如果有一个文件名叫 -file 
如果想删除它,键入 rm -file 会显示 invalid option 
,原来由于文件名的第一个字符为 - , Linux 
把文件名当作选项了,可以加 -- 解决这个问题, 如 rm -- -file 
。如果是其他特殊字符的话可以在特殊字符前加一个 \ 
,或者用双引号把整个文件名括起来。 </p>

<p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <b>10. 一次处理一整个目录</b> 
<br>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Linux/UNIX 
的很多常用命令如 rm , cp 等都有一个参数---- -r , 是递归的意思, 
命令里加了参数 -r 
就可以对目标目录及其下所有子目录进行操作,如:<br>
rm -rf /test (f 是 force 意为强行) , 该命令完全删除根目录下的子目录 
test ,作用类似于 dos 下的 deltree 
,当然使用这个命令时要特别小心。再如:<br>
cp -r /test /test1 有类似 dos 下 xcopy /s 的作用。 </p>

<p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <b>11. 修改登录画面</b> <br>

<ul>
  <li>对本机: <br>
    &nbsp; &nbsp; &nbsp; 先修改文件 /etc/issue 改为相要显示的内容, 
    再修改文件 /etc/rc.d/rc.local(RedHat) 或 /etc/rc.d/rc.S(Slackware) 
    把下面几句注释掉: <pre>
# This will overwrite /etc/issue at every boot.  So, make any changes you
# want to make to /etc/issue here or you will lose them when you reboot.
echo &quot;&quot; &gt; /etc/issue
echo &quot;Red Hat Linux $R&quot; &gt;&gt; /etc/issue
echo &quot;Kernel $(uname -r) on $a $(uname -m)&quot; &gt;&gt; /etc/issue

cp -f /etc/issue /etc/issue.net
echo &gt;&gt; /etc/issue
</pre>
    <p>不然的话每次重新启动 /etc/issue 都会被更改。<br>
    </p>
  </li>
  <li><br>
  </li>
  <li>对 telnet 的远地机器: <br>
    &nbsp; &nbsp; &nbsp; 先把文件 /etc/usr/sbin/in.telnetd 改名,如改为 
    in.telnetd.exe ,再编一个名为 in.telnetd 的 shell 脚本, 
    在显示完需要的内容后再调用 in.telnetd.exe 。 如: <pre>
#!/bin/sh
cat /etc/login.banner   #需要在登录提示符前显示的内容
echo -n &quot;&quot;
exec /usr/sbin/in.telnetd.exe
</pre>
  </li>
</ul>

<p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <b>12. 几个有用的别名</b> <br>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 
几个能方便操作和减少误操作的别名,建议把它们放到启动文件里, 
如 /etc/bashrc 。 </p>

<pre>
alias rm='rm -i'
alias cp='cp -i'
alias mv='mv -i'
#前三个别名的作用是在删除、覆盖文件之前先提示确认,RedHat已经自动
#加上了,强烈建议Slackware的用户也加上,因为Linux/UNIX下文件一旦删
#除就再也无法恢复了。
alias l='ls -l'
alias cd..='cd ..'
alias utar='tar xvfz'    #解 *.tar.gz 文件
alias inforpm='rpm -qpi' #显示rpm包的信息
alias instrpm='rpm -Uhv' #安装rpm包
alias listrpm='rpm -qpl' #列rpm包内的文件
alias uistrpm='rpm -e'   #反安装rpm包 
</pre>

<p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <b>13. 使用命令补齐</b> <br>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 所谓命令补齐(Command-Line 
Completion)是指当键入的字符足以确定目录下一个唯一的文件时只须按 
Tab 键就可以自动补齐该文件名的剩下部分,例如要把目录 /freesoft 
下的文件 gcc-2.8.1.tar.gz 解包,当键入到 tar xvfz /freesoft/g 
时如果该文件是该目录下唯一以 g 起头的文件的话就可以按下 Tab 
键,这时命令会被自动补齐为:tar xvfz /freesoft/gcc-2.8.1.tar.gz 
,非常方便。 </p>

<p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <b>14. 最后一条技巧</b> <br>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 
有时间的话多看看系统提供的FAQ文件,因为通常遇到的问题大多数都能在里面找到答案。 
</p>
</body>
</html>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -