zoukankan      html  css  js  c++  java
  • Linux2.1系统目录结构、ls、文件类型、alias

    系统目录结构

    ls命令

    1.inode

    [root@chy001 ~]# ls -l
    总用量 4
    -rw-------. 1 root root 812 10月 17 06:21 anaconda-ks.cfg
    #数字1 表示有多少文件使用了相同的inode,inode会指向文件块所在的位置,如果两个inode相同,
    #则说明两个文件指向相同的文件块。也说明两个文件是一个文件,只不过名字和位置不同
    [root@chy001 ~]# ls -i anaconda-ks.cfg
    67421953 anaconda-ks.cfg
    [root@chy001 ~]# ls -ld /root
    dr-xr-x---. 3 root root 4096 10月 19 03:52 /root  #inode号为3,下面为三个文件
    [root@chy001 ~]# ls -i /root
    67421953 anaconda-ks.cfg
    [root@chy001 ~]# ls -i .
    67421953 anaconda-ks.cfg
    [root@chy001 ~]# ls -i .ssh/..
    67421953 anaconda-ks.cfg
    

    2.ls常用选项

    ls   -l 列出详细的信息
         -h 自动变化单位,常与-l选项合用
         -i  列出文件inode号
         -a 列出所有文件,包括隐藏
         -t 按文件的最后更改时间顺序
         -d 针对目录,只列出目录本身
         不加d,会列出目录里面的文件
    

    文件类型

    alias

      

    [root@chy001 /]# alias chy='ls -lah'
    [root@chy001 /]# chy
    总用量 40K
    drwxr-xr-x.  17 root root 4.0K 10月 21 05:28 .
    drwxr-xr-x.  17 root root 4.0K 10月 21 05:28 ..
    lrwxrwxrwx.   1 root root    7 10月 17 06:15 bin -> usr/bin
    dr-xr-xr-x.   4 root root 4.0K 10月 17 06:44 boot
    drwxr-xr-x.  19 root root 3.1K 10月 21 05:28 dev
    [root@chy001 /]# which chy
    alias chy='ls -lah'
            /usr/bin/ls
    [root@chy001 /]# unalias chy
    [root@chy001 /]# chy
    -bash: chy: 未找到命令

    如果命令文件在这些文件里面,直接运行命令就可以生效,如果没在执行目录下,则不会生效;which就是查看这几个目录

    [root@chy001 /]# echo $PATH
    /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/root/bin
  • 相关阅读:
    23种设计模式(12):策略模式
    23种设计模式(11):责任链模式
    23种设计模式(10):命令模式
    23种设计模式(9):访问者模式
    23种设计模式(8):观察者模式
    23种设计模式(7):中介者模式
    23种设计模式(6):模版方法模式
    创建型模式总结
    23种设计模式(5):原型模式
    leetcode6
  • 原文地址:https://www.cnblogs.com/chyuanliu/p/7702430.html
Copyright © 2011-2022 走看看