﻿<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/"><channel><title>C++博客-茶博-随笔分类-liunx.unix相关</title><link>http://www.cppblog.com/yehongly/category/8418.html</link><description /><language>zh-cn</language><lastBuildDate>Tue, 28 Oct 2008 18:47:31 GMT</lastBuildDate><pubDate>Tue, 28 Oct 2008 18:47:31 GMT</pubDate><ttl>60</ttl><item><title>linux学习笔记</title><link>http://www.cppblog.com/yehongly/archive/2008/10/27/65222.html</link><dc:creator>茶</dc:creator><author>茶</author><pubDate>Mon, 27 Oct 2008 09:37:00 GMT</pubDate><guid>http://www.cppblog.com/yehongly/archive/2008/10/27/65222.html</guid><wfw:comment>http://www.cppblog.com/yehongly/comments/65222.html</wfw:comment><comments>http://www.cppblog.com/yehongly/archive/2008/10/27/65222.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/yehongly/comments/commentRss/65222.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/yehongly/services/trackbacks/65222.html</trackback:ping><description><![CDATA[linux目录架构 <br> / &nbsp;  &nbsp;  &nbsp; 根目录 <br> /bin &nbsp;  &nbsp;  &nbsp;  &nbsp; 常用的命令 &nbsp; binary &nbsp; file &nbsp; 的目錄 <br> /boot &nbsp;  &nbsp;  &nbsp; 存放系统启动时必须读取的档案，包括核心 &nbsp; (kernel) &nbsp; 在内 <br>  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp; /boot/grub/menu.lst &nbsp;  &nbsp;  &nbsp; GRUB设置 <br>  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp; /boot/vmlinuz &nbsp;  &nbsp;  &nbsp; 内核 <br>  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp; /boot/initrd &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp; 核心解壓縮所需 &nbsp; RAM &nbsp; Disk <br> /dev &nbsp;  &nbsp;  &nbsp;  &nbsp; 系统周边设备 &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  <br> /etc &nbsp;  &nbsp;  &nbsp;  &nbsp; 系统相关设定文件 <br>  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp; /etc/DIR_COLORS &nbsp;  &nbsp;  &nbsp; 设定颜色 <br>  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp; /etc/HOSTNAME &nbsp;  &nbsp;  &nbsp; 设定用户的节点名 <br>  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp; /etc/NETWORKING &nbsp;  &nbsp;  &nbsp; 只有YES标明网络存在 <br>  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp; /etc/host.conf &nbsp; 文件说明用户的系统如何查询节点名 <br>  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp; /etc/hosts &nbsp; 设定用户自已的IP与名字的对应表 <br>  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp; /etc/hosts.allow &nbsp; 设置允许使用inetd的机器使用 &nbsp;  <br>  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp; /etc/hosts.deny &nbsp; 设置不允许使用inetd的机器使用 <br>  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp; /etc/hosts.equiv &nbsp; 设置远端机不用密码 <br>  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp; /etc/inetd.conf &nbsp; 设定系统网络守护进程inetd的配置 <br>  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp; /etc/gateways &nbsp; 设定路由器 <br>  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp; /etc/protocols &nbsp; 设定系统支持的协议 <br>  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp; /etc/named.boot &nbsp; 设定本机为名字服务器的配置文件 <br>  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp; /etc/sysconfig/network-scripts/ifcfg-eth0 &nbsp;  &nbsp;  &nbsp; 设置IP <br>  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp; /etc/resolv.conf &nbsp;  &nbsp;  &nbsp;  &nbsp; 设置DNS &nbsp;  &nbsp;  <br>  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp; /etc/X11 &nbsp;  &nbsp; X &nbsp; Window的配置文件,xorg.conf &nbsp; 或 &nbsp; XF86Config &nbsp; 這兩個 &nbsp; X &nbsp; Server &nbsp; 的設定檔 <br>  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp; /etc/fstab &nbsp;  &nbsp;  &nbsp;  &nbsp; 记录开机要mount的文件系统 <br>  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp; /etc/inittab &nbsp; 设定系统启动时init进程将把系统设置成什么样的runlevel <br>  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp; /etc/issue &nbsp; 记录用户登录前显示的信息 <br>  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp; /etc/group &nbsp; 设定用户的组名与相关信息 <br>  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp; /etc/passwd &nbsp; 帐号信息 <br>  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp; /etc/shadow &nbsp; 密码信息 <br>  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp; /etc/sudoers &nbsp; 可以sudo命令的配置文件 <br>  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp; /etc/securetty &nbsp; 设定哪些终端可以让root登录 <br>  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp; /etc/login.defs &nbsp; 所有用户登录时的缺省配置 <br>  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp; /etc/exports &nbsp; 设定NFS系统用的 <br>  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp; /etc/init.d/ &nbsp;  &nbsp;  &nbsp; 所有服務的預設啟動 &nbsp; script &nbsp; 都是放在這裡的，例如要啟動或者關閉 <br>  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp; /etc/xinetd.d/ &nbsp;  &nbsp; 這就是所謂的 &nbsp; super &nbsp; daemon &nbsp; 管理的各項服務的設定檔目錄 <br>  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp; /etc/modprobe.conf &nbsp;  &nbsp;  &nbsp; 内核模块额外参数设定 <br>  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp; /etc/syslog.conf &nbsp;  &nbsp;  &nbsp; 日志设置文件 <br> /home &nbsp;  &nbsp;  &nbsp; 使用者家目录 <br> /lib &nbsp;  &nbsp;  &nbsp;  &nbsp; 系统会使用到的函数库 <br>  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp; /lib/modules &nbsp;  &nbsp;  &nbsp; kernel &nbsp; 的相关模块 <br>  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp; /var/lib/rpm &nbsp;  &nbsp;  &nbsp; rpm套件安装处 &nbsp;  <br> /lost+found &nbsp;  &nbsp;  &nbsp;  &nbsp; 系統不正常產生錯誤時，會將一些遺失的片段放置於此目錄下 <br> /mnt &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp; 外设的挂载点 <br> /media &nbsp;  &nbsp;  &nbsp; 与/mnt类似 <br> /opt &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp; 主机额外安装的软件 <br> /proc &nbsp;  &nbsp;  &nbsp;  &nbsp; 虚拟目录，是内存的映射 <br>  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp; /proc/version &nbsp;  &nbsp;  &nbsp; 内核版本 <br>  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp; /proc/sys/kernel &nbsp;  &nbsp;  &nbsp; 系统内核功能 <br> /root &nbsp;  &nbsp;  &nbsp;  &nbsp; 系统管理员的家目录 <br> /sbin &nbsp;  &nbsp;  &nbsp;  &nbsp; 系统管理员才能执行的指令 <br> /srv &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp; 一些服務啟動之後，這些服務所需要取用的資料目錄 <br> /tmp &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp; 一般使用者或者是正在執行的程序暫時放置檔案的地方 <br> /usr &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp; 最大的目录，存许应用程序和文件 <br>  &nbsp;  &nbsp;  &nbsp;  &nbsp; /usr/X11R6： &nbsp;  &nbsp;  &nbsp; X-Window目录 &nbsp;  <br>  &nbsp;  &nbsp;  &nbsp;  &nbsp; /usr/src： &nbsp;  &nbsp;  &nbsp;  &nbsp; Linux源代码 <br>  &nbsp;  &nbsp;  &nbsp;  &nbsp; /usr/include：系统头文件 <br>  &nbsp;  &nbsp;  &nbsp;  &nbsp; /usr/openwin &nbsp; 存放SUN的OpenWin &nbsp;  <br>  &nbsp;  &nbsp;  &nbsp;  &nbsp; /usr/man &nbsp; 在线使用手册 <br>  &nbsp;  &nbsp;  &nbsp;  &nbsp; /usr/bin &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp; 使用者可執行的 &nbsp; binary &nbsp; file &nbsp; 的目錄 <br>  &nbsp;  &nbsp;  &nbsp;  &nbsp; /usr/local/bin &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp; 使用者可執行的 &nbsp; binary &nbsp; file &nbsp; 的目錄 <br>  &nbsp;  &nbsp;  &nbsp;  &nbsp; /usr/lib &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp; 系统会使用到的函数库 <br>  &nbsp;  &nbsp;  &nbsp;  &nbsp; /usr/local/lib &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp; 系统会使用到的函数库 <br>  &nbsp;  &nbsp;  &nbsp;  &nbsp; /usr/sbin &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp; 系统管理员才能执行的指令 <br>  &nbsp;  &nbsp;  &nbsp;  &nbsp; /usr/local/sbin &nbsp;  &nbsp;  &nbsp;  &nbsp; 系统管理员才能执行的指令 <br> /var &nbsp;  &nbsp;  &nbsp; 日志文件 <br>  &nbsp;  &nbsp;  &nbsp;  &nbsp; /var/log/secure &nbsp;  &nbsp;  &nbsp;  &nbsp; 記錄登入系統存取資料的檔案，例如 &nbsp; pop3, &nbsp; ssh, &nbsp; telnet, &nbsp; ftp &nbsp; 等都會記錄在此檔案中 <br>  &nbsp;  &nbsp;  &nbsp;  &nbsp; /var/log/wtmp &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp; 記錄登入者的訊息資料, &nbsp; last <br>  &nbsp;  &nbsp;  &nbsp;  &nbsp; /var/log/messages &nbsp;  &nbsp; 幾乎系統發生的錯誤訊息 <br>  &nbsp;  &nbsp;  &nbsp;  &nbsp; /var/log/boot.log &nbsp;  &nbsp; 記錄開機或者是一些服務啟動的時候，所顯示的啟動或關閉訊息 <br>  &nbsp;  &nbsp;  &nbsp;  &nbsp; /var/log/maillog &nbsp;  &nbsp;  &nbsp; 紀錄郵件存取或往來( &nbsp; sendmail &nbsp; 與 &nbsp; pop3 &nbsp; )的使用者記錄 <br>  &nbsp;  &nbsp;  &nbsp;  &nbsp; /var/log/cron &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp; 記錄 &nbsp; crontab &nbsp; 這個例行性服務的內容 <br>  &nbsp;  &nbsp;  &nbsp;  &nbsp; /var/log/httpd, &nbsp; /var/log/news, &nbsp; /var/log/mysqld.log, &nbsp; /var/log/samba, &nbsp; /var/log/procmail.log： <br>  &nbsp;  &nbsp;  &nbsp;  &nbsp; 分別是幾個不同的網路服務的記錄檔 <br>  &nbsp;  一些常用的基本命令: <br> uname &nbsp; -a &nbsp;  &nbsp;  &nbsp;  &nbsp; 查看内核版本 &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  <br> ls &nbsp; -al &nbsp;  &nbsp;  &nbsp;  &nbsp; 显示所有文件的属性 <br> pwd &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp; 显示当前路径 &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  <br> cd &nbsp; - &nbsp;  &nbsp;  &nbsp;  &nbsp; 返回上一次目录 &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp; cd &nbsp; ~ &nbsp;  &nbsp;  &nbsp;  &nbsp; 返回主目录 <br> date &nbsp; s &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp; 设置时间、日期 &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  <br> cal &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp; 显示日历 &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp; cal &nbsp; 2006 <br> bc &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp; 计算器具 &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  <br> man &nbsp;  &nbsp; &amp; &nbsp; info &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp; 帮助手册 <br> locale &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp; 显示当前字体 &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp; locale &nbsp; -a &nbsp;  &nbsp;  &nbsp;  &nbsp; 所有可用字体 &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp; /etc/sysconfig/i18n设置文件 <br> LANG=en &nbsp;  &nbsp;  &nbsp;  &nbsp; 使用英文字体 &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  <br> sync &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp; 将数据同步写入硬盘 &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  <br> shutdonw &nbsp; -h &nbsp; now &nbsp; &amp; &nbsp; half &nbsp; &amp; &nbsp; poweroff &nbsp;  &nbsp; 关机 <br> reboot &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp; 重启 &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  <br> startx &nbsp;  &nbsp; &amp; &nbsp;  &nbsp; init &nbsp; 5 &nbsp;  &nbsp;  &nbsp; 进入图形介面 <br> /work &nbsp;  &nbsp; &amp; &nbsp; ?work &nbsp;  &nbsp;  &nbsp;  &nbsp; 向上、下查找文档内容 <br> chgrp &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp; 改变档案群组 &nbsp;  &nbsp; chgrp &nbsp; testing &nbsp; install.log &nbsp;  &nbsp;  &nbsp;  &nbsp;  <br> chown &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp; 改变所属人 &nbsp;  &nbsp;  &nbsp; chown &nbsp; root:root &nbsp; install.log <br> chmod &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp; 改变属性 &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp; chmod &nbsp; 777 &nbsp; install.log &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp; read=4 &nbsp;  &nbsp; write=2 &nbsp;  &nbsp; execute=1 <br> cp &nbsp;  &nbsp;  &nbsp; 复制 &nbsp;  &nbsp;  &nbsp; cp &nbsp; filename <br> rm &nbsp;  &nbsp;  &nbsp; 删除文件 &nbsp;  &nbsp; rm &nbsp; -rf &nbsp; filename &nbsp;  &nbsp;  &nbsp; 强制删除文件 <br> rmdir &nbsp;  &nbsp;  &nbsp; 删除文件夹 <br> mv &nbsp;  &nbsp; 移动 &nbsp;  &nbsp;  &nbsp;  &nbsp; mv &nbsp; 123.txt &nbsp; 222.txt &nbsp;  &nbsp; 重命名 <br> mkdir &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp; 创建文件夹 <br> touch &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp; 创建文件 &nbsp;  &nbsp; 更新当前时间 <br> cat &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp; 由第一行开始显示 &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp; cat &nbsp; |more &nbsp;  &nbsp; 分页 <br> nl &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp; 在内容前加行号 <br> more &nbsp;  &nbsp; &amp; &nbsp;  &nbsp; less &nbsp;  &nbsp;  &nbsp; 一面一面翻动 <br> head &nbsp; -n &nbsp; filename &nbsp;  &nbsp;  &nbsp; 显示第N行内容 <br> tail &nbsp; -n &nbsp; filename &nbsp;  &nbsp; 显示后N行内容 <br> od &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp; 显示非纯文档 <br> df &nbsp; -h &nbsp; 显示分区空间 <br> du &nbsp;  &nbsp; 显示目录或文件的大小 <br> fdisk &nbsp;  &nbsp;  &nbsp; 分区设置 &nbsp;  &nbsp;  &nbsp;  &nbsp; fdisk &nbsp; -l &nbsp; /dev/hda &nbsp;  &nbsp; 显示硬盘分区状态 <br> mkfs &nbsp;  &nbsp;  &nbsp;  &nbsp; 建立各种文件系统 &nbsp;  &nbsp; mkfs &nbsp; -t &nbsp; ext3 &nbsp;  &nbsp; /dev/ram15 &nbsp;  &nbsp;  &nbsp;  <br> fsck &nbsp;  &nbsp;  &nbsp;  &nbsp; 检查和修复LINUX档案 <br> ln &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp; 硬链接 &nbsp;  &nbsp;  &nbsp; ln &nbsp; -s &nbsp;  &nbsp; 软件链接 <br> whereis &nbsp;  &nbsp;  &nbsp; 查找命令 <br> locate &nbsp;  &nbsp;  &nbsp;  &nbsp; 查找 <br> find &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp; 查找 &nbsp;  &nbsp;  &nbsp; find &nbsp; / &nbsp; -name &nbsp;  "***.*** " <br> which &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp; 查看工具 <br> whoami &nbsp;  &nbsp;  &nbsp;  &nbsp; 显示当前用户 <br> gcc &nbsp; -v &nbsp;  &nbsp;  &nbsp;  &nbsp; 查看GCC版本 <br> chattr &nbsp; +i &nbsp; filename &nbsp;  &nbsp; 禁止删除 &nbsp;  &nbsp;  &nbsp; chattr &nbsp; -i &nbsp; filename &nbsp;  &nbsp; 取消禁止 <br> lsattr &nbsp;  &nbsp;  &nbsp;  &nbsp; 显示隐藏档属性 <br> updatedb &nbsp;  &nbsp; 更新资料库 <br> mke2fs &nbsp;  &nbsp;  &nbsp;  &nbsp; 格式化 &nbsp;  &nbsp;  &nbsp; mkfs &nbsp; -t &nbsp; ext3 &nbsp;  <br> dd &nbsp; if=/etc/passwd &nbsp; of=/tmp/passwd.bak &nbsp;  &nbsp;  &nbsp;  &nbsp; 备份 <br> mount &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp; 列出系统所有的分区 <br> mount &nbsp; -t &nbsp; iso9660 &nbsp; /dev/cdrom &nbsp; /mnt/cdrom &nbsp;  &nbsp;  &nbsp; 挂载光盘 <br> mount &nbsp; -t &nbsp; vfat &nbsp; /dev/fd0 &nbsp; /mnt/floppy &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp; 挂载软盘 <br> mount &nbsp; -t &nbsp; vfat &nbsp; -o &nbsp; iocharset=utf8,umask=000 &nbsp; /dev/hda2 &nbsp; /mnt/hda2 &nbsp;  &nbsp;  &nbsp; 挂载fat32分区 <br> mount &nbsp; -t &nbsp; ntfs &nbsp; -o &nbsp; nls=utf8,umask=000 &nbsp; /dev/hda3 &nbsp; /mnt/hda3 &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp; 挂载ntfs分区 <br> Linux-NTFS &nbsp; Project: &nbsp; http://linux-ntfs.sourceforge.net/ <br> umount &nbsp; /mnt/hda3 &nbsp;  &nbsp; 缷载 <br> ifconfig &nbsp;  &nbsp;  &nbsp; 显示或设置网络设备 <br> service &nbsp; network &nbsp; restart &nbsp;  &nbsp;  &nbsp; 重启网卡 &nbsp;  &nbsp;  <br> ifdown &nbsp; eth0 &nbsp;  &nbsp; 关闭网卡 <br> ifup &nbsp; eth0 &nbsp;  &nbsp;  &nbsp;  &nbsp; 开启网卡 <br> clear &nbsp;  &nbsp;  &nbsp;  &nbsp; 清屏 <br> history &nbsp;  &nbsp;  &nbsp;  &nbsp; 历史记录 &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp; !55 &nbsp;  &nbsp; 执行第55个指令 <br> stty &nbsp;  &nbsp;  &nbsp; 设置终端 &nbsp;  &nbsp;  &nbsp;  &nbsp; stty &nbsp; -a <br> fdisk &nbsp; /mbr &nbsp;  &nbsp;  &nbsp; 删除GRUB <br> at &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp; 僅進行一次的工作排程 <br> crontab &nbsp;  &nbsp;  &nbsp; 循環執行的例行性命令 &nbsp;  &nbsp;  &nbsp;  &nbsp; [e]编辑,[l]显示,[r]删除任务 <br> &amp; &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp; 后台运行程序 &nbsp;  &nbsp;  &nbsp;  &nbsp; tar &nbsp; -zxvf &nbsp; 123.tar.gz &nbsp; &amp; &nbsp; ---------&gt; 后台运行 <br> jobs &nbsp;  &nbsp;  &nbsp;  &nbsp; 观看后台暂停的程序 &nbsp;  &nbsp;  &nbsp; jobs &nbsp; -l <br> fg &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp; 将后台程序调到前台 &nbsp;  &nbsp;  &nbsp; fg &nbsp; n &nbsp; ------&gt; n是数字,可以指定进行那个程序 <br> bg &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp; 让工作在后台运行 <br> kill &nbsp;  &nbsp;  &nbsp;  &nbsp; 结束进程 &nbsp;  &nbsp;  &nbsp;  &nbsp; kill &nbsp; -9 &nbsp; PID &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp; [9]强制结束,[15]正常结束,[l]列出可用的kill信号 <br> ps &nbsp; aux &nbsp;  &nbsp; 查看后台程序 &nbsp;  &nbsp;  &nbsp;  <br> top &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp; 查看后台程序 &nbsp;  &nbsp;  &nbsp; top &nbsp; -d &nbsp; 2 &nbsp;  &nbsp;  &nbsp;  &nbsp; 每两秒更新一次 &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp; top &nbsp; -d &nbsp; 2 &nbsp; -p10604 &nbsp;  &nbsp;  &nbsp; 观看某个PID <br>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; top &nbsp; -b &nbsp; -n &nbsp; 2 &nbsp; &gt; &nbsp; /tmp/top.txt &nbsp; -----&gt; 將 &nbsp;
top &nbsp; 的資訊進行 &nbsp; 2 &nbsp; 次，然後將結果輸出到 &nbsp; /tmp/top.txt &nbsp; &nbsp; &nbsp; &nbsp; <br> pstree &nbsp;  &nbsp;  &nbsp; 以树状图显示程序 &nbsp;  &nbsp;  &nbsp;  &nbsp; [A]以 &nbsp; ASCII &nbsp; 來連接, &nbsp; [u]列出PID, &nbsp; [p]列出帐号 <br> killall &nbsp;  &nbsp;  &nbsp; 要刪除某個服務 &nbsp;  &nbsp;  &nbsp;  &nbsp; killall &nbsp; -9 &nbsp; httpd <br> free &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp; 显示内存状态 &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp; free &nbsp; -m &nbsp;  &nbsp; --------&gt; 以M为单位显示 <br> uptime &nbsp;  &nbsp;  &nbsp;  &nbsp; 显示目前系统开机时间 <br> netstat &nbsp;  &nbsp;  &nbsp; 显示网络状态 &nbsp;  &nbsp;  &nbsp;  &nbsp; netstat &nbsp; -tulnp------&gt; 找出目前系統上已在監聽的網路連線及其 &nbsp; PID <br> dmesg &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp; 显示开机信息 &nbsp;  &nbsp;  &nbsp;  &nbsp; demsg &nbsp; | &nbsp; more <br>
nice &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 设置优先权 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; nice &nbsp; -n &nbsp; -5 &nbsp; vi &nbsp; &amp; &nbsp;
-----&gt; 用 &nbsp; root &nbsp; 給一個 &nbsp; nice &nbsp; 植為 &nbsp; -5 &nbsp; ，用於執行 &nbsp; vi &nbsp; <br> renice &nbsp;  &nbsp;  &nbsp;  &nbsp; 调整已存在优先权 <br> runlevel &nbsp;  &nbsp; 显示目前的runlevel <br> depmod &nbsp;  &nbsp;  &nbsp;  &nbsp; 分析可载入模块的相依性 <br> lsmod &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp; 显示已载入系统的模块 <br> modinfo &nbsp;  &nbsp;  &nbsp; 显示kernel模块的信息 <br> insmod &nbsp;  &nbsp;  &nbsp;  &nbsp; 载入模块 <br> modprobe &nbsp;  &nbsp;  &nbsp; 自动处理可载入模块 <br> rmmod &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp; 删除模块 <br> chkconfig &nbsp;  &nbsp;  &nbsp; 检查，设置系统的各种服务 &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp; chkconfig &nbsp; --list &nbsp; -----&gt; 列出各项服务状态 <br> ntsysv &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp; 设置系统的各种服务 <br> cpio &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp; 备份文件 <br>  &nbsp;  压缩命令： <br>  &nbsp; *.Z &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp; compress &nbsp; 程式壓縮的檔案； &nbsp;  <br>  &nbsp; *.bz2 &nbsp;  &nbsp;  &nbsp;  &nbsp; bzip2 &nbsp; 程式壓縮的檔案； &nbsp;  <br>  &nbsp; *.gz &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp; gzip &nbsp; 程式壓縮的檔案； &nbsp;  <br>  &nbsp; *.tar &nbsp;  &nbsp;  &nbsp;  &nbsp; tar &nbsp; 程式打包的資料，並沒有壓縮過； &nbsp;  <br>  &nbsp; *.tar.gz &nbsp; tar &nbsp; 程式打包的檔案，其中並且經過 &nbsp; gzip &nbsp; 的壓縮 <br> compress &nbsp; filename &nbsp;  &nbsp; 压缩文件 &nbsp;  &nbsp; 加[-d]解压 &nbsp;  &nbsp; uncompress <br> gzip &nbsp; filename &nbsp;  &nbsp;  &nbsp; 压缩 &nbsp;  &nbsp; 加[-d]解压 &nbsp;  &nbsp; zcat &nbsp; 123.gz &nbsp; 查看压缩文件内容 <br> bzip2 &nbsp; -z &nbsp; filename &nbsp;  &nbsp; 压缩 &nbsp;  &nbsp; 加[-d]解压 &nbsp;  &nbsp;  &nbsp; bzcat &nbsp; filename.bz2 &nbsp;  &nbsp; 查看压缩文件内容 <br> tar &nbsp; -cvf &nbsp; /home/123.tar &nbsp; /etc &nbsp;  &nbsp; 打包，不压缩 <br> tar &nbsp; -xvf &nbsp; 123.tar &nbsp;  &nbsp;  &nbsp; 解开包 <br> tar &nbsp; -zxvf &nbsp; /home/123.tar.gz &nbsp;  &nbsp; 以gzip解压 <br> tar &nbsp; -jxvf &nbsp; /home/123.tar.bz2 &nbsp;  &nbsp; 以bzip2解压 <br> tar &nbsp; -ztvf &nbsp; /tmp/etc.tar.gz &nbsp;  &nbsp;  &nbsp; 查看tar内容 <br> cpio &nbsp; -covB &nbsp;  &nbsp; &gt;  &nbsp; [file|device] &nbsp;  &nbsp;  &nbsp; 份份 <br> cpio &nbsp; -icduv &nbsp;  &lt; &nbsp; [file|device] &nbsp;  &nbsp;  &nbsp; 还原 <br>  &nbsp;  <br> vi一般用法 <br> 一般模式 &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp; 编辑模式 &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp; 指令模式 <br> h &nbsp; 左 &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp; a,i,r,o,A,I,R,O &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp; :w &nbsp; 保存 <br> j &nbsp; 下 &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp; 进入编辑模式 &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp; :w! &nbsp; 强制保存 <br> k &nbsp; 上 &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp; dd &nbsp; 删除光标当前行 &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp; :q! &nbsp; 不保存离开 <br> l &nbsp; 右 &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp; ndd &nbsp; 删除n行 &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp; :wq! &nbsp; 保存后离开 <br> 0 &nbsp; 移动到行首 &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp; yy &nbsp; 复制当前行 &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp; :e! &nbsp; 还原原始档 <br> $ &nbsp; 移动到行尾 &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp; nyy &nbsp; 复制n行 &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp; :w &nbsp; filename &nbsp; 另存为 <br> H &nbsp; 屏幕最上 &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp; p,P &nbsp; 粘贴 &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp; :set &nbsp; nu &nbsp; 设置行号 <br>
M &nbsp; 屏幕中央 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; u &nbsp; &nbsp; 撤消 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; :set &nbsp; nonu &nbsp; 取消行号 <br> L &nbsp; 屏幕最下 &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp; [Ctrl]+r &nbsp; 重做上一个动作 &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp; ZZ &nbsp; 保存离开 <br> G &nbsp; 档案最后一行 &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp; [ctrl]+z &nbsp; 暂停退出 &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp; :set &nbsp; nohlsearch &nbsp;  &nbsp;  &nbsp; 永久地关闭高亮显示 <br>
/work &nbsp; 向下搜索 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; :sp &nbsp; 同时打开两个文档 &nbsp; <br> ?work &nbsp; 向上搜索 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; [Ctrl]+w &nbsp; 两个文档设换 <br>
gg &nbsp; 移动到档案第一行 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; :nohlsearch &nbsp; &nbsp; &nbsp; &nbsp; 暂时关闭高亮显示 <br>  &nbsp;  <br> 认识SHELL <br> alias &nbsp;  &nbsp;  &nbsp;  &nbsp; 显示当前所有的命令别名 &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp; alias &nbsp; lm= "ls &nbsp; -al " &nbsp;  &nbsp;  &nbsp; 命令别名 &nbsp;  &nbsp;  &nbsp;  &nbsp; unalias &nbsp; lm &nbsp; 取消命令别名 <br> type &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp; 类似which <br> exprot &nbsp;  &nbsp;  &nbsp;  &nbsp; 设置或显示环境变量 <br> exprot &nbsp; PATH= "$PATH ":/sbin &nbsp;  &nbsp; 添加/sbin入PATH路径 <br> echo &nbsp; $PATH &nbsp;  &nbsp;  &nbsp;  &nbsp; 显示PATH路径 <br> bash &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp; 进入子程序 <br> name=yang &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp; 设定变量 <br> unset &nbsp; name &nbsp;  &nbsp;  &nbsp;  &nbsp; 取消变量 <br> echo &nbsp; $name &nbsp;  &nbsp;  &nbsp;  &nbsp; 显示变量的内容 <br> myname= "$name &nbsp; its &nbsp; me " &nbsp;  &nbsp;  &nbsp; &amp; &nbsp;  &nbsp;  &nbsp; myname= '$name &nbsp; its &nbsp; me ' &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp; 单引号时$name失去变量内容 <br> ciw=/etc/sysconfig/network-scripts/ &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp; 设置路径 <br> env &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp; 列出所有环境变量 <br> echo &nbsp; $RANDOM &nbsp;  &nbsp;  &nbsp;  &nbsp; 显示随意产生的数 <br> set &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp; 设置SHELL <br> PS1= '[\u@\h &nbsp; \w &nbsp; \A &nbsp; #\#]\$ &nbsp;  ' &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp; 提示字元的設定 <br>  &nbsp;  &nbsp;  &nbsp; [root@linux &nbsp; ~]# &nbsp; read &nbsp; [-pt] &nbsp; variable &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp; -----------读取键盘输入的变量 <br>  &nbsp;  &nbsp;  &nbsp; 參數： <br>  &nbsp;  &nbsp;  &nbsp; -p &nbsp;  &nbsp; ：後面可以接提示字元！ <br>  &nbsp;  &nbsp;  &nbsp; -t &nbsp;  &nbsp; ：後面可以接等待的『秒數！』 <br> declare &nbsp;  &nbsp;  &nbsp;  &nbsp; 声明 &nbsp; shell &nbsp; 变量 <br> ulimit &nbsp; -a &nbsp;  &nbsp;  &nbsp; 显示所有限制资料 <br>  &nbsp; ls &nbsp; /tmp/yang &nbsp; &amp;&amp; &nbsp; echo &nbsp;  "exist " &nbsp; || &nbsp; echo &nbsp;  "not &nbsp; exist " <br>  &nbsp; 意思是說，當 &nbsp; ls &nbsp; /tmp/yang &nbsp; 執行後，若正確，就執行echo &nbsp;  "exist " &nbsp; ,若有問題，就執行echo &nbsp;  "not &nbsp; exist " &nbsp;  <br>  &nbsp; echo &nbsp; $PATH &nbsp; | &nbsp; cut &nbsp; -d &nbsp;  ': ' &nbsp; -f &nbsp; 5 &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp; 以:为分隔符,读取第5段内容 <br>  &nbsp; export &nbsp; | &nbsp; cut &nbsp; -c &nbsp; 10-20 &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp; 读取第10到20个字节的内容 <br>  &nbsp; last &nbsp; | &nbsp; grep &nbsp;  'root ' &nbsp;  &nbsp;  &nbsp;  &nbsp; 搜索有root的一行,加[-v]反向搜索 <br>  &nbsp; cat &nbsp; /etc/passwd &nbsp; | &nbsp; sort &nbsp;  &nbsp;  &nbsp;  &nbsp; 排序显示 <br>  &nbsp; cat &nbsp; /etc/passwd &nbsp; | &nbsp; wc &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp; 显示『行、字数、字节数』 <br> 正规表示法 <br> [root@test &nbsp; root]# &nbsp; grep &nbsp; [-acinv] &nbsp;  '搜尋字串 ' &nbsp; filename <br>  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp; 參數說明： <br>  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp; -a &nbsp; ：將 &nbsp; binary &nbsp; 檔案以 &nbsp; text &nbsp; 檔案的方式搜尋資料 <br>  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp; -c &nbsp; ：計算找到 &nbsp;  '搜尋字串 ' &nbsp; 的次數 <br>  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp; -i &nbsp; ：忽略大小寫的不同，所以大小寫視為相同 <br>  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp; -n &nbsp; ：順便輸出行號 <br>  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp; -v &nbsp; ：反向選擇，亦即顯示出沒有 &nbsp;  '搜尋字串 ' &nbsp; 內容的那一行！ <br>  &nbsp; grep &nbsp; -n &nbsp;  'the ' &nbsp; 123.txt &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp; 搜索the字符 &nbsp; -----------搜尋特定字串 &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  <br>  &nbsp; grep &nbsp; -n &nbsp;  't[ea]st ' &nbsp; 123.txt &nbsp;  &nbsp;  &nbsp;  &nbsp; 搜索test或taste两个字符---------利用 &nbsp; [] &nbsp; 來搜尋集合字元 <br>  &nbsp; grep &nbsp; -n &nbsp;  '[^g]oo ' &nbsp; 123.txt &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp; 搜索前面不为g的oo-----------向選擇 &nbsp; [^] &nbsp;  <br>  &nbsp; grep &nbsp; -n &nbsp;  '[0-9] ' &nbsp; 123.txt &nbsp;  &nbsp; 搜索有0-9的数字 <br>  &nbsp; grep &nbsp; -n &nbsp;  '^the ' &nbsp; 123.txt &nbsp; 搜索以the为行首-----------行首搜索^ <br>  &nbsp; grep &nbsp; -n &nbsp;  '^[^a-zA-Z] ' &nbsp; 123.txt &nbsp;  &nbsp; 搜索不以英文字母开头 <br>  &nbsp; grep &nbsp; -n &nbsp;  '[a-z]$ ' &nbsp; 123.txt &nbsp;  &nbsp;  &nbsp;  &nbsp; 搜索以a-z结尾的行---------- &nbsp; 行尾搜索$ <br>  &nbsp; grep &nbsp; -n &nbsp;  'g..d ' &nbsp; 123.txt &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp; 搜索开头g结尾d字符----------任意一個字元 &nbsp; . &nbsp;  <br>  &nbsp; grep &nbsp; -n &nbsp;  'ooo* ' &nbsp; 123.txt &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp; 搜索至少有两个oo的字符---------重複字元 &nbsp; * <br> sed &nbsp;  &nbsp;  &nbsp;  &nbsp; 文本流编辑器 &nbsp;  &nbsp;  &nbsp;  &nbsp; 利用脚本命令来处理文本文件 <br> awd &nbsp;  &nbsp;  &nbsp;  &nbsp; 模式扫描和处理语言 <br>  &nbsp; nl &nbsp; 123.txt &nbsp; | &nbsp; sed &nbsp;  '2,5d ' &nbsp;  &nbsp;  &nbsp; 删除第二到第五行的内容 <br> diff &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp; 比较文件的差异 <br> cmp &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp; 比较两个文件是否有差异 <br> patch &nbsp;  &nbsp;  &nbsp;  &nbsp; 修补文件 <br> pr &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp; 要打印的文件格式化 <br>  &nbsp;  帐号管理 <br> /etc/passwd &nbsp;  &nbsp;  &nbsp;  &nbsp; 系统帐号信息 <br> /etc/shadow &nbsp;  &nbsp;  &nbsp;  &nbsp; 帐号密码信息 &nbsp;  &nbsp;  &nbsp;  &nbsp; 经MD5 &nbsp; 32位加密 <br>  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp; 在密码栏前面加『 &nbsp; * &nbsp; 』『 &nbsp; ! &nbsp; 』禁止使用某帐号 <br> /etc/group &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp; 系统群组信息 <br> /etc/gshadow <br> newgrp &nbsp;  &nbsp;  &nbsp;  &nbsp; 改变登陆组 <br> useradd &nbsp;  &nbsp; &amp; &nbsp;  &nbsp; adduser &nbsp;  &nbsp;  &nbsp;  &nbsp; 建立新用户 &nbsp;  &nbsp; ---------&gt;  &nbsp; useradd &nbsp; -m &nbsp; test &nbsp;  &nbsp; 自动建立用户的登入目录 <br>  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp; useradd &nbsp; -m &nbsp; -g &nbsp; pgroup &nbsp; test &nbsp; ---------&gt; 指定所属级 <br> /etc/default/useradd &nbsp;  &nbsp;  &nbsp; 相关设定 <br> /etc/login.defs &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp; UID/GID &nbsp; 有關的設定 <br> passwd &nbsp;  &nbsp;  &nbsp;  &nbsp; 更改密码 &nbsp; -----------&gt;  &nbsp; passwd &nbsp; test <br> usermod &nbsp;  &nbsp;  &nbsp; 修改用户帐号 <br> userdel &nbsp;  &nbsp;  &nbsp; 删除帐号 &nbsp; -----------&gt; userdel &nbsp; -r &nbsp; test <br> chsh &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp; 更换登陆系统时使用的SHELL &nbsp;  &nbsp;  &nbsp; [-l]显示可用的SHELL;[-s]修改自己的SHELL <br> chfn &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp; 改变finger指令显示的信息 <br> finger &nbsp;  &nbsp;  &nbsp;  &nbsp; 查找并显示用户信息 <br> id &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp; 显示用户的ID &nbsp; -----------&gt;  &nbsp;  &nbsp; id &nbsp; test <br> groupadd &nbsp;  &nbsp;  &nbsp; 添加组 <br> groupmod &nbsp;  &nbsp;  &nbsp; 与usermod类似 <br> groupdel &nbsp;  &nbsp;  &nbsp; 删除组 <br> su &nbsp; test &nbsp;  &nbsp;  &nbsp;  &nbsp; 更改用户 &nbsp;  &nbsp;  &nbsp; su &nbsp; - &nbsp;  &nbsp;  &nbsp;  &nbsp; 进入root,且使用root的环境变量 <br> sudo &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp; 以其他身份来执行指令 <br> visudo &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp; 编辑/etc/sudoers &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp; 加入一行『 &nbsp; test &nbsp; ALL=(ALL) &nbsp; ALL &nbsp; 』 <br>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; %wheel &nbsp; ALL &nbsp; = &nbsp; (ALL) &nbsp; ALL &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 系统里所有wheel群组的用户都可用sudo <br>  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp; %wheel &nbsp; ALL &nbsp; = &nbsp; (ALL) &nbsp; NOPASSWD: &nbsp; ALL &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp; wheel群组所有用户都不用密码NOPASSWD <br>  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp; User_Alias &nbsp; ADMPW &nbsp; = &nbsp; vbird, &nbsp; dmtsai, &nbsp; vbird1, &nbsp; vbird3 &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp; 加入ADMPW组 <br>  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp; ADMPW &nbsp; ALL &nbsp; = &nbsp; NOPASSWD: &nbsp; !/usr/bin/passwd, &nbsp; /usr/bin/passwd &nbsp; [A-Za-z]*, &nbsp; \ <br>  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp; !/usr/bin/passwd &nbsp; root &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp; 可以更改使用者密码,但不能更改root密码 &nbsp; (在指令前面加入 &nbsp; ! &nbsp; 代表不可) <br> PAM &nbsp; (Pluggable &nbsp; Authentication &nbsp; Modules, &nbsp; 嵌入式模組) <br> who &nbsp; &amp; &nbsp; w &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp; 看谁在线 &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  <br> last &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp; 最近登陆主机的信息 <br> lastlog &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp; 最近登入的時間 &nbsp;  &nbsp;  &nbsp;  &nbsp; 读取 &nbsp; /var/log/lastlog &nbsp;  <br> talk &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp; 与其他用户交谈 <br> write &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp; 发送信息 &nbsp;  &nbsp;  &nbsp;  &nbsp; write &nbsp; test &nbsp;  &nbsp;  &nbsp; [ctrl]+d &nbsp; 发送 <br> mesg &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp; 设置终端机的写入权限 &nbsp;  &nbsp;  &nbsp;  &nbsp; mesg &nbsp; n &nbsp; 禁止接收 &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp; mesg &nbsp; y &nbsp;  <br> wall &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp; 向所有用户发送信息 &nbsp;  &nbsp;  &nbsp;  &nbsp; wall &nbsp; this &nbsp; is &nbsp; q &nbsp; test <br> mail &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp; 写mail &nbsp;  &nbsp;  &nbsp;  <br> /etc/default/useradd &nbsp;  &nbsp;  &nbsp;  &nbsp; 家目录默认设置 <br> quota &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp; 显示磁盘已使用的空间与限制 &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp; quota &nbsp; -guvs &nbsp; -----&gt; 秀出目前 &nbsp; root &nbsp; 自己的 &nbsp; quota &nbsp; 限制值 <br>  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp; quota &nbsp; -vu &nbsp;  &nbsp;  &nbsp; 查询 <br>
quotacheck &nbsp; &nbsp; &nbsp; 检查磁盘的使用空间与限制 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; quotacheck &nbsp; -avug &nbsp; &nbsp;
-----&gt; 將所有的在 &nbsp; /etc/mtab &nbsp; 內，含有 &nbsp; quota &nbsp; 支援的 &nbsp; partition &nbsp; 進行掃瞄 <br>  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp; [-m] &nbsp; 强制扫描 &nbsp;  &nbsp;  <br>  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp; quota一定要是独立的分区,要有quota.user和quota.group两件文件,在/etc/fstab添加一句: <br>  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp; /dev/hda3 &nbsp; /home &nbsp; ext3 &nbsp; defaults,usrquota,grpquota &nbsp; 1 &nbsp; 2 <br>  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp; chmod &nbsp; 600 &nbsp; quota* &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp; 设置完成,重启生效 <br> edquota &nbsp;  &nbsp;  &nbsp;  &nbsp; 编辑用户或群组的quota &nbsp;  &nbsp; [u]用户,[g]群组,[p]复制,[t]设置宽限期限 &nbsp;  <br>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; edquota &nbsp; -a &nbsp; yang &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; edquota &nbsp; -p &nbsp;
yang &nbsp; -u &nbsp; young &nbsp; -----&gt; 复制 &nbsp; &nbsp; &nbsp; &nbsp; <br> quotaon &nbsp;  &nbsp;  &nbsp;  &nbsp; 开启磁盘空间限制 &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp; quotaon &nbsp; -auvg &nbsp; --------&gt; 啟動所有的具有 &nbsp; quota &nbsp; 的 &nbsp; filesystem <br> quotaoff &nbsp;  &nbsp;  &nbsp; 关闭磁盘空间限制 &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp; quotaoff &nbsp; -a &nbsp;  &nbsp; --------&gt; 關閉了 &nbsp; quota &nbsp; 的限制 <br> repquota &nbsp; -av &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp; 查閱系統內所有的具有 &nbsp; quota &nbsp; 的 &nbsp; filesystem &nbsp; 的限值狀態 <br> Quota &nbsp; 從開始準備 &nbsp; filesystem &nbsp; 的支援到整個設定結束的主要的步驟大概是： <br> 1、設定 &nbsp; partition &nbsp; 的 &nbsp; filesystem &nbsp; 支援 &nbsp; quota &nbsp; 參數： <br> 由於 &nbsp; quota &nbsp; 必須要讓 &nbsp; partition &nbsp; 上面的 &nbsp; filesystem &nbsp; 支援才行，一般來說， &nbsp; 支援度最好的是 &nbsp; ext2/ext3 &nbsp; ， <br> 其他的 &nbsp; filesystem &nbsp; 類型鳥哥我是沒有試過啦！ &nbsp; 啟動 &nbsp; filesystem &nbsp; 支援 &nbsp; quota &nbsp; 最簡單就是編輯 &nbsp; /etc/fstab &nbsp; ， <br> 使得準備要開放的 &nbsp; quota &nbsp; 磁碟可以支援 &nbsp; quota &nbsp; 囉； <br> 2、建立 &nbsp; quota &nbsp; 記錄檔： <br> 剛剛前面講過，整個 &nbsp; quota &nbsp; 進行磁碟限制值記錄的檔案是 &nbsp; aquota.user/aquota.group， &nbsp;  <br> 要建立這兩個檔案就必須要先利用 &nbsp; quotacheck &nbsp; 掃瞄才行喔！ <br> 3、編輯 &nbsp; quota &nbsp; 限制值資料： <br> 再來就是使用 &nbsp; edquota &nbsp; 來編輯每個使用者或群組的可使用空間囉； <br> 4、重新掃瞄與啟動 &nbsp; quota &nbsp; ： <br> 設定好 &nbsp; quota &nbsp; 之後，建議可以再進行一次 &nbsp; quotacheck &nbsp; ，然後再以 &nbsp; quotaon &nbsp; 來啟動吧！ <br>  <br> 开机流程简介 <br> 1、載入 &nbsp; BIOS &nbsp; 的硬體資訊，並取得第一個開機裝置的代號； &nbsp;  <br> 2、讀取第一個開機裝置的 &nbsp; MBR &nbsp; 的 &nbsp; boot &nbsp; Loader &nbsp; (亦即是 &nbsp; lilo, &nbsp; grub, &nbsp; spfdisk &nbsp; 等等) &nbsp; 的開機資訊； &nbsp;  <br> 3、載入 &nbsp; Kernel &nbsp; 作業系統核心資訊， &nbsp; Kernel &nbsp; 開始解壓縮，並且嘗試驅動所有硬體裝置； &nbsp;  <br> 4、Kernel &nbsp; 執行 &nbsp; init &nbsp; 程式並取得 &nbsp; run-level &nbsp; 資訊； &nbsp;  <br> 5、init &nbsp; 執行 &nbsp; /etc/rc.d/rc.sysinit &nbsp; 檔案； &nbsp;  <br> 6、啟動核心的外掛模組 &nbsp; (/etc/modprobe.conf)； &nbsp;  <br> 7、init &nbsp; 執行 &nbsp; run-level &nbsp; 的各個批次檔( &nbsp; Scripts &nbsp; )； &nbsp;  <br> 8、init &nbsp; 執行 &nbsp; /etc/rc.d/rc.local &nbsp; 檔案； &nbsp;  <br> 9、執行 &nbsp; /bin/login &nbsp; 程式，並等待使用者登入； &nbsp;  <br> 10、登入之後開始以 &nbsp; Shell &nbsp; 控管主機。 &nbsp;  <br> 在/etc/rc.d/rc3.d內,以S开头的为开机启动,以K开头的为关闭,接着的数字代表执行顺序 <br> GRUB &nbsp; vga设定 <br> 彩度\解析度 &nbsp;  &nbsp; 640x480 &nbsp;  &nbsp; 800x600 &nbsp;  &nbsp; 1024x768 &nbsp;  &nbsp; 1280x1024 &nbsp;  &nbsp;  &nbsp; bit &nbsp;  <br>
&nbsp; &nbsp; &nbsp; &nbsp; 256 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 769 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 771 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 773 &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; 775 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 8 &nbsp; bit &nbsp; <br> &nbsp; &nbsp; &nbsp; 32768 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 784 &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; 787 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 790 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 793 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 15 &nbsp; bit &nbsp; <br>
&nbsp; &nbsp; &nbsp; 65536 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 785 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 788 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 791 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; 794 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 16 &nbsp; bit &nbsp; <br> &nbsp; &nbsp; &nbsp; 16.8M &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 786 &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; 789 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 792 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 795 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 32 &nbsp; bit &nbsp; <br>  <br> ./configure &nbsp;  &nbsp;  &nbsp;  &nbsp; 检查系统信息 &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp; ./configure &nbsp; --help &nbsp; | &nbsp; more &nbsp;  &nbsp; 帮助信息 <br> make &nbsp; clean &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp; 清除之前留下的文件 <br> make &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp; 编译 <br> make &nbsp; install &nbsp;  &nbsp;  &nbsp; 安装 <br> rpm &nbsp; -q &nbsp;  &nbsp; -----&gt; 查询是否安装 &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp; rpm &nbsp; -ql &nbsp; ------&gt; 查询该套件所有的目录 <br> rpm &nbsp; -qi &nbsp; -----&gt; 查询套件的说明资料 &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp; rpm &nbsp; -qc[d] &nbsp; -----&gt; 设定档与说明档 <br> rpm &nbsp; -ivh &nbsp;  &nbsp; ----&gt; 安装 &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp; rpm &nbsp; -V &nbsp;  &nbsp; --------&gt; 查看套件有否更动过 <br> rpm &nbsp; -e &nbsp;  &nbsp; ------&gt; 删除 &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp; rpm &nbsp; -Uvh &nbsp; -------&gt; 升级安装 &nbsp;  &nbsp;  <br> --nodeps &nbsp; -----&gt; 强行安装 &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp; --test &nbsp; -----&gt; 测试安装 <br>     <img src ="http://www.cppblog.com/yehongly/aggbug/65222.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/yehongly/" target="_blank">茶</a> 2008-10-27 17:37 <a href="http://www.cppblog.com/yehongly/archive/2008/10/27/65222.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Linux指令篇:档案目录管理--locate</title><link>http://www.cppblog.com/yehongly/archive/2008/10/06/63316.html</link><dc:creator>茶</dc:creator><author>茶</author><pubDate>Mon, 06 Oct 2008 06:58:00 GMT</pubDate><guid>http://www.cppblog.com/yehongly/archive/2008/10/06/63316.html</guid><wfw:comment>http://www.cppblog.com/yehongly/comments/63316.html</wfw:comment><comments>http://www.cppblog.com/yehongly/archive/2008/10/06/63316.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/yehongly/comments/commentRss/63316.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/yehongly/services/trackbacks/63316.html</trackback:ping><description><![CDATA[http://doc.linuxpk.com/201.html<br><br>名称：locate<br><br>　　使用权限：所有使用者<br><br>　　使用方式： locate [-q] [-d ] [--database=]<br><br>　　locate [-r ] [--regexp=]<br><br>　　locate [-qv] [-o ] [--output=]<br><br>　　locate [-e ] [-f ] ] [-c]<br><br>　　locate [-Vh] [--version] [--help]<br><br>　　说明：<br><br>　　locate 让使用者可以很快速的搜寻档案系统内是否有指定的档案。其方法是先建立一个包括系统内所有档案名称及路径的数据库，之后当寻找时就只需查询这个数据库，而不必实际深入档案系统之中了。<br><br>　　在一般的 distribution 之中，数据库的建立都被放在 contab 中自动执行。一般使用者在使用时只要用<br><br>　　# locate your_file_name<br><br>　　的型式就可以了。 参数：<br><br>　　-u<br><br>　　-U<br><br>　　建立数据库，-u 会由根目录开始，-U 则可以指定开始的位置。<br><br>　　-e<br><br>　　将<br><br>　　排除在寻找的范围之外。<br><br>　　-l<br><br>　　如果  是 1．则启动安全模式。在安全模式下，使用者不会看到权限无法看到的档案。这会始速度减慢，因为 locate 必须至实际的档案系统中取得档案的权限资料。<br><br>　　-f<br><br>　　将特定的档案系统排除在外，例如我们没有到理要把 proc 档案系统中的档案放在数据库中。<br><br>　　-q<br><br>　　安静模式，不会显示任何错误讯息。<br><br>　　-n<br><br>　　至多显示  个输出。<br><br>　　-r<br><br>　　使用正规运算式  做寻找的条件。<br><br>　　-o<br><br>　　指定数据库存的名称。<br><br>　　-d<br><br>　　指定数据库的路径<br><br>　　-h<br><br>　　显示辅助讯息<br><br>　　-v<br><br>　　显示更多的讯息<br><br>　　-V<br><br>　　显示程序的版本讯息 范例：<br><br>　　locate chdrv            : 寻找所有叫 chdrv 的档案<br><br>　　locate -n 100 a.out     : 寻找所有叫  a.out 的档案，但最多只显示 100 个<br><br>　　locate -u               : 建立数据库<br><br>
locate命令可以在搜寻数据库时快速找到档案，数据库由updatedb程序来更新，updatedb是由cron
daemon周期性建立的，locate命令在搜寻数据库时比由整个由硬盘资料来搜寻资料来得快，但较差劲的是locate所找到的档案若是最近才建立或
刚更名的，可能会找不到，在内定值中，updatedb每天会跑一次，可以由修改crontab来更新设定值。(etc/crontab)<br><br>
locate指定用在搜寻符合条件的档案，它会去储存档案与目录名称的数据库内，寻找合乎范本样式条件的档案或目录录，可以使用特殊字元（如&#8221;*&#8221;或
&#8221;?&#8221;等）来指定范本样式，如指定范本为kcpa*ner,
locate会找出所有起始字串为kcpa且结尾为ner的档案或目录，如名称为kcpartner若目录录名称为kcpa_ner则会列出该目录下包括
子目录在内的所有档案。<br><br>　　locate指令和find找寻档案的功能类似，但locate是透过update程序将硬盘中的所有档案和
目录资料先建立一个索引数据库，在执行loacte时直接找该索引，查询速度会较快，索引数据库一般是由操作系统管理，但也可以直接下达update强迫
系统立即修改索引数据库。<br><br>　　不过第一次在执行update後再使用locate寻找档案常会失败，此时就要执行slocate
ˉu该命令（也可执行updatedb指令，其效果相同）来更新slocate数据库，该命令会在/usr/sbin下产生slocate执行档，再由
locate到此数据库寻找所要找的资料。<img src ="http://www.cppblog.com/yehongly/aggbug/63316.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/yehongly/" target="_blank">茶</a> 2008-10-06 14:58 <a href="http://www.cppblog.com/yehongly/archive/2008/10/06/63316.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>进程间通讯的方法 </title><link>http://www.cppblog.com/yehongly/archive/2008/07/02/55086.html</link><dc:creator>茶</dc:creator><author>茶</author><pubDate>Tue, 01 Jul 2008 16:21:00 GMT</pubDate><guid>http://www.cppblog.com/yehongly/archive/2008/07/02/55086.html</guid><wfw:comment>http://www.cppblog.com/yehongly/comments/55086.html</wfw:comment><comments>http://www.cppblog.com/yehongly/archive/2008/07/02/55086.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/yehongly/comments/commentRss/55086.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/yehongly/services/trackbacks/55086.html</trackback:ping><description><![CDATA[<span id="ArticleContent1_ArticleContent1_lblContent">进程通常被定义为一个正在运行的程序的实例，它由两个部分组成：<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 一个是操作系统用来管理进程的内核对象。内核对象也是系统用来存放关于进程的统计信息的地方<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 另一个是地址空间，它包含所有的可执行模块或DLL模块的代码和数据。它还包含动态分配的空间。如线程堆栈和堆分配空间。每个进程被赋予它自己的虚拟地址空间，当进程中的一个线程正在运行时，该线程可以访问只属于它的进程的内存。属于其它进程的内存则是隐藏的，并不能被正在运行的线程访问。<br>&nbsp;&nbsp; 为了能在两个进程之间进行通讯，由以下几种方法可供参考：
<p>0。剪贴板Clipboard: 在16位时代常使用的方式，CWnd中提供支持</p>
<p>1。窗口消息 标准的Windows消息以及专用的WM_COPYDATA消息 SENDMESSAGE()接收端必须有一个窗口</p>
<p>2。使用共享内存方式（Shared Memory)<br>&nbsp;&nbsp; a.设定一块共享内存区域&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <br>&nbsp;&nbsp;&nbsp;&nbsp; HANDLE CreateFileMapping(HANDLE,LPSECURITY_ATTRIBUTES, DWORD,&nbsp;DWORD, DWORD,&nbsp; LPCSTR) <br>&nbsp;&nbsp;&nbsp;&nbsp; 产生一个file-mapping核心对象<br>&nbsp;&nbsp;&nbsp;&nbsp; LPVOID MapViewOfFile(<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; HANDLE hFileMappingObject,<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; DWORD&nbsp; dwDesiredAcess,<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; DWORD&nbsp; dwFileOffsetHigh,<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; DWORD&nbsp; dwFileOffsetLow,<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; DWORD&nbsp; dwNumberOfBytesToMap<br>&nbsp;&nbsp;&nbsp;&nbsp; );<br>&nbsp;&nbsp;&nbsp; 得到共享内存的指针<br>&nbsp;&nbsp; b.找出共享内存<br>&nbsp;&nbsp;&nbsp; 决定这块内存要以点对点（peer to peer)的形式呈现<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 每个进程都必须有相同的能力，产生共享内存并将它初始化。每个进程<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 都应该调用CreateFileMapping(),然后调用GetLastError().如果传回的<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 错误代码是ERROR_ALREADY_EXISTS,那么进程就可以假设这一共享内存区 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 域已经被别的进程打开并初始化了，否则该进程就可以合理的认为自己 排在第&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 一位，并接下来将共享内存初始化。<br>&nbsp;&nbsp;&nbsp; 还是要使用client/server架构中<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 只有server进程才应该产生并初始化共享内存。所有的进程都应该使用</p>
<p>HANDLE OpenFileMapping(DWORD dwDesiredAccess,<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; BOOL bInheritHandle,<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; LPCTSTR lpName);<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 再调用MapViewOfFile(),取得共享内存的指针<br>&nbsp;&nbsp; c.同步处理(Mutex)<br>&nbsp;&nbsp; d.清理(Cleaning up) BOOL UnmapViewOfFile(LPCVOID lpBaseAddress);<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; CloseHandle()</p>
<p>3。动态数据交换（DDE）通过维护全局分配内存使的应用程序间传递成为可能<br>&nbsp;&nbsp; 其方式是再一块全局内存中手工放置大量的数据，然后使用窗口消息传递内存&nbsp;&nbsp;&nbsp; 指针.这是16位WIN时代使用的方式，因为在WIN32下已经没有全局和局部内存&nbsp;&nbsp;&nbsp; 了，现在的内存只有一种就是虚存。&nbsp;&nbsp; </p>
<p>4。消息管道(Message Pipe)<br>&nbsp;&nbsp; 用于设置应用程序间的一条永久通讯通道，通过该通道可以象自己的应用程序<br>&nbsp;&nbsp; 访问一个平面文件一样读写数据。<br>&nbsp;&nbsp; 匿名管道(Anonymous Pipes)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 单向流动，并且只能够在同一电脑上的各个进程之间流动。<br>&nbsp;&nbsp; 命名管道(Named Pipes)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 双向，跨网络，任何进程都可以轻易的抓住，放进管道的数据有固定的格&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 式，而使用ReadFile()只能读取该大小的倍数。<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 可以被使用于I/O Completion Ports</p>
<p>5&nbsp;&nbsp; 邮件槽(Mailslots)<br>&nbsp;&nbsp;&nbsp; 广播式通信,在32系统中提供的新方法，可以在不同主机间交换数据，在&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; WIN9X下只支持邮件槽客户</p>
<p>6。Windows套接字(Windows Socket)<br>&nbsp;&nbsp; 它具备消息管道所有的功能，但遵守一套通信标准使的不同操作系统之上的应&nbsp;&nbsp;&nbsp; 用程序之间可以互相通信。</p>
<p>7。Internet通信 它让应用程序从Internet地址上载或下载文件</p>
<p>8。RPC：远程过程调用，很少使用，因其与UNIX的RPC不兼容。</p>
<p>9。串行/并行通信(Serial/Parallel Communication)<br>&nbsp;&nbsp; 它允许应用程序通过串行或并行端口与其他的应用程序通信</p>
<p>10。COM/DCOM <br>&nbsp;&nbsp;&nbsp;&nbsp; 通过COM系统的代理存根方式进行进程间数据交换，但只能够表现在对接口&nbsp;&nbsp;&nbsp;&nbsp; 函数的调用时传送数据，通过DCOM可以在不同主机间传送数据。 <br></p>
</span><img src ="http://www.cppblog.com/yehongly/aggbug/55086.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/yehongly/" target="_blank">茶</a> 2008-07-02 00:21 <a href="http://www.cppblog.com/yehongly/archive/2008/07/02/55086.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>UNIX CP命令</title><link>http://www.cppblog.com/yehongly/archive/2008/01/02/40222.html</link><dc:creator>茶</dc:creator><author>茶</author><pubDate>Wed, 02 Jan 2008 03:56:00 GMT</pubDate><guid>http://www.cppblog.com/yehongly/archive/2008/01/02/40222.html</guid><wfw:comment>http://www.cppblog.com/yehongly/comments/40222.html</wfw:comment><comments>http://www.cppblog.com/yehongly/archive/2008/01/02/40222.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/yehongly/comments/commentRss/40222.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/yehongly/services/trackbacks/40222.html</trackback:ping><description><![CDATA[<p><a href="http://hi.baidu.com/xinghuali/blog/item/95e0d73399dd6f43ad4b5ff4.html">http://hi.baidu.com/xinghuali/blog/item/95e0d73399dd6f43ad4b5ff4.html</a><br>cp&nbsp;(复制档案或目录)&nbsp;<br>[root@linux&nbsp;~]#&nbsp;cp&nbsp;[-adfilprsu]&nbsp;来源档(source)&nbsp;目的檔(destination)<br>[root@linux&nbsp;~]#&nbsp;cp&nbsp;[options]&nbsp;source1&nbsp;source2&nbsp;source3&nbsp;....&nbsp;directory<br>参数：<br>-a&nbsp;&nbsp;：相当于&nbsp;-pdr&nbsp;的意思；<br>-d&nbsp;&nbsp;：若来源文件为连结文件的属性(link&nbsp;file)，则复制连结文件属性而非档案本身；<br>-f&nbsp;&nbsp;：为强制&nbsp;(force)&nbsp;的意思，若有重复或其它疑问时，不会询问使用者，而强制复制；<br>-i&nbsp;&nbsp;：若目的檔(destination)已经存在时，在覆盖时会先询问是否真的动作！<br>-l&nbsp;&nbsp;：进行硬式连结&nbsp;(hard&nbsp;link)&nbsp;的连结档建立，而非复制档案本身；<br>-p&nbsp;&nbsp;：连同档案的属性一起复制过去，而非使用预设属性；<br>-r&nbsp;&nbsp;：递归持续复制，用于目录的复制行为；<br>-s&nbsp;&nbsp;：复制成为符号连结文件&nbsp;(symbolic&nbsp;link)，亦即『快捷方式』档案；<br>-u&nbsp;&nbsp;：若&nbsp;destination&nbsp;比&nbsp;source&nbsp;旧才更新&nbsp;destination&nbsp;！<br>最后需要注意的，如果来源档有两个以上，则最后一个目的文件一定要是『目录』才行！<br>范例：<br>范例一：将家目录下的&nbsp;.bashrc&nbsp;复制到&nbsp;/tmp&nbsp;下，并更名为&nbsp;bashrc<br>[root@linux&nbsp;~]#&nbsp;cd&nbsp;/tmp<br>[root@linux&nbsp;tmp]#&nbsp;cp&nbsp;~/.bashrc&nbsp;bashrc<br>[root@linux&nbsp;tmp]#&nbsp;cp&nbsp;-i&nbsp;~/.bashrc&nbsp;bashrc<br>cp:&nbsp;overwrite&nbsp;`basrhc'?&nbsp;n<br>#&nbsp;重复作两次动作，由于&nbsp;/tmp&nbsp;底下已经存在&nbsp;bashrc&nbsp;了，加上&nbsp;-i&nbsp;参数，<br>#&nbsp;则在覆盖前会询问使用者是否确定！可以按下&nbsp;n&nbsp;或者&nbsp;y&nbsp;呢！<br>#&nbsp;但是，反过来说，如果不想要询问时，则加上&nbsp;-f&nbsp;这个参数来强制直接覆盖！</p>
<p>范例二：将&nbsp;/var/log/wtmp&nbsp;复制到&nbsp;/tmp&nbsp;底下<br>[root@linux&nbsp;tmp]#&nbsp;cp&nbsp;/var/log/wtmp&nbsp;.&nbsp;&lt;==想要复制到目前的目录，最后的&nbsp;.&nbsp;不要忘<br>[root@linux&nbsp;tmp]#&nbsp;ls&nbsp;-l&nbsp;/var/log/wtmp&nbsp;wtmp<br>-rw-rw-r--&nbsp;&nbsp;1&nbsp;root&nbsp;utmp&nbsp;71808&nbsp;Jul&nbsp;18&nbsp;12:46&nbsp;/var/log/wtmp<br>-rw-r--r--&nbsp;&nbsp;1&nbsp;root&nbsp;root&nbsp;71808&nbsp;Jul&nbsp;18&nbsp;21:58&nbsp;wtmp<br>#&nbsp;注意到了吗？！在不加任何参数的情况下，档案的所属者会改变，连权限也跟着改变了～<br>#&nbsp;这是个很重要的特性！要注意喔！还有，连档案建立的时间也不一样了！<br>#&nbsp;如果您想要将档案的所有特性都一起复制过来，可以加上&nbsp;-a&nbsp;喔！<br>[root@linux&nbsp;tmp]#&nbsp;cp&nbsp;-a&nbsp;/var/log/wtmp&nbsp;wtmp_2<br>[root@linux&nbsp;tmp]#&nbsp;ls&nbsp;-l&nbsp;/var/log/wtmp&nbsp;wtmp_2<br>-rw-rw-r--&nbsp;&nbsp;1&nbsp;root&nbsp;utmp&nbsp;71808&nbsp;Jul&nbsp;18&nbsp;12:46&nbsp;/var/log/wtmp<br>-rw-rw-r--&nbsp;&nbsp;1&nbsp;root&nbsp;utmp&nbsp;71808&nbsp;Jul&nbsp;18&nbsp;12:46&nbsp;wtmp_2<br>#&nbsp;瞭了吧！整个资料特性完全一模一样ㄟ！真是不赖～这就是&nbsp;-a&nbsp;的特性！</p>
<p>范例三：复制&nbsp;/etc/&nbsp;这个目录下的所有内容到&nbsp;/tmp&nbsp;底下<br>[root@linux&nbsp;tmp]#&nbsp;cp&nbsp;/etc/&nbsp;/tmp<br>cp:&nbsp;omitting&nbsp;directory&nbsp;`/etc'&nbsp;&nbsp;&nbsp;&lt;==&nbsp;如果是目录，不能直接复制，要加上&nbsp;-r&nbsp;的参数<br>[root@linux&nbsp;tmp]#&nbsp;cp&nbsp;-r&nbsp;/etc/&nbsp;/tmp<br>#&nbsp;还是要再次的强调喔！&nbsp;-r&nbsp;是可以复制目录，但是，档案与目录的权限会被改变～<br>#&nbsp;所以，也可以利用&nbsp;cp&nbsp;-a&nbsp;/etc&nbsp;/tmp&nbsp;来下达指令喔！</p>
<p>范例四：将范例一复制的&nbsp;bashrc&nbsp;建立一个连结档&nbsp;(symbolic&nbsp;link)<br>[root@linux&nbsp;tmp]#&nbsp;ls&nbsp;-l&nbsp;bashrc<br>-rw-r--r--&nbsp;&nbsp;1&nbsp;root&nbsp;root&nbsp;395&nbsp;Jul&nbsp;18&nbsp;22:08&nbsp;bashrc<br>[root@linux&nbsp;tmp]#&nbsp;cp&nbsp;-s&nbsp;bashrc&nbsp;bashrc_slink<br>[root@linux&nbsp;tmp]#&nbsp;cp&nbsp;-l&nbsp;bashrc&nbsp;bashrc_hlink<br>[root@linux&nbsp;tmp]#&nbsp;ls&nbsp;-l&nbsp;bashrc*<br>-rw-r--r--&nbsp;&nbsp;2&nbsp;root&nbsp;root&nbsp;395&nbsp;Jul&nbsp;18&nbsp;22:08&nbsp;bashrc<br>-rw-r--r--&nbsp;&nbsp;2&nbsp;root&nbsp;root&nbsp;395&nbsp;Jul&nbsp;18&nbsp;22:08&nbsp;bashrc_hlink<br>lrwxrwxrwx&nbsp;&nbsp;1&nbsp;root&nbsp;root&nbsp;&nbsp;&nbsp;6&nbsp;Jul&nbsp;18&nbsp;22:31&nbsp;bashrc_slink&nbsp;-&gt;&nbsp;bashrc<br>#&nbsp;那个&nbsp;bashrc_slink&nbsp;是由&nbsp;-s&nbsp;的参数造成的，建立的是一个『快捷方式』，<br>#&nbsp;所以您会看到在档案的最右边，会显示这个档案是『连结』到哪里去的！<br>#&nbsp;至于那个&nbsp;bashrc_hlink&nbsp;有趣了！建立了这个档案之后，&nbsp;bashrc&nbsp;与&nbsp;bashrc_hlink&nbsp;<br>#&nbsp;所有的参数都一样，只是，第二栏的&nbsp;link&nbsp;数改变成为&nbsp;2&nbsp;了～而不是原本的&nbsp;1&nbsp;喔！<br>#&nbsp;这两种连结的方式的异同，我们会在下一章里面进行介绍的！</p>
<p>范例五：若&nbsp;~/.bashrc&nbsp;比&nbsp;/tmp/bashrc&nbsp;新才复制过来<br>[root@linux&nbsp;tmp]#&nbsp;cp&nbsp;-u&nbsp;~/.bashrc&nbsp;/tmp/bashrc<br>#&nbsp;这个&nbsp;-u&nbsp;的特性，是在目标档案与来源档案有差异时，才会复制的。<br>#&nbsp;所以，比较常被用于『备份』的工作当中喔！&nbsp;^_^</p>
<p>范例六：将范例四造成的&nbsp;bashrc_slink&nbsp;复制成为&nbsp;bashrc_slink_2<br>[root@linux&nbsp;tmp]#&nbsp;cp&nbsp;bashrc_slink&nbsp;bashrc_slink_2<br>[root@linux&nbsp;tmp]#&nbsp;ls&nbsp;-l&nbsp;bashrc_slink*<br>lrwxrwxrwx&nbsp;&nbsp;1&nbsp;root&nbsp;root&nbsp;&nbsp;&nbsp;6&nbsp;Jul&nbsp;18&nbsp;22:31&nbsp;bashrc_slink&nbsp;-&gt;&nbsp;bashrc<br>-rw-r--r--&nbsp;&nbsp;1&nbsp;root&nbsp;root&nbsp;395&nbsp;Jul&nbsp;18&nbsp;22:48&nbsp;bashrc_slink_2<br>#&nbsp;这个例子也是很有趣喔！原本复制的是连结档，但是却将连结档的实际档案复制过来了<br>#&nbsp;也就是说，如果没有加上任何参数时，复制的是源文件，而非连结文件的属性！<br>#&nbsp;若要复制连结文件的属性，就得要使用&nbsp;-d&nbsp;或者&nbsp;-a&nbsp;的参数了！</p>
<p>范例七：将家目录的&nbsp;.bashrc&nbsp;及&nbsp;.bash_history&nbsp;复制到&nbsp;/tmp&nbsp;底下<br>[root@linux&nbsp;tmp]#&nbsp;cp&nbsp;~/.bashrc&nbsp;~/.bash_history&nbsp;/tmp<br>#&nbsp;可以将多个数据一次复制到同一个目录去！<br>这个&nbsp;cp&nbsp;的功能很多，而由于我们常常在进行一些数据的复制，所以也会常常用到这个指令的。&nbsp;一般来说，我们如果去复制别人的数据&nbsp;(当然，该档案您必须要有&nbsp;read&nbsp;的权限才行啊！&nbsp;^_^)&nbsp;时，&nbsp;总是希望复制到的数据最后是我们自己的，所以，在预设的条件中，&nbsp;cp&nbsp;的来源档与目的档的权限是不同的，目的档的拥有者通常会是指令操作者本身。举例来说，&nbsp;上面的范例二中，由于我是&nbsp;root&nbsp;的身份，因此复制过来的档案拥有者与群组就改变成为&nbsp;root&nbsp;所有了！&nbsp;这样说，可以明白吗？！&nbsp;^_^</p>
<p>由于具有这个特性，因此，当我们在进行备份的时候，某些需要特别注意的特殊权限档案，&nbsp;例如密码文件&nbsp;(/etc/shadow)&nbsp;以及一些设定档，就不能直接以&nbsp;cp&nbsp;来复制，而必须要加上&nbsp;-a&nbsp;或者是&nbsp;-p&nbsp;等等可以完整复制档案权限的参数才行！另外，如果您想要复制档案给其它的使用者，&nbsp;也必须要注意到档案的权限(包含读、写、执行以及档案拥有者等等)，&nbsp;否则，其它人还是无法针对您给予的档案进行修订的动作喔！注意注意！</p>
<p>至于上面的范例当中，第四个范例是最有趣的，使用&nbsp;-l&nbsp;及&nbsp;-s&nbsp;都会建立所谓的连结档&nbsp;(link&nbsp;file)，&nbsp;但是这两种连结档确有不一样的展现情况。这是怎么一回事啊？&nbsp;那个&nbsp;-l&nbsp;就是所谓的&nbsp;hard&nbsp;link&nbsp;，至于&nbsp;-s&nbsp;则是&nbsp;symbolic&nbsp;link&nbsp;，鸟哥这里先不介绍，&nbsp;因为这个涉及&nbsp;i-node&nbsp;的相关知识，我们还没有介绍到，下一章再来讨论这个&nbsp;link&nbsp;的问题喔！&nbsp;总之，由于&nbsp;cp&nbsp;有种种的档案属性与权限的特性，所以，在复制时，您必须要清楚的了解到：&nbsp;<br>&#8226;&nbsp;是否需要完整的保留来源档案的信息？&nbsp;<br>&#8226;&nbsp;来源档案是否为连结档&nbsp;(symbolic&nbsp;link&nbsp;file)？&nbsp;<br>&#8226;&nbsp;来源档是否为特殊的档案，例如&nbsp;FIFO,&nbsp;socket&nbsp;等？&nbsp;<br>&#8226;&nbsp;来源文件是否为目录？</p><img src ="http://www.cppblog.com/yehongly/aggbug/40222.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/yehongly/" target="_blank">茶</a> 2008-01-02 11:56 <a href="http://www.cppblog.com/yehongly/archive/2008/01/02/40222.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item></channel></rss>