Chinaunix首页 | 论坛 | 博客
  • 博客访问: 75365
  • 博文数量: 41
  • 博客积分: 0
  • 博客等级: 民兵
  • 技术积分: 434
  • 用 户 组: 普通用户
  • 注册时间: 2017-03-23 09:31
个人简介

天行健,君子以自强不息;地势坤,君子以厚德载物

文章分类
文章存档

2018年(11)

2017年(30)

我的朋友

分类: LINUX

2017-03-24 10:50:37

ls命令:
      -l:长格式
例:[root@localhost ~]# ls -l
总计 64
-rw------- 1 root root  1101 03-10 23:01 anaconda-ks.cfg
drwxr-xr-x 2 root root  4096 03-10 23:06 Desktop
-rw-r--r-- 1 root root 28240 03-10 23:00 install.log
-rw-r--r-- 1 root root  3672 03-10 22:59 install.log.syslog
-rw-r--r-- 1 root root    15 03-22 22:30 sort.test

          文件类型:
               -:普通文件(f)
                 例:
               d:目录文件
               b:块设备文件(block)
               c:字符设备文件(character)
               l:符号链接文件(symbolic link file)
               p:命令管道文件(pipe)
               s:套接字文件(socket)
          文件权限:9位,每3位一组,每一组:rwx(读、写、执行),r--
          文件硬件链接的次数
          文件属主(owner)
          文件属组(group)
          文件大小(size),单位是字节
          时间戳(timestamp),最近一次被修改的时间
                访问:access
                修改:modify,文件内容发生了改变
                改变:change,metadata,元数据
          例:[root@localhost ~]# ls -l
              总计 64
               -rw------- 1 root root  1101 03-10 23:01 anaconda-ks.cfg
               drwxr-xr-x 2 root root  4096 03-10 23:06 Desktop
               -rw-r--r-- 1 root root 28240 03-10 23:00 install.log
               -rw-r--r-- 1 root root  3672 03-10 22:59 install.log.syslog
               -rw-r--r-- 1 root root    15 03-22 22:30 sort.test
    -h:做单位转换
        例: [root@localhost ~]# ls -lh
             总计 64K
             -rw------- 1 root root 1.1K 03-10 23:01 anaconda-ks.cfg
             drwxr-xr-x 2 root root 4.0K 03-10 23:06 Desktop
             -rw-r--r-- 1 root root  28K 03-10 23:00 install.log
             -rw-r--r-- 1 root root 3.6K 03-10 22:59 install.log.syslog
             -rw-r--r-- 1 root root   15 03-22 22:30 sort.test
    -a:显示所有文件包含隐藏文件及.和..文件
       .表示当前目录
       ..表示父目录
       例:[root@localhost ~]# ls -a
            .                .bashrc   .gconf           .gtkrc-1.2-gnome2   .redhat    .Xauthority
            ..               .chewing  .gconfd          .ICEauthority       .scim      .xsession-errors
            anaconda-ks.cfg  .cshrc    .gnome           install.log         sort.test
            .bash_history    Desktop   .gnome2          install.log.syslog  .tcshrc
            .bash_logout     .dmrc     .gnome2_private  .metacity           .Trash
            .bash_profile    .eggcups  .gstreamer-0.10  .nautilus           .viminfo

    -A:显示所有文件包含隐藏文件,但不包含“.和..文件”
        例:[root@localhost ~]# ls -A
            anaconda-ks.cfg  .chewing  .gconf           .gstreamer-0.10     .metacity  .tcshrc
            .bash_history    .cshrc    .gconfd          .gtkrc-1.2-gnome2   .nautilus  .Trash
            .bash_logout     Desktop   .gnome           .ICEauthority       .redhat    .viminfo
            .bash_profile    .dmrc     .gnome2          install.log         .scim      .Xauthority
            .bashrc          .eggcups  .gnome2_private  install.log.syslog  sort.test  .xsession-errors

    -d:显示目录自身属性
       例:[root@localhost ~]# ls -ld /root
           drwxr-x--- 16 root root 4096 03-24 09:53 /root
    -i:inode(index node)文件索引节点号
        例:root@localhost ~]# ls -i
            643519 anaconda-ks.cfg  383618 install.log         384231 sort.test
            672018 Desktop          383619 install.log.syslog
    -r:逆序显示文件
       例:[root@localhost ~]# ls -r
            sort.test  install.log.syslog  install.log  Desktop  anaconda-ks.cfg

    -R:递归(recursive)显示
       例:[root@localhost ~]# ls -R
            .:
            anaconda-ks.cfg  Desktop  install.log  install.log.syslog  sort.test
            ./Desktop:
阅读(741) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~