📄 linux经典问答.htm
字号:
<BR>放在任一目录中,tar xvfz zhcon-0.2.1.tar.gz, cd zhcon-0.2.1,
./configure, <BR>make, make install。安装结束,要想使用,请运行zhcon,想退出,运行exit。
<BR><BR>0033 <BR><SPAN style="COLOR: red">把弹出的光盘收回来(beike)</SPAN>
<BR>#eject -t <BR><BR>0034 <BR><SPAN
style="COLOR: red">cd光盘做成iso文件(弱智)</SPAN> <BR>cp /dev/cdrom xxxx.iso
<BR><BR>0035 <BR><SPAN style="COLOR: red">快速观看开机的硬件检测(弱智)</SPAN>
<BR>dmesg | more <BR><BR>0036 <BR><SPAN
style="COLOR: red">查看硬盘的使用情况</SPAN> <BR>df -k 以K为单位显示 <BR>df -h
以人性化单位显示,可以是b,k,m,g,t.. <BR><BR>0037 <BR><SPAN
style="COLOR: red">查看目录的大小</SPAN> <BR>du -sh dirname <BR>-s 仅显示总计
<BR>-h 以K、M、G为单位,提高信息的可读性。KB、MB、GB是以1024为换算单 位, -H以1000为换算单位。
<BR><BR>0038 <BR><SPAN
style="COLOR: red">查找或删除正在使用某文件的进程(wwwzc)</SPAN> <BR>fuser filename
<BR>fuser -k filename <BR><BR>0039 <BR><SPAN
style="COLOR: red">安装软件</SPAN> <BR>rpm -ivh aaa.rpm <BR>tar xvfz
aaa.tar.gz; cd aaa; ./configure; make; make install <BR><BR>0040
<BR><SPAN style="COLOR: red">字符模式下设置/删除环境变量</SPAN> <BR>bash下
<BR>设置:export 变量名=变量值 <BR>删除:unset 变量名 <BR>csh下 <BR>设置:setenv 变量名
变量值 <BR>删除:unsetenv 变量名 <BR><BR>0041 <BR><SPAN
style="COLOR: red">ls如何看到.开头的文件</SPAN> <BR>ls -a <BR><BR>0042
<BR><SPAN style="COLOR: red">rpm中的文件安装到哪里去了</SPAN> <BR>rpm -qpl
aaa.rpm <BR><BR>0043 <BR><SPAN style="COLOR: red">使用src.rpm</SPAN>
<BR>rpmbuild --rebuild *.src.rpm <BR><BR>0044 <BR><SPAN
style="COLOR: red">vim中显示颜色或不显示颜色</SPAN> <BR>vi ~/.vimrc; 如果有syntax
on,则显示颜色,syntax off,则不显示颜色 <BR><BR>0045 <BR><SPAN
style="COLOR: red">linux是实时还是分时操作系统</SPAN> <BR>分时 <BR><BR>0046
<BR><SPAN style="COLOR: red">make bzImage -j的j是什么意思(wind521)</SPAN>
<BR>-j主要是用在当你的系统硬件资源比较大的时候,比较富裕的时候,用这个可以来加快编译的速度,如-j 3 <BR><BR>0047
<BR><SPAN style="COLOR: red">源码包怎么没有</SPAN> <BR>你没有安装源代码,你把你光盘上rpm
-i *kernel*source*.rpm装上,就可以看到你的源代码了。 <BR><BR>0048 <BR><SPAN
style="COLOR: red">修改系统时间</SPAN> <BR>date -s “2003-04-14
cst”,cst指时区,时间设定用date -s 18:10 <BR><BR>0049 <BR><SPAN
style="COLOR: red">开机就mount上windows下的分区</SPAN>
<BR>自动将windows的d盘挂到/mnt/d上,用vi打开/etc/fstab,加入以下一行 <BR>/dev/hda5
/mnt/d vfat defaults,codepage=936,iocharset=cp936 0 0
<BR>注意,先得手工建立一个/mnt/d目录 <BR><BR>0050 <BR><SPAN
style="COLOR: red">linux怎么用这么多内存</SPAN>
<BR>为了提高系统性能和不浪费内存,linux把多的内存做了cache,以提高io速度 <BR><BR>0051 <BR><SPAN
style="COLOR: red">FSTAB 最后的配置项里边最后两个数字是什么意思(lnx3000)</SPAN>
<BR>第一个叫fs_freq,用来决定哪一个文件系统需要执行dump操作,0就是不需要;
<BR>第二个叫fs_passno,是系统重启时fsck程序检测磁盘的顺序号 <BR>1 是root文件系统,2
是别的文件系统。fsck按序号检测磁盘,0表示该文件系统不被检测 <BR>dump 执行ext2的文件系统的备份操作 <BR>fsck
检测和修复文件系统 <BR><BR>0052 <BR><SPAN
style="COLOR: red">linux中让用户的密码必须有一定的长度,并且符合复杂度</SPAN> <BR>vi
/etc/login.defs,改MIN_PASS_LEN <BR><BR>0053 <BR><SPAN
style="COLOR: red">linux中的翻译软件</SPAN> <BR>星际译王 xdict <BR><BR>0054
<BR><SPAN style="COLOR: red">不让显示器休眠</SPAN> <BR>setterm -blank 0
<BR>setterm -blank n (n为等待时间) <BR><BR>0055 <BR><SPAN
style="COLOR: red">用dat查询昨天的日期(gadfly)</SPAN> <BR>date
--date='yesterday' <BR><BR>0056 <BR><SPAN
style="COLOR: red">xwindow下如何截屏</SPAN> <BR>Ksnapshot或者gimp
<BR><BR>0057 <BR><SPAN style="COLOR: red">解压小全</SPAN> <BR>tar xvfj
example.tar.bz2 <BR>tar xvfz example.tar.gz <BR>tar xvfz example.tgz
<BR>tar xvf example.tar <BR>unzip example.zip <BR><BR>0058 <BR><SPAN
style="COLOR: red">在多级目录中查找某个文件的方法(青海湖)</SPAN> <BR>find /dir -name
filename.ext <BR>du -a | grep filename.ext <BR>locate filename.ext
<BR><BR>0059 <BR><SPAN style="COLOR: red">不让普通用户自己改密码(myxfc)</SPAN>
<BR>[root@xin_fc etc]# chmod 511 /usr/bin/passwd <BR>又想让普通用户自己改密码
<BR>[root@xin_fc etc]# chmod 4511 /usr/bin/passwd <BR><BR>0060
<BR><SPAN style="COLOR: red">显卡实在配不上怎么办(win_bigboy)</SPAN> <BR>去 <A
href="http://www.redflag-linux.com/,下了xfree86"
target=_blank>http://www.redflag-linux.com/,下了xfree86</A> 4.3安装就可以了.
<BR><BR>0061 <BR><SPAN style="COLOR: red">超强删除格式化工具(弱智)</SPAN>
<BR>比PQMagic安全的、建立删除格式化的小工具:sfdisk.exe for msdos <BR><A
href="http://www.wushuang.net/soft/sfdisk.zip"
target=_blank>http://www.wushuang.net/soft/sfdisk.zip</A>
<BR><BR>0062 <BR><SPAN
style="COLOR: red">如何让xmms播放列表里显示正确的中文(myxfc)</SPAN>
<BR>-*-*-*-*-*-iso8859-1,-misc-simsun-medium-r-normal--12-*-*-*-*-*-gbk-0,*-r-
<BR>把这个东西完全拷贝到你的字体里面 <BR>操作方法: <BR>右键单击xmms播放工具的任何地方
<BR>会看到一个"选项",然后选择"功能设定"选择"fonts" <BR>然后把上面的字体完整的拷贝到"播放清单"和 "user x
font <BR><BR>0063 <BR><SPAN
style="COLOR: red">linux下听MP3(hehhb)</SPAN>
<BR>redhat光盘原带然xmms不能播放MP3(无声),
要下载安装一个RPM包:xmms-mp3-1.2.7-13.p.i386.rpm安装即可.打开xmms,ctl-p,在font栏中
<BR>先在上半部的小框内打勾,再选择 “fixed(misc) gbk-0 13”号字
<BR>体即可显示中文歌曲名。在音频输出插件中选择 "开放音频系统驱动 <BR>程序 1.2.7
[lioOSS.so]即可正常播放MP3文件. <BR><BR>0064 <BR><SPAN
style="COLOR: red">安装中文字体(hehhb)</SPAN> <BR>先下载 <A
href="http://freshair.netchina.com.cn/~George/sm.sh"
target=_blank>http://freshair.netchina.com.cn/~George/sm.sh</A>
<BR>(参考文献: <A
href="http://www.linuxeden.com/edu/doctext.php?docid=2679)"
target=_blank>http://www.linuxeden.com/edu/doctext.php?docid=2679)</A>
<BR>SimSun18030.ttc在微软网站可下载,http://www.microsoft.com/china/windows2000/downloads/18
<BR>030.asp 它是个msi文件,在 mswindows中安装用的,装好后在windows目录下的fonts
<BR>目录里面就可以找到它。把simsun.ttc,SimSun18030.ttc,tahoma.ttf,tahomabd.ttf
<BR>拷贝到/usr/local/temp,然后下载的shell文件也放到这个目录里,然后打开终端 <BR>cd
/usr/local/temp <BR>chmod 755 sm.sh <BR>./sm.sh <BR><BR>0065
<BR><SPAN
style="COLOR: red">装载windows分区的FAT32、FAT16文件系统(hehhb)</SPAN>
<BR>以root身份进入KDE,点击桌面上的“起点”图标,在/mnt目录下建立如下文件夹:c,d,e,f,g,usb.分别用作windows下各分区和usb闪盘。
<BR> 用文本编辑器打开/etc/fstab 文件.加入如下: <BR>/dev/hda1 /mnt/c vfat
iocharset=gb2312,umask=0,codepage=936 0 0 <BR>/dev/hda5 /mnt/d vfat
iocharset=gb2312,umask=0,codepage=936 0 0 <BR>/dev/hda6 /mnt/e vfat
iocharset=gb2312,umask=0,codepage=936 0 0 <BR>/dev/hda7 /mnt/f vfat
iocharset=gb2312,umask=0,codepage=936 0 0 <BR>/dev/hda8 /mnt/g vfat
iocharset=gb2312,umask=0,codepage=936 0 0 <BR>/dev/cdrom /mnt/cdrom
udf,iso9660 noauto,iocharset=gb2312,owner,kudzu,ro 0 0 <BR>/dev/sda1
/mnt/usb vfat iocharset=gb2312,umask=0,codepage=936 0 0 <BR>存盘退出.
重新启动后即可正常访问FAT32或FAT16格式分区,解决显示WINDOWS分区下和光盘中文文件名乱码
<BR>问题.其中共六列,每列用Tab键分开。注意此方法只能mount上Fat 分区格式.sda1是闪盘。
<BR><BR>----------------------------网络相关篇--------------------------
<BR>0001 <BR><SPAN style="COLOR: red">让apache的默认字符集变为中文</SPAN>
<BR>如果是1.*,vi httpd.conf <BR>找到 AddDefaultCharset ISO8859-1
一行,改为AddDefaultCharset GB2312 <BR>如果是2.*的话,需要改动一个地方,vi httpd.conf
<BR>AddDefaultCharset ISO-8859-1 改为 AddDefaultCharset off
<BR><BR>0002 <BR><SPAN style="COLOR: red">永久更改ip</SPAN> <BR>ifconfig
eth0 新ip <BR>然后编辑/etc/sysconfig/network-scripts/ifcfg-eth0,修改ip
<BR><BR>0003 <BR><SPAN
style="COLOR: red">从Linux上远程显示Windows桌面(lnx3000)</SPAN>
<BR>安装rdesktop包 <BR><BR>0004 <BR><SPAN
style="COLOR: red">手动添加默认网关</SPAN> <BR>以root用户,执行: route add default
gw 网关的IP <BR>想更改网关 <BR>1 vi
/etc/sysconfig/network-scripts/ifcfg-eth0 <BR>更改GATEWAY <BR>2
/etc/init.d/network restart <BR><BR>0005 <BR><SPAN
style="COLOR: red">redhat 8.0上msn和qq</SPAN> <BR>下载Gaim 0.58版: <BR><A
href="http://www.linuxsir.org/gaim/gaim-0.58-2.i386.rpm"
target=_blank>www.linuxsir.org/gaim/gaim-0.58-2.i386.rpm</A>
<BR>下载QQ插件 for gcc2.9版: <BR><A
href="http://www.linuxsir.org/gaim/libqq-0.0.3-ft-0.58-gcc296.so.gz"
target=_blank>www.linuxsir.org/gaim/libqq-0.0.3-ft-0.58-gcc296.so.gz</A>
<BR>将下载的文件放入/temp目录,然后将系统中已有的Gaim删除,即在终端仿真器中键入命令:rpm -e gaim。
<BR>开始安装 <BR>打开终端仿真器,继续执行下列命令安装Gaim 0.58版,即: <BR>cd
/temp (进入temp目录) <BR>rpm -ivh gaim-0.58-2.i386.rpm (安装软件)
<BR>当安装成功后,你就可以在GNOME或KDE桌面建立Gaim图标了。 <BR>继续安装QQ插件,即键入命令: <BR>gunzip
libqq-0.0.3-ft-0.58-gcc296.so.gz (解压缩文件) <BR>cp
libqq-0.0.3-ft-0.58-gcc296.so /usr/lib/gaim (复制插件到gaim库目录中) <BR>软件设置
<BR>首次启动Gaim 0.85版时,会出现的登录界面。先选择“插件”,在插件对话框中点击“加载”,分别将
<BR>libmsn.so和libqq-0.0.3-ft-0.58-gcc296.so文件装入,确认后关闭。然后再选择“所有帐号”,在
<BR>出现的帐号编辑器中继续点击“增加”,当出现的修改帐号页面时,我们就可以输入自己的QQ或MSN号
<BR>了,登录名填写QQ号码或MSN邮箱,密码填写对应的QQ或MSN密码,Alias填写自己的昵称,协议选择
<BR>相应的QQ或MSN,其他的设置按默认的即可。当全部设置完成后就可以登录使用了。 <BR><BR>0006 <BR><SPAN
style="COLOR: red">查出22端口现在运行什么程序</SPAN> <BR>lsof -i :22
<BR><BR>0007 <BR><SPAN style="COLOR: red">查看本机的IP,gateway,
dns</SPAN> <BR>IP: <BR>以root用户登录,执行ifconfig。其中eth0是第一块网卡,lo是默认的设备
<BR>Gateway: <BR>以root用户登录,执行netstat -rn,以0.0.0.0开头的一行的Gateway即为默认网关
<BR>也可以查看/etc/sysconfig/network文件,里面有指定的地址! <BR>DNS: <BR>more
/etc/reslov.conf,内容指定如下: <BR>nameserver 202.96.69.38 <BR>nameserver
202.96.64.38 <BR><BR>0008 <BR><SPAN
style="COLOR: red">RH8.0命令行下轻松改变ping 的TTL值(cgweb)</SPAN> <BR>#sysctl
-w net.ipv4.ip_default_ttl=N <BR>(N=0~255),若N>255,则ttl=0
<BR><BR>0009 <BR><SPAN
style="COLOR: red">RH8.0命令行下轻松改变系统配置默认值(houaq)</SPAN>
<BR>编辑/etc/sysctl.conf, 例如,将 <BR>net.ipv4.ip_forward = 0 <BR>变为
<BR>net.ipv4.ip_forward = 1 <BR>重启后生效,用sysctl -a查看可知 <BR><BR>0010
<BR><SPAN style="COLOR: red">mount局域网上其他windows机器共享出的目录</SPAN>
<BR>mount -t smbfs -o username=guest,password=guest //machine/path
/mnt/cdrom <BR><BR>0011 <BR><SPAN
style="COLOR: red">允许|禁止root通过SSH登陆(Fun-FreeBSD)</SPAN>
<BR>修改sshd_config:PermitRootLogin no|yes <BR><BR>0012 <BR><SPAN
style="COLOR: red">让root直接telnet登陆</SPAN> <BR>编辑/etc/pam.d/login,去掉
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -