国产 无码 综合区,色欲AV无码国产永久播放,无码天堂亚洲国产AV,国产日韩欧美女同一区二区

Linux常用命令——ls命令

這篇具有很好參考價值的文章主要介紹了Linux常用命令——ls命令。希望對大家有所幫助。如果存在錯誤或未考慮完全的地方,請大家不吝賜教,您也可以點擊"舉報違法"按鈕提交疑問。

在線Linux命令查詢工具

ls

顯示目錄內(nèi)容列表

補充說明

ls命令用來顯示目標(biāo)列表,在Linux中是使用率較高的命令。ls命令的輸出信息可以進行彩色加亮顯示,以分區(qū)不同類型的文件。

語法

ls(選項)(參數(shù))

選項

-a, --all        # 不隱藏任何以. 開始的項目
-A, --almost-all #   列出除. 及.. 以外的任何項目
    --author     # 與-l 同時使用時列出每個文件的作者
-b, --escape     # 以八進制溢出序列表示不可打印的字符
    --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        # 類似-l,但不列出所有者
    --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          # 以一個長列表的形式,不輸出組名
-h, --human-readable    # 與-l 一起,以易于閱讀的格式輸出文件大小
      (例如 1K 234M 2G)
    --si      # 同上面類似,但是使用1000 為基底而非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                #  使用較長格式列出信息
-L, --dereference #  當(dāng)顯示符號鏈接的文件信息時,顯示符號鏈接所指示
     # 的對象而并非符號鏈接本身的信息
-m   #     所有項目以逗號分隔,并填滿整行行寬
-n, --numeric-uid-gid #  類似 -l,但列出UID 及GID 號
-N, --literal  #   輸出未經(jīng)處理的項目名稱 (如不特別處理控制字符)
-o       # 類似 -l,但不列出有關(guān)組的信息
-p,  --indicator-style=slash # 對目錄加上表示符號"/"
-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   #  逆序排列
-R, --recursive #  遞歸顯示子目錄
-s, --size      #  以塊數(shù)形式顯示每個文件分配的尺寸
-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    # 顯示此幫助信息并退出
    --version # 顯示版本信息并退出

參數(shù)

目錄:指定要顯示列表的目錄,也可以是具體的文件。

實例

$ ls       # 僅列出當(dāng)前目錄可見文件
$ ls -l    # 列出當(dāng)前目錄可見文件詳細信息
$ ls -hl   # 列出詳細信息并以可讀大小顯示文件大小
$ ls -al   # 列出所有文件(包括隱藏)的詳細信息

顯示當(dāng)前目錄下包括影藏文件在內(nèi)的所有文件列表

[root@localhost ~]# ls -a
.   anaconda-ks.cfg  .bash_logout   .bashrc  install.log         .mysql_history  satools  .tcshrc   .vimrc
..  .bash_history    .bash_profile  .cshrc   install.log.syslog  .rnd            .ssh     .viminfo

輸出長格式列表

[root@localhost ~]# ls -1

anaconda-ks.cfg
install.log
install.log.syslog
satools

顯示文件的inode信息
索引節(jié)點(index inode簡稱為“inode”)是Linux中一個特殊的概念,具有相同的索引節(jié)點號的兩個文本本質(zhì)上是同一個文件(除文件名不同外)。

[root@localhost ~]# ls -i -l anaconda-ks.cfg install.log
2345481 -rw------- 1 root root   859 Jun 11 22:49 anaconda-ks.cfg
2345474 -rw-r--r-- 1 root root 13837 Jun 11 22:49 install.log

水平輸出文件列表

[root@localhost /]# ls -m

bin, boot, data, dev, etc, home, lib, lost+found, media, misc, mnt, opt, proc, root, sbin, selinux, srv, sys, tmp, usr, var

修改最后一次編輯的文件
最近修改的文件顯示在最上面。

[root@localhost /]# ls -t

tmp  root  etc  dev  lib  boot  sys  proc  data  home  bin  sbin  usr  var  lost+found  media  mnt  opt  selinux  srv  misc

顯示遞歸文件

[root@localhost ~]# ls -R
.:
anaconda-ks.cfg  install.log  install.log.syslog  satools

./satools:
black.txt  freemem.sh  iptables.sh  lnmp.sh  mysql  php502_check.sh  ssh_safe.sh

打印文件的UID和GID

[root@localhost /]# ls -n

total 254
drwxr-xr-x   2 0 0  4096 Jun 12 04:03 bin
drwxr-xr-x   4 0 0  1024 Jun 15 14:45 boot
drwxr-xr-x   6 0 0  4096 Jun 12 10:26 data
drwxr-xr-x  10 0 0  3520 Sep 26 15:38 dev
drwxr-xr-x  75 0 0  4096 Oct 16 04:02 etc
drwxr-xr-x   4 0 0  4096 Jun 12 10:26 home
drwxr-xr-x  14 0 0 12288 Jun 16 04:02 lib
drwx------   2 0 0 16384 Jun 11 22:46 lost+found
drwxr-xr-x   2 0 0  4096 May 11  2011 media
drwxr-xr-x   2 0 0  4096 Nov  8  2010 misc
drwxr-xr-x   2 0 0  4096 May 11  2011 mnt
drwxr-xr-x   2 0 0  4096 May 11  2011 opt
dr-xr-xr-x 232 0 0     0 Jun 15 11:04 proc
drwxr-x---   4 0 0  4096 Oct 15 14:43 root
drwxr-xr-x   2 0 0 12288 Jun 12 04:03 sbin
drwxr-xr-x   2 0 0  4096 May 11  2011 selinux
drwxr-xr-x   2 0 0  4096 May 11  2011 srv
drwxr-xr-x  11 0 0     0 Jun 15 11:04 sys
drwxrwxrwt   3 0 0 98304 Oct 16 08:45 tmp
drwxr-xr-x  13 0 0  4096 Jun 11 23:38 usr
drwxr-xr-x  19 0 0  4096 Jun 11 23:38 var

列出文件和文件夾的詳細信息

[root@localhost /]# ls -l

total 254
drwxr-xr-x   2 root root  4096 Jun 12 04:03 bin
drwxr-xr-x   4 root root  1024 Jun 15 14:45 boot
drwxr-xr-x   6 root root  4096 Jun 12 10:26 data
drwxr-xr-x  10 root root  3520 Sep 26 15:38 dev
drwxr-xr-x  75 root root  4096 Oct 16 04:02 etc
drwxr-xr-x   4 root root  4096 Jun 12 10:26 home
drwxr-xr-x  14 root root 12288 Jun 16 04:02 lib
drwx------   2 root root 16384 Jun 11 22:46 lost+found
drwxr-xr-x   2 root root  4096 May 11  2011 media
drwxr-xr-x   2 root root  4096 Nov  8  2010 misc
drwxr-xr-x   2 root root  4096 May 11  2011 mnt
drwxr-xr-x   2 root root  4096 May 11  2011 opt
dr-xr-xr-x 232 root root     0 Jun 15 11:04 proc
drwxr-x---   4 root root  4096 Oct 15 14:43 root
drwxr-xr-x   2 root root 12288 Jun 12 04:03 sbin
drwxr-xr-x   2 root root  4096 May 11  2011 selinux
drwxr-xr-x   2 root root  4096 May 11  2011 srv
drwxr-xr-x  11 root root     0 Jun 15 11:04 sys
drwxrwxrwt   3 root root 98304 Oct 16 08:48 tmp
drwxr-xr-x  13 root root  4096 Jun 11 23:38 usr
drwxr-xr-x  19 root root  4096 Jun 11 23:38 var

列出可讀文件和文件夾詳細信息

[root@localhost /]# ls -lh

total 254K
drwxr-xr-x   2 root root 4.0K Jun 12 04:03 bin
drwxr-xr-x   4 root root 1.0K Jun 15 14:45 boot
drwxr-xr-x   6 root root 4.0K Jun 12 10:26 data
drwxr-xr-x  10 root root 3.5K Sep 26 15:38 dev
drwxr-xr-x  75 root root 4.0K Oct 16 04:02 etc
drwxr-xr-x   4 root root 4.0K Jun 12 10:26 home
drwxr-xr-x  14 root root  12K Jun 16 04:02 lib
drwx------   2 root root  16K Jun 11 22:46 lost+found
drwxr-xr-x   2 root root 4.0K May 11  2011 media
drwxr-xr-x   2 root root 4.0K Nov  8  2010 misc
drwxr-xr-x   2 root root 4.0K May 11  2011 mnt
drwxr-xr-x   2 root root 4.0K May 11  2011 opt
dr-xr-xr-x 235 root root    0 Jun 15 11:04 proc
drwxr-x---   4 root root 4.0K Oct 15 14:43 root
drwxr-xr-x   2 root root  12K Jun 12 04:03 sbin
drwxr-xr-x   2 root root 4.0K May 11  2011 selinux
drwxr-xr-x   2 root root 4.0K May 11  2011 srv
drwxr-xr-x  11 root root    0 Jun 15 11:04 sys
drwxrwxrwt   3 root root  96K Oct 16 08:49 tmp
drwxr-xr-x  13 root root 4.0K Jun 11 23:38 usr
drwxr-xr-x  19 root root 4.0K Jun 11 23:38 var

顯示文件夾信息

[root@localhost /]# ls -ld /etc/

drwxr-xr-x 75 root root 4096 Oct 16 04:02 /etc/

按時間列出文件和文件夾詳細信息

[root@localhost /]# ls -lt

total 254
drwxrwxrwt   3 root root 98304 Oct 16 08:53 tmp
drwxr-xr-x  75 root root  4096 Oct 16 04:02 etc
drwxr-x---   4 root root  4096 Oct 15 14:43 root
drwxr-xr-x  10 root root  3520 Sep 26 15:38 dev
drwxr-xr-x  14 root root 12288 Jun 16 04:02 lib
drwxr-xr-x   4 root root  1024 Jun 15 14:45 boot
drwxr-xr-x  11 root root     0 Jun 15 11:04 sys
dr-xr-xr-x 232 root root     0 Jun 15 11:04 proc
drwxr-xr-x   6 root root  4096 Jun 12 10:26 data
drwxr-xr-x   4 root root  4096 Jun 12 10:26 home
drwxr-xr-x   2 root root  4096 Jun 12 04:03 bin
drwxr-xr-x   2 root root 12288 Jun 12 04:03 sbin
drwxr-xr-x  13 root root  4096 Jun 11 23:38 usr
drwxr-xr-x  19 root root  4096 Jun 11 23:38 var
drwx------   2 root root 16384 Jun 11 22:46 lost+found
drwxr-xr-x   2 root root  4096 May 11  2011 media
drwxr-xr-x   2 root root  4096 May 11  2011 mnt
drwxr-xr-x   2 root root  4096 May 11  2011 opt
drwxr-xr-x   2 root root  4096 May 11  2011 selinux
drwxr-xr-x   2 root root  4096 May 11  2011 srv
drwxr-xr-x   2 root root  4096 Nov  8  2010 misc

按修改時間列出文件和文件夾詳細信息

[root@localhost /]# ls -ltr

total 254
drwxr-xr-x   2 root root  4096 Nov  8  2010 misc
drwxr-xr-x   2 root root  4096 May 11  2011 srv
drwxr-xr-x   2 root root  4096 May 11  2011 selinux
drwxr-xr-x   2 root root  4096 May 11  2011 opt
drwxr-xr-x   2 root root  4096 May 11  2011 mnt
drwxr-xr-x   2 root root  4096 May 11  2011 media
drwx------   2 root root 16384 Jun 11 22:46 lost+found
drwxr-xr-x  19 root root  4096 Jun 11 23:38 var
drwxr-xr-x  13 root root  4096 Jun 11 23:38 usr
drwxr-xr-x   2 root root 12288 Jun 12 04:03 sbin
drwxr-xr-x   2 root root  4096 Jun 12 04:03 bin
drwxr-xr-x   4 root root  4096 Jun 12 10:26 home
drwxr-xr-x   6 root root  4096 Jun 12 10:26 data
dr-xr-xr-x 232 root root     0 Jun 15 11:04 proc
drwxr-xr-x  11 root root     0 Jun 15 11:04 sys
drwxr-xr-x   4 root root  1024 Jun 15 14:45 boot
drwxr-xr-x  14 root root 12288 Jun 16 04:02 lib
drwxr-xr-x  10 root root  3520 Sep 26 15:38 dev
drwxr-x---   4 root root  4096 Oct 15 14:43 root
drwxr-xr-x  75 root root  4096 Oct 16 04:02 etc
drwxrwxrwt   3 root root 98304 Oct 16 08:54 tmp

按照特殊字符對文件進行分類

[root@localhost nginx-1.2.1]# ls -F

auto/  CHANGES  CHANGES.ru  conf/  configure*  contrib/  html/  LICENSE  Makefile  man/  objs/  README  src/

列出文件并標(biāo)記顏色分類

[root@localhost nginx-1.2.1]# ls --color=auto

auto  CHANGES  CHANGES.ru  conf  configure  contrib  html  LICENSE  Makefile  man  objs  README  src

在線Linux命令查詢工具

linux ls,Linux命令,linux,運維,服務(wù)器
原文鏈接文章來源地址http://www.zghlxwxcb.cn/news/detail-740437.html

到了這里,關(guān)于Linux常用命令——ls命令的文章就介紹完了。如果您還想了解更多內(nèi)容,請在右上角搜索TOY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持TOY模板網(wǎng)!

本文來自互聯(lián)網(wǎng)用戶投稿,該文觀點僅代表作者本人,不代表本站立場。本站僅提供信息存儲空間服務(wù),不擁有所有權(quán),不承擔(dān)相關(guān)法律責(zé)任。如若轉(zhuǎn)載,請注明出處: 如若內(nèi)容造成侵權(quán)/違法違規(guī)/事實不符,請點擊違法舉報進行投訴反饋,一經(jīng)查實,立即刪除!

領(lǐng)支付寶紅包贊助服務(wù)器費用

相關(guān)文章

  • Linux 常用操作命令(CentOS 7.0)- 故障定位:服務(wù)器負載、進程管理、日志分析

    系統(tǒng)經(jīng)研發(fā)測試上線后,如果運行期間出現(xiàn)了BUG,需要對服務(wù)故障進行定位,一般會查看服務(wù)器負載、服務(wù)狀態(tài)、進程管理、服務(wù)日志等。 本文以CentOS 7.0 操作系統(tǒng)上的命令操作作為示例進行記錄。 #服務(wù)器負載 完整參見:http://www.laobingbiji.com/note/detail.html?note_id=20231115154337

    2024年01月17日
    瀏覽(99)
  • Python 與機器學(xué)習(xí),在服務(wù)器使用過程中,常用的 Linux 命令包括哪些?

    Python 與機器學(xué)習(xí),在服務(wù)器使用過程中,常用的 Linux 命令包括哪些?

    ?? CSDN 葉庭云 : https://yetingyun.blog.csdn.net/ 本博客旨在分享在實際開發(fā)過程中,開發(fā)者需要了解并熟練運用的 Linux 操作系統(tǒng)常用命令。Linux 作為一種操作系統(tǒng),與 Windows 或 MacOS 并駕齊驅(qū),尤其在服務(wù)器和開發(fā)環(huán)境中占據(jù)重要地位。Linux 命令,簡而言之,就是指導(dǎo)計算機執(zhí)行

    2024年04月12日
    瀏覽(28)
  • 運維 | 查看 Linux 服務(wù)器 IP 地址

    大多數(shù)在操作 Linux 系統(tǒng)時,我們經(jīng)常需要知道服務(wù)器的 IP 比便于后續(xù)的一系列操作,這時候有快速查看主機 IP 的命令行操作,能夠有效的幫助我們 本章節(jié)主要記錄一些常用查看服務(wù)器 IP 的命令,希望對大家有所幫助。 查看 Linux 服務(wù)器的 IP 地址的命令大體上有以下幾種。

    2024年04月27日
    瀏覽(104)
  • Linux常用命令——ls命令

    Linux常用命令——ls命令

    顯示目錄內(nèi)容列表 ls命令 用來顯示目標(biāo)列表,在Linux中是使用率較高的命令。ls命令的輸出信息可以進行彩色加亮顯示,以分區(qū)不同類型的文件。 語法 選項 參數(shù) 目錄:指定要顯示列表的目錄,也可以是具體的文件。 實例 顯示當(dāng)前目錄下包括影藏文件在內(nèi)的所有文件列表 輸

    2024年02月06日
    瀏覽(21)
  • 【運維】Linux 跨服務(wù)器復(fù)制文件文件夾

    如果是云服務(wù) 建議用內(nèi)網(wǎng)ip scp是secure copy的簡寫,用于在Linux下進行遠程拷貝文件的命令,和它類似的命令有cp,不過cp只是在本機進行拷貝不能跨服務(wù)器,而且scp傳輸是加密的。可能會稍微影響一下速度。當(dāng)你服務(wù)器硬盤變?yōu)橹蛔x read only system時,用scp可以幫你把文件移出來

    2024年02月08日
    瀏覽(109)
  • 【Linux 服務(wù)器運維】定時任務(wù) crontab 詳解 | 文末送書

    【Linux 服務(wù)器運維】定時任務(wù) crontab 詳解 | 文末送書

    本文思維導(dǎo)圖概述的主要內(nèi)容: 1.1 什么是 crontab Crontab 是一個在 Unix 和 Linux 操作系統(tǒng)上 用于定時執(zhí)行任務(wù) 的工具。它允許用戶創(chuàng)建和管理計劃任務(wù),以便在特定的時間間隔或時間點自動運行命令或腳本。Crontab 是 cron table 的縮寫, cron 指的是 Unix 系統(tǒng)中的一個后臺進程,它

    2024年02月08日
    瀏覽(129)
  • 【Linux運維】shell腳本檢查服務(wù)器內(nèi)存和CPU利用率

    在管理服務(wù)器時候?qū)懥艘粋€ shell腳本,在服務(wù)上實現(xiàn)每天凌晨3點查系統(tǒng)的指定文件夾下的容量大小,如果超過10G就要刪除3天前的內(nèi)容,還要時刻查詢內(nèi)存和cpu利用率,如果超過80%就要提示用戶出現(xiàn)過載 將以上代碼保存為一個.sh文件,然后通過crontab在每天凌晨3點運行即可:

    2024年02月09日
    瀏覽(33)
  • Linux服務(wù)器常見運維性能測試(1)綜合跑分unixbench、superbench

    Linux服務(wù)器常見運維性能測試(1)綜合跑分unixbench、superbench

    最近需要測試一批服務(wù)器的相關(guān)硬件性能,以及在常規(guī)環(huán)境下的硬件運行穩(wěn)定情況,需要持續(xù)拷機測試穩(wěn)定性。所以找了一些測試用例。本次測試包括在服務(wù)器的高低溫下性能記錄及壓力測試,高低電壓下性能記錄及壓力測試,常規(guī)環(huán)境下CPU滿載穩(wěn)定運行的功率記錄。 這個系

    2024年02月04日
    瀏覽(103)
  • Linux本地部署1Panel服務(wù)器運維管理面板并實現(xiàn)公網(wǎng)訪問

    Linux本地部署1Panel服務(wù)器運維管理面板并實現(xiàn)公網(wǎng)訪問

    1Panel 是一個現(xiàn)代化、開源的 Linux 服務(wù)器運維管理面板。高效管理,通過 Web 端輕松管理 Linux 服務(wù)器,包括主機監(jiān)控、文件管理、數(shù)據(jù)庫管理、容器管理等 下面我們介紹在Linux 本地安裝1Panel 并結(jié)合cpolar 內(nèi)網(wǎng)穿透工具實現(xiàn)遠程訪問1Panel 管理界面 執(zhí)行如下命令一鍵安裝 1Panel: 安

    2024年02月04日
    瀏覽(108)
  • openeuler服務(wù)器 ls 和ll 命令報錯 command not found...

    openeuler服務(wù)器 ls 和ll 命令報錯 command not found...

    在openeuler服務(wù)器執(zhí)行 ls 和ll 命令報錯 command not found... ?大概是系統(tǒng)環(huán)境變量導(dǎo)致的問題。 我在安裝redis是否沒有安裝成功后就出現(xiàn)了這樣的情況。編輯profile文件沒有寫正確,導(dǎo)致在命令行下ls 和 ll 等命令不能夠識別。 重新設(shè)置一下環(huán)境變量。 執(zhí)行以后。 ?ll 命令可以使用

    2024年02月13日
    瀏覽(43)

覺得文章有用就打賞一下文章作者

支付寶掃一掃打賞

博客贊助

微信掃一掃打賞

請作者喝杯咖啡吧~博客贊助

支付寶掃一掃領(lǐng)取紅包,優(yōu)惠每天領(lǐng)

二維碼1

領(lǐng)取紅包

二維碼2

領(lǐng)紅包