苏州科技大学·最佳珍藏版Linux课件·No.4使用Linux基本命令.pptVIP

  • 1
  • 0
  • 约1.21万字
  • 约 40页
  • 2018-08-17 发布于江苏
  • 举报

苏州科技大学·最佳珍藏版Linux课件·No.4使用Linux基本命令.ppt

苏州科技大学·最佳珍藏版Linux课件·No.4使用Linux基本命令

文件和目录权限 $chown [option] [owner]:[group] file $chown peter.peter hello4.txt $chown peter:peter hello4.txt $chown –R (递归处理所有的文件及子目录) $chown –v (处理文件的显示信息) $chown –-help (显示本命令的帮助) $chown –Rv root newdir 文件和目录权限 $chgrp root hello.txt $chmod [who] [+-=] [mode] file (修改目录权限) $chmod u=rw,g=r,o= hello.txt $chmod 640 hello.txt $chmod –Rv 777 newdir Linux的文件操作 $umask nnn设定创建文件时的默认权限 取消nnn的权限,nnn[000~777] $umask 157 //设定umask的值 $umask //显示umask设定值 $umask –S u=w,g=w,o=w 符号表达式 $ls test1.txt $ll 创建非目录文件时,用666减umask值(目录文件用777减),结果就是权限值。 花絮 SUID/SGID概述   有时,没有被授权的用户需要完成某项任务。一个例子是passwd程序,它允许用户改变口令,这就要求改变/etc/passwd文件的口令域。然而系统管理员决不允许普通用户拥有直接改变这个文件的权利,因为这绝对不是一个好主意。   为了解决这个问题,SUID/SGID便应运而生。UNIX允许程序被授权,当程序被执行的时候,拥有超级用户的权限,完成时又回到普通用户的权限。这个主意很好,所以ATT对它申请了专利。 Linux的文件操作 $diff [option] file1 file2 查找比较两文件不同之处 $diff hello.txt hello2.txt $sort (排序命令,将文件内容按字典顺序排序) $sort hello4.txt $touch hello.txt Linux的文件操作 $find 起始目录 寻找条件 操作 $find /home –name ‘hello4.txt’ 在/home目录查找hello4.txt文件 $find /etc –name ‘h*’ –a –name ‘*.conf’ 在/etc目录中查找以h开头以.conf结尾的文件 $slocate hello.txt $locate hello.txt $slocate -u Linux的文件操作 $grep [选项] [查找模式] [文件列表] $grep conf *.* 在当前目录的所有文件中查找带有“conf”字符的文件 $grep root /etc/passwd $grep –c conf hello4.txt ls.txt 在文件中查找love的匹配次数 $grep -F * /etc/profile 如果你想在一个文件或者输出中找到包含星号字符的行,使用 grep -F RPM包文档 例: #cd /usr/share/doc/grub-093 #less README HOWTO和FAQ 查看系统中的进程 语法:ps [-aux] 例如: ps或ps -x 查看系统中,属于自己的进程。 ps -au 查看系统中,所有用户的进程。 ps -aux 查看系统中,包含系统内部的及所有用户的进程。 小结 重点:chmod chown umask Shell工作原理 掌握所有命令用法,掌握重要的参数 who、ps、、date、cal、echo、whoami、ls、pwd、cat、wc、bc、su 、 more 、less 、 、 、| 、 、 、diff 、rm 、mv 、ln 、chmod 、chown 、umask 、grep 、find 、slocate 、locate 、touch、mkdir、rmdir * dd (is convert转变 and copy a file) if= (read from file instead代替 of stdin) of =(write to file instead of stdin) bs=(强制写字节数 Bytes) count =(copy online BLOCKS input blocks,替代所有从前到文件结束的扇区) mkbootdisk --device /dev/fd0 `uname -r`   参数说明:--device /dev/fd0是要建立启动软盘,也是默认选项,因此也可以省略它;接下来的参数是内核版本号,如2.2.16等,这里

文档评论(0)

1亿VIP精品文档

相关文档