zoukankan      html  css  js  c++  java
  • ls 命令

    [root@localhost ~]# ls           # 列出当前目录下所有的文件
    [root@localhost ~]# ls /tmp      # 列出指定目录下所有的文件
    [root@localhost ~]# ls -a        # -a 查看所有的文件,包括隐藏文件,以.开头的文件
    [root@localhost ~]# ls -l        # -l 用于以长格式列出文件,也可以写成ll
    
    ls  -l  filename = ll  查看一个文件的类型
    [root@localhost ~]# ls -l
    总用量 20
    -rw-r--r--.          1         root     root    1712       6月 2 23:23    1.txt
    -rw-------.          1         root     root     899       6月 2 23:04    anaconda-ks.cfg
    -rw-r--r--.          1         root     root    7995       6月 2 23:04    install.log
    -rw-r--r--.          1         root     root    3384       6月 2 23:02    install.log.syslog
    文件类型、文件权限  文件硬链接数  文件属主  文件属组  文件大小   文件创建/修改时间     文件名

    ll -h 人性化显示

    打印文件大小,以人类可读格式显示文件大小

    [root@mysql opt]# ll
    total 31444
    drwxr-xr-x. 35 7161 31415     4096 Oct  7  2018 mysql-5.6.36
    -rw-r--r--.  1 root root  32192348 Mar 18  2017 mysql-5.6.36.tar.gz
    
    
    [root@mysql opt]# ll -h
    total 31M
    drwxr-xr-x. 35 7161 31415 4.0K Oct  7  2018 mysql-5.6.36
    -rw-r--r--.  1 root root   31M Mar 18  2017 mysql-5.6.36.tar.gz

    ls -i 查看inode节点

    ll -i

    [root@MongoDB ~]# ll -i
    total 4
     8411620 -rw-------. 1 root root 1851 Mar 27 08:38 anaconda-ks.cfg
     8411627 drwxr-xr-x  2 root root    6 May 18 07:54 dir1
    12590293 drwxr-xr-x  2 root root    6 May 18 07:54 dir2
        3287 drwxr-xr-x  2 root root    6 May 18 07:54 dir3
     4218410 drwxr-xr-x  2 root root    6 May 18 07:54 dir4

    . ls  -  d

        功能:将目录象文件一样显示,而不是显示其下的文件;只显示当前文件夹

         语法: # ls  - d 

                    # ls -  ld(显示当前文件夹详细信息)

    [root@localhost ~]# ls -d
    .
    [root@localhost ~]# ls -ld
    dr-xr-x---. 14 root root 4096 5月 10 21:49 .
    -r:以文件名反序排列并输出目录内容列表;
    -t:用文件和目录的更改时间排序;

    列出目前工作目录下所有名称是a 开头的文件,愈新的排愈后面,可以使用如下命令:ls -tr a*


    列出当前目录下的所有文件(包括隐藏文件)的绝对路径, 对目录不做递归:find $PWD -maxdepth 1|xargs ls -ld

  • 相关阅读:
    java之获取变量的类型
    java中的++和--
    java(三)基础类型之间的转换
    golang数据结构之总结
    golang数据结构之树的三种遍历方式
    golang数据结构之散哈希表(Hash)
    golang数据结构之递归解决迷宫问题
    golang数据结构之利用栈求计算表达式(加减乘除)
    golang数据结构之栈
    golang数据结构之快速排序
  • 原文地址:https://www.cnblogs.com/mingerlcm/p/8023276.html
Copyright © 2011-2022 走看看