zoukankan      html  css  js  c++  java
  • 档案 & 权限管理

    1. owner, group, others

       root 是万能的天神

    image

    权限 连结档 owner group 容量 修改日期 档名

    2. chown, chgrp, chmod

       chgrp –R root abc/

       chown –R abc:abc abc/

       chown –R    .abc abc/

       chmod –R 777 abc.txt

       chmod u=rwe, go=rx abc.txt

       chmod a+x abc.txt chmod a-x abc.txt chmod a+x abc/  ( a 就是 all )

    3. cp pwd mkdir rmdir

       mkdir –m 配置目录权限, 不考虑 umask, 例如 mkdir –m 711 abc/

       mkdir –p 递归, 例如 mkdir –p test1/test2/test3/test4

       rmdir –p 递归, rmdir –p test1/test2/test3/test4 ( 文件夹必须是空的 )

       cp –a 相当于 pdr, 就是档案完全一模一样复制 ( –r 为递归复制 )

       rm –f –i –r ( 强制 提示 递归 )

       mv –f –i –u 源文件, 目的地 ( –f 强制 –i 提示 –u 只有源文件比目的地新才覆盖 )

    4. basename, dirname

       basename: /var/tmp/aaa.txt ( 此处为 aaa.txt )

       dirname:  /var/tmp/aaa.txt ( 此处为 /var/tmp )

    5. touch

       可以建立空档案, 修改档案时间

       modification time ( mtime 默认显示时间)

       status time ( ctime 权限等被修改的时间 )

       access time ( atime 读取时间 )

       touch –d “2 days ago” ( 只改变 atime, mtime, 没有改变ctime)

       touch –t 1305011315 xax ( 改变 atime, mtime 到 13年5月1日13点15分 )

       touch –a –t 1305011315 xax ( 只改变 atime 时间 )

       没有办法修改档案的 ctime, 只能是改变档案的权限, 才可以修改, 即便是档案的权限与之前相同, 但是只要修改了, 就会有变化

    6. head tail

       head –10 xax

       tail –10 xax

    7. file 查询档案是什么, 例如 ASCII 档案

    8. type 查询命令类型    例如 type ls

    9. which, whereis 查询命令位置

       image

    10. find

       find [path][option][action]

       -print 标准输出

       -exec command {} ;  --查找到文件执行command操作,{}和; 之间有空格

       -ok 和 –exec 相同, 只是每次执行命令的时候会提示给用户, 是否执行

       find 后边可以接很多目录, 例如 find etc home apps

       -depth 查找本level 目录后再进入子目录

       例子如下

       find . –name xax | xargs rm –rf

       find ~ –name “*.txt” –print   # 支持正则表达式

       find . –perm 755 –print

       find . –perm 770 –exec ls –l {} ;

       find . –type d –print

       find . –size +1000000c –print  # 查询大于 1M 的文件

       find . –size 1000000c –print   # 查询等于 1M 的文件

       find /etc –name “passwd*” –exec grep “admin” {} ;   # 查找看看有没有 admin这个用户

       find –mtime n ( n是n天以内, 过去<-+4,4,-4->现在 )

       参数:

       -name

       -perm

       -user

       -group

       -mtime

       -atime

       -ctime

       -nogroup

       -nouser

       -newer

       -type b/d/c/p/l/f

       -size

       -depth

       -mount ( 查文件时不跨过 mount 点 )

       -prune # 忽略某个目录

  • 相关阅读:
    Fundamentals of Garbage Collection
    CLR的八大特性
    Navigation and Pathfinding
    Work-Stealing in .NET 4.0
    Graphics.Blit
    整数的可除性
    关于强度
    重心坐标空间
    性能测试中TPS和并发用户数
    LoadRunner 12.02 安装以及汉化教程
  • 原文地址:https://www.cnblogs.com/moveofgod/p/3167151.html
Copyright © 2011-2022 走看看