linux的ls命令详解(一)
2017-08-28 17:15
330 查看
ls命令是Linux系统中最被频繁使用的命令之一,我相信ls命令应该是你在Linux系统中使用次数最多的命令。我们每天都在频繁地使用ls命令,然而我们可能没有意识到也从来用不到ls命令的所有可用选项。相信当你习惯了多用一些选项的时候,它还是会给你带来一些便利的。
用法:ls [选项][文件]
例如:ls -a apache-tomcat
. bin cd.. lib logs RELEASE-NOTES temp work
.. cd conf LICENSE NOTICE RUNNING.txt webapps
List information about the FILEs (the current directory by default).
Sort entries alphabetically if none of -cftuvSUX nor --sort is specified.
列出有关文件的信息(默认为当前目录)。 按字母顺序排序的条目,如果没有- cftuvsux也指定排序。长选项的强制参数对于短选项也是必需的(这个段落是系统帮助中的内容,说实话我也不太懂,欢迎大家踊跃探讨)。
-a, --all 不隐藏任何以. 开始的项目
-A, --almost-all 列出除. 及.. 以外的任何项目
--author 与-l 同时使用时列出每个文件的作者(不论是-a还是-A)。例如:
[root@localhost 桌面]# ls -l -a
总用量 18040
drwxr-xr-x. 4 i i 245 8月 28 17:19 .
drwx------. 14 i inf 4096 8月 28 15:32 ..
drwxrwxrwx. 9 root root 182 8月 28 15:40 apache-tomcat
-rw-r--r--. 1 root root 0 8月 28 16:08 --help
-rw-------. 1 in in 18499 8月 15 18:29 LinuxVarLog-xiangjie.txt
-rw-r--r--. 1 root root 0 8月 28 16:08 man
-rw-r--r--. 1 root root 18 8月 28 17:19 s1
-rw-r--r--. 1 root root 189 8月 26 11:59 start0822
-rw-r--r--. 1 root root 189 8月 26 12:14 start1
-rw-r--r--. 1 root root 189 8月 28 16:10 start2
-rwxrwxrwx. 1 root root 0 8月 26 12:14 start日志
root@localhost 桌面]# ls -A -l
总用量 18036
drwxrwxrwx. 9 root root 182 8月 28 15:40 apache-tomcat
-rwxrw-rw-. 1 i i 14356480 7月 21 10:37 apache-tomcat-
drwxrwxr-x. 14 i i 4096 5月 17 2016 bugzilla-5.0.3
-rw-r--r--. 1 root root 0 8月 28 16:08 --help
-rw-------. 1 in in 18499 8月 15 18:29 LinuxVarLog-xiangjie.txt
-rw-r--r--. 1 root root 0 8月 28 16:08 man
-rw-r--r--. 1 root root 18 8月 28 17:19 s1
-rw-r--r--. 1 root root 189 8月 26 11:59 start0822
-rw-r--r--. 1 root root 189 8月 26 12:14 start1
-rw-r--r--. 1 root root 189 8月 28 16:10 start2
-rwxrwxrwx. 1 root root 0 8月 26 12:14 start日志
-l 使用较长格式列出信息,包括文件的权限信息,文件大小,作者,创建时间等。
-Z(大写Z) Displays only mode, user, group,security context and file name。只显示模式、用户、组、安全上下文和文件名。例如:
[root@localhost 桌面]# ls -Z
drwxrwxrwx. root root unconfined_u:object_r:user_home_t:s0 apache-tomcat
-rw-r--r--. root root unconfined_u:object_r:user_home_t:s0 --help
-rw-r--r--. root root unconfined_u:object_r:user_home_t:s0 man
-rw-r--r--. root root unconfined_u:object_r:user_home_t:s0 s1
-rw-r--r--. root root unconfined_u:object_r:user_home_t:s0 start0822
-rw-r--r--. root root unconfined_u:object_r:user_home_t:s0 start1
-rw-r--r--. root root unconfined_u:object_r:user_home_t:s0 start2
-rw-r--r--. root root unconfined_u:object_r:user_home_t:s0 start3
-rwxrwxrwx. root root unconfined_u:object_r:user_home_t:s0 sta
让我们把-Z和-l对比一下:
ls -l
总用量 18040
drwxrwxrwx. 9 root root 182 8月 28 15:40 apache-tomcat
-rw-r--r--. 1 root root 0 8月 28 16:08 --help
-rw-r--r--. 1 root root 0 8月 28 16:08 man
-rw-r--r--. 2 root root 18 8月 28 17:19 s1
-rw-r--r--. 1 root root 189 8月 26 11:59 start0822
-rw-r--r--. 1 root root 189 8月 26 12:14 start1
-rw-r--r--. 1 root root 189 8月 28 16:10 start2
-rw-r--r--. 2 root root 18 8月 28 17:19 start3
-rwxrwxrwx. 1 root root 0 8月 26 12:14 start日志
用法:ls [选项][文件]
例如:ls -a apache-tomcat
. bin cd.. lib logs RELEASE-NOTES temp work
.. cd conf LICENSE NOTICE RUNNING.txt webapps
List information about the FILEs (the current directory by default).
Sort entries alphabetically if none of -cftuvSUX nor --sort is specified.
列出有关文件的信息(默认为当前目录)。 按字母顺序排序的条目,如果没有- cftuvsux也指定排序。长选项的强制参数对于短选项也是必需的(这个段落是系统帮助中的内容,说实话我也不太懂,欢迎大家踊跃探讨)。
-a, --all 不隐藏任何以. 开始的项目
-A, --almost-all 列出除. 及.. 以外的任何项目
--author 与-l 同时使用时列出每个文件的作者(不论是-a还是-A)。例如:
[root@localhost 桌面]# ls -l -a
总用量 18040
drwxr-xr-x. 4 i i 245 8月 28 17:19 .
drwx------. 14 i inf 4096 8月 28 15:32 ..
drwxrwxrwx. 9 root root 182 8月 28 15:40 apache-tomcat
-rw-r--r--. 1 root root 0 8月 28 16:08 --help
-rw-------. 1 in in 18499 8月 15 18:29 LinuxVarLog-xiangjie.txt
-rw-r--r--. 1 root root 0 8月 28 16:08 man
-rw-r--r--. 1 root root 18 8月 28 17:19 s1
-rw-r--r--. 1 root root 189 8月 26 11:59 start0822
-rw-r--r--. 1 root root 189 8月 26 12:14 start1
-rw-r--r--. 1 root root 189 8月 28 16:10 start2
-rwxrwxrwx. 1 root root 0 8月 26 12:14 start日志
root@localhost 桌面]# ls -A -l
总用量 18036
drwxrwxrwx. 9 root root 182 8月 28 15:40 apache-tomcat
-rwxrw-rw-. 1 i i 14356480 7月 21 10:37 apache-tomcat-
drwxrwxr-x. 14 i i 4096 5月 17 2016 bugzilla-5.0.3
-rw-r--r--. 1 root root 0 8月 28 16:08 --help
-rw-------. 1 in in 18499 8月 15 18:29 LinuxVarLog-xiangjie.txt
-rw-r--r--. 1 root root 0 8月 28 16:08 man
-rw-r--r--. 1 root root 18 8月 28 17:19 s1
-rw-r--r--. 1 root root 189 8月 26 11:59 start0822
-rw-r--r--. 1 root root 189 8月 26 12:14 start1
-rw-r--r--. 1 root root 189 8月 28 16:10 start2
-rwxrwxrwx. 1 root root 0 8月 26 12:14 start日志
-l 使用较长格式列出信息,包括文件的权限信息,文件大小,作者,创建时间等。
-Z(大写Z) Displays only mode, user, group,security context and file name。只显示模式、用户、组、安全上下文和文件名。例如:
[root@localhost 桌面]# ls -Z
drwxrwxrwx. root root unconfined_u:object_r:user_home_t:s0 apache-tomcat
-rw-r--r--. root root unconfined_u:object_r:user_home_t:s0 --help
-rw-r--r--. root root unconfined_u:object_r:user_home_t:s0 man
-rw-r--r--. root root unconfined_u:object_r:user_home_t:s0 s1
-rw-r--r--. root root unconfined_u:object_r:user_home_t:s0 start0822
-rw-r--r--. root root unconfined_u:object_r:user_home_t:s0 start1
-rw-r--r--. root root unconfined_u:object_r:user_home_t:s0 start2
-rw-r--r--. root root unconfined_u:object_r:user_home_t:s0 start3
-rwxrwxrwx. root root unconfined_u:object_r:user_home_t:s0 sta
让我们把-Z和-l对比一下:
ls -l
总用量 18040
drwxrwxrwx. 9 root root 182 8月 28 15:40 apache-tomcat
-rw-r--r--. 1 root root 0 8月 28 16:08 --help
-rw-r--r--. 1 root root 0 8月 28 16:08 man
-rw-r--r--. 2 root root 18 8月 28 17:19 s1
-rw-r--r--. 1 root root 189 8月 26 11:59 start0822
-rw-r--r--. 1 root root 189 8月 26 12:14 start1
-rw-r--r--. 1 root root 189 8月 28 16:10 start2
-rw-r--r--. 2 root root 18 8月 28 17:19 start3
-rwxrwxrwx. 1 root root 0 8月 26 12:14 start日志
相关文章推荐
- Linux常用命令[top ps grep ls chmod rm mkdir find awk]详解
- linux 中的ls命令参数详解及ls命令的使用实例
- linux中ls命令详解
- Linux常用命令——ls命令选项详解
- dircolors命令_Linux dircolors 命令用法详解:置ls命令在显示目录或文件时所用的色彩
- linux ls命令参数及用法详解---linux显示目录内容命令
- linux中ls命令详解
- Linux命令详解-ls
- Linux中ls命令详解
- Linux中ls命令详解
- ls命令_Linux ls 命令用法详解:显示目录内容列表
- Linux命令之ls命令详解
- linux-ls命令参数详解&统计目录下文件和目录的个数实例
- Linux常用ls, alias基础命令详解
- linux的ls命令详解(三)(几种常用的ls选项排序命令)
- linux之ls -l命令详解
- linux中ls命令详解
- Linux基本常用命令之ls详解(含date,cal)
- linux下ls 命令详解
- Linux下的ls命令详解以及C语言实现