linux_ll命令

  • linux_ll命令已关闭评论
  • 204 次浏览
  • A+
所属分类:linux技术
摘要

如下是对每一列的参数的解释第一列为文件类型普通文件类型最常使用的一类文件,其特点是不包含有文件系统信息的结构信息。通常用户所接触到的文件,比如图形文件、数据文件、文档文件以及声音文件都属于这种文件,这种类型的文件是按照其内部结构又可分为纯文本文件(ASCII)、二进制文件(binary)、数据格式的文件(data)、各种压缩文件。


ll命令

ll命令显示的参数

linux_ll命令

如下是对每一列的参数的解释

  1. 第一列为文件类型

    linux_ll命令

    参数符号 类型
    "-" 普通文件
    "d" 是个目录文件
    "l" 链接文件
    "p" 管道文件
    "b" 设备文件
    "c" 字符设备文件
    "s" 套接字文件
    • 普通文件类型

      最常使用的一类文件,其特点是不包含有文件系统信息的结构信息。通常用户所接触到的文件,比如图形文件、数据文件、文档文件以及声音文件都属于这种文件,这种类型的文件是按照其内部结构又可分为纯文本文件(ASCII)、二进制文件(binary)、数据格式的文件(data)、各种压缩文件。

      • 纯文本文件(ASCII):这是Unix系统中最多的一种文件类型,之所以称为纯文本文件,是因为内容可以直接读到的数据,例如数字、字母等等。设 置文件几乎都属于这种文件类型。举例来说,使用命令“cat ~/.bashrc”就可以看到该文件的内容(cat是将文件内容读出来)。
      • 二进制文件(binary):系统其实仅认识且可以执行二进制文件(binary file)。Linux中的可执行文件(脚本,文本方式的批处理文件不算)就是这种格式的。举例来说,命令cat就是一个二进制文件。
      • 数据格式的文件(data):有些程序在运行过程中,会读取某些特定格式的文件,那些特定格式的文件可以称为数据文件(data file)。举例来说,Linux在用户登入时,都会将登录数据记录在 /var/log/wtmp文件内,该文件是一个数据文件,它能通过last命令读出来。但使用cat时,会读出乱码。因为它是属于一种特殊格式的文件。
    • 目录文件类型

      用于存放文件名以及其相关信息的文件,是内核组织文件系统的基本节点。目录文件可以包含下一级文件目录或者普通文件,在Linux中,目录文件是一种文件。

      能用 # cd 命令进入的。

    • 块设备文件类型

      块设备文件 : 就是存储数据以供系统存取的接口设备,简单而言就是硬盘。例如一号硬盘的代码是 /dev/hda1等文件。

    • 字符设备类型

      字符设备文件:即串行端口的接口设备,例如键盘、鼠标等等。

    • 套接字文件类型

      这类文件通常用在网络数据连接。可以启动一个程序来监听客户端的要求,客户端就可以通过套接字来进行数据通信。

    • 管道文件类型

      是一种很特殊的文件,主要用于不同进程的信息传递。当两个进程需要进行数据或者信息传递时,可以使用通道文件,一个进程将需要传递的数据或者信息写入管道的一端,另一进程从管道的另一端取得所需要的数据或者信息,通常管道是建立在调整缓存中。

    • 链接文件类型

      是一种特殊文件,指向一个真实存在的文件链接,类似于Windows下的快捷方式,链接文件的不同,又可分为硬链接文件和符号链接文件。

    1. 文件属性

      linux_ll命令

      gss目录的文件属性是[rwx][r-x][r-x]分成三段

      第一段表示文件创建者/所有者对该文件所具有的权限,  第二段表示创建者/所有者所在的组的其他用户所具有的权限,  第三段表示其他组的其他用户所具有的权限。 
      r(Read,读取权限):对文件而言,具有读取文件内容的权限;对目录来说,具有浏览目录的权限。 w(Write,写入权限):对文件而言,具有新增、修改文件内容的权限;对目录来说,具有删除、移动目录内文件的权限。 x(eXecute,执行权限):对文件而言,具有执行文件的权限;对目录来说,该用户具有进入目录的权限。 

      另外,这里还有2个很特殊的属性,平时不怎么常见,这里也顺带解释一下:

      s或S(SUID,Set UID):可执行的文件搭配这个权限,便能得到特权,任意存取该文件的所有者能使用的全部系统资源。请注意具备SUID权限的文件,黑客经常利用这种权限,以SUID配上root帐号拥有者,无声无息地在系统中开扇后门,供日后进出使用。
      t或T(Sticky):/tmp和 /var/tmp目录供所有用户暂时存取文件,亦即每位用户皆拥有完整的权限进入该目录,去浏览、删除和移动文件。
      综合起来可得,对于back_init文件,其创建者/所有者具有可读可写可执行的权限,其创建者/所有者所在的组的其他用户具有可读可写可执行的权限,其他组的其他用户则具有可读可执行但不可写的权限。

    2. 目录或者链接个数

      linux_ll命令

      对于目录文件,表示它的第一级子目录的个数。注意此处看到的值要减2才等于该目录下的子目录的实际个数。

      比如这里的etc目录下,其实是没有子目录的,所以应该是0,但是它这里却显示2,这是因为要加上.目录和..目录。在linux下,.目录表示当前目录,..目录表示上一级目录。

      linux_ll命令

      对于其他文件,表示指向它的链接文件的个数。

    3. 所有者及组

      linux_ll命令

      表示该文件的所有者/创建者(owner)及其所在的组(group)。

      查看组的方法:

      1. 查看用户:cat /etc/passwd

        查看组:cat /etc/group

      2. 使用命令行groups 用户名,,可以查看当前用户所在组,以及组内其他成员的信息

        linux_ll命令

    4. 文件大小

      linux_ll命令

      如果是文件,则表示该文件的大小,单位为字节。
      如果是目录,则表示该目录符所占的大小,并不表示该目录下所有文件的大小。

      查看文件大小的命令

      1. du -sh
      2. df -h(查看磁盘上的容量大小)
      3. ls -lht

      linux_ll命令

    5. 最后修改日期

      linux_ll命令

参数

[root@localhost Honeypot-deploy-steps]# ll --help Usage: ls [OPTION]... [FILE]... List information about the FILEs (the current directory by default). Sort entries alphabetically if none of -cftuvSUX nor --sort is specified.  Mandatory arguments to long options are mandatory for short options too.   -a, --all                  do not ignore entries starting with .                -A, --almost-all           do not list implied . and ..                             --author               with -l, print the author of each file              -b, --escape               print C-style escapes for nongraphic characters         --block-size=SIZE      scale sizes by SIZE before printing them; e.g.,                                  '--block-size=M' prints sizes in units of                                1,048,576 bytes; see SIZE format below   -B, --ignore-backups       do not list implied entries ending with ~   -c                         with -lt: sort by, and show, ctime (time of last                                modification of file status information);                                with -l: show ctime and sort by name;                                otherwise: sort by ctime, newest first   -C                         list entries by columns       --color[=WHEN]         colorize the output; WHEN can be 'never', 'auto',                                or 'always' (the default); more info below   -d, --directory            list directories themselves, not their contents   -D, --dired                generate output designed for Emacs' dired mode   -f                         do not sort, enable -aU, disable -ls --color   -F, --classify             append indicator (one of */=>@|) to entries       --file-type            likewise, except do not append '*'       --format=WORD          across -x, commas -m, horizontal -x, long -l,                                single-column -1, verbose -l, vertical -C       --full-time            like -l --time-style=full-iso   -g                         like -l, but do not list owner       --group-directories-first                              group directories before files;                                can be augmented with a --sort option, but any                                use of --sort=none (-U) disables grouping   -G, --no-group             in a long listing, don't print group names   -h, --human-readable       with -l, print sizes in human readable format                                (e.g., 1K 234M 2G)       --si                   likewise, but use powers of 1000 not 1024   -H, --dereference-command-line                              follow symbolic links listed on the command line       --dereference-command-line-symlink-to-dir                              follow each command line symbolic link                                that points to a directory       --hide=PATTERN         do not list implied entries matching shell PATTERN                                (overridden by -a or -A)       --indicator-style=WORD  append indicator with style WORD to entry names:                                none (default), slash (-p),                                file-type (--file-type), classify (-F)   -i, --inode                print the index number of each file   -I, --ignore=PATTERN       do not list implied entries matching shell PATTERN   -k, --kibibytes            default to 1024-byte blocks for disk usage   -l                         use a long listing format   -L, --dereference          when showing file information for a symbolic                                link, show information for the file the link                                references rather than for the link itself   -m                         fill width with a comma separated list of entries   -n, --numeric-uid-gid      like -l, but list numeric user and group IDs   -N, --literal              print raw entry names (don't treat e.g. control                                characters specially)   -o                         like -l, but do not list group information   -p, --indicator-style=slash                              append / indicator to directories   -q, --hide-control-chars   print ? instead of nongraphic characters       --show-control-chars   show nongraphic characters as-is (the default,                                unless program is 'ls' and output is a terminal)   -Q, --quote-name           enclose entry names in double quotes       --quoting-style=WORD   use quoting style WORD for entry names:                                literal, locale, shell, shell-always, c, escape   -r, --reverse              reverse order while sorting   -R, --recursive            list subdirectories recursively   -s, --size                 print the allocated size of each file, in blocks   -S                         sort by file size       --sort=WORD            sort by WORD instead of name: none (-U), size (-S),                                time (-t), version (-v), extension (-X)       --time=WORD            with -l, show time as WORD instead of default                                modification time: atime or access or use (-u)                                ctime or status (-c); also use specified time                                as sort key if --sort=time       --time-style=STYLE     with -l, show times using style STYLE:                                full-iso, long-iso, iso, locale, or +FORMAT;                                FORMAT is interpreted like in 'date'; if FORMAT                                is FORMAT1<newline>FORMAT2, then FORMAT1 applies                                to non-recent files and FORMAT2 to recent files;                                if STYLE is prefixed with 'posix-', STYLE                                takes effect only outside the POSIX locale   -t                         sort by modification time, newest first   -T, --tabsize=COLS         assume tab stops at each COLS instead of 8   -u                         with -lt: sort by, and show, access time;                                with -l: show access time and sort by name;                                otherwise: sort by access time   -U                         do not sort; list entries in directory order   -v                         natural sort of (version) numbers within text   -w, --width=COLS           assume screen width instead of current value   -x                         list entries by lines instead of by columns   -X                         sort alphabetically by entry extension   -1                         list one file per line  SELinux options:    --lcontext                 Display security context.   Enable -l. Lines                              will probably be too wide for most displays.   -Z, --context              Display security context so it fits on most                              displays.  Displays only mode, user, group,                              security context and file name.   --scontext                 Display only security context and file name.       --help     display this help and exit       --version  output version information and exit 
 -a, --all                     不隐藏任何以. 开始的项目   -A, --almost-all              列出除. 及.. 以外的任何项目       --author                  与-l 同时使用时列出每个文件的作者   -b, --escape                  以八进制溢出序列表示不可打印的字符       --block-size=大小         块以指定大小的字节为单位   -B, --ignore-backups          不列出任何以"~"字符结束的项目   -c                            配合-lt:根据ctime 排序并显示ctime(文件                                 状态最后更改的时间)                                 配合-l:显示ctime 但根据名称排序                                其他情况:按ctime 排序   -C                            每栏由上至下列出项目       --color[=WHEN]            控制是否使用色彩分辨文件。WHEN 可以是                                 "never"(默认)、"always"或"auto"其中之一   -d, --directory               当遇到目录时列出目录本身而非目录内的文件   -D, --dired                   产生适合Emacs 的dired 模式使用的结果   -f                            不进行排序,-aU 选项生效,-lst 选项失效   -F, --classify                加上文件类型的指示符号(*/=@| 其中一个)       --format=关键字           交错-x,逗号分隔-m,水平-x,长-l,                                 单栏-1,详细-l,垂直-C       --full-time               即-l --time-style=full-iso   -g                            类似-l,但不列出所有者       --group-directories-first                         在文件前分组目录。此选项可与--sort 一起使用,                         但是一旦使用--sort=none (-U)将禁用分组   -G, --no-group                以一个长列表的形式,不输出组名   -h, --human-readable          与-l 一起,以易于阅读的格式输出文件大小                                 (例如 1K 234M 2G)       --si                      同上面类似,但是使用1000 为基底而非1024   -H, --dereference-command-line                                 跟随命令行列出的符号链接       --dereference-command-line-symlink-to-dir                                 跟随命令行列出的目录的符号链接       --hide=PATTERN            隐藏符合PATTERN 模式的项目                                 (-a 或 -A 将覆盖此选项)       --indicator-style=方式    指定在每个项目名称后加上指示符号方式:                                 none (默认),classify (-F),file-type (-p)   -i, --inode                   显示每个文件的inode 号   -I, --ignore=PATTERN          不显示任何符合指定shell PATTERN 的项目   -k                            即--block-size=1K   -l                            使用较长格式列出信息   -L, --dereference             当显示符号链接的文件信息时,显示符号链接所指示                                 的对象而并非符号链接本身的信息   -m                            所有项目以逗号分隔,并填满整行行宽   -n, --numeric-uid-gid         类似 -l,但列出UID 及GID 号   -N, --literal                 输出未经处理的项目名称 (如不特别处理控制字符)   -o                            类似 -l,但不列出有关组的信息   -p,  --indicator-style=slash  对目录加上表示符号"/"   -q, --hide-control-chars      以"?"字符代替无法打印的字符       --show-control-chars      直接显示无法打印的字符 (这是默认方式,除非调用                                 的程序名称是"ls"而且是在终端输出结果)   -Q, --quote-name              将条目名称括上双引号       --quoting-style=方式      使用指定的quoting 方式显示条目的名称:                                 literal、locale、shell、shell-always、c、escape   -r, --reverse                 排序时保留顺序   -R, --recursive               递归显示子目录   -s, --size                    以块数形式显示每个文件分配的尺寸   -S                            根据文件大小排序       --sort=WORD               以下是可选用的WORD 和它们代表的相应选项:                                 extension -X       status   -c                                 none      -U       time     -t                                 size      -S       atime    -u                                 time      -t       access   -u                                 version   -v       use      -u       --time=WORD               和-l 同时使用时显示WORD 所代表的时间而非修改时                                 间:atime、access、use、ctime 或status;加上                                 --sort=time 选项时会以指定时间作为排序关键字       --time-style=STYLE        和-l 同时使用时根据STYLE 代表的格式显示时间:                                 full-iso、iso、locale、posix-iso、+FORMAT。                                 FORMAT 即是"date"所用的时间格式;如果FORMAT                                 是FORMAT1<换行>FORMAT2,FORMAT1 适用于较旧                                 的文件而FORMAT2 适用于较新的文件;如果STYLE                                 以"posix-"开头,则STYLE 仅在POSIX 语系之外                                 生效。   -t                            根据修改时间排序   -T, --tabsize=宽度    				 指定制表符(Tab)的宽度,而非8 个字符   -t                            按修改时间排序   -T, --tabsize=COLS            指定制表符(Tab)的宽度,而非8个字符   -u                            同-lt 一起使用:按照访问时间排序并显示                                 同-l一起使用:显示访问时间并按文件名排序                                 其他:按照访问时间排序   -U                            不进行排序;按照目录顺序列出项目   -v                            在文本中进行数字(版本)的自然排序   SIZE 可以是一个可选的整数,后面跟着以下单位中的一个: KB 1000,K 1024,MB 1000*1000,M 1024*1024,还有 G、T、P、E、Z、Y。   使用色彩来区分文件类型的功能已被禁用,默认设置和 --color=never 同时禁用了它。 使用 --color=auto 选项,ls 只在标准输出被连至终端时才生成颜色代码。 LS_COLORS 环境变量可改变此设置,可使用 dircolors 命令来设置。 ll -t 是降序,  ll -t | tac 是升序