教你如何快速建站,网站制作岗位职责,关于公司网站建设,怀化百度整站优化服务1.命令功能 ls命令是“list directory contents”#xff0c;显示当前目录下的内容和文件属性。 2.语法格式 ls [option] file ls 选项 文件名 3.选项说明 参数 参数说明 -a 显示全部文件包括隐藏文件#xff0c;包括.和.. -A 显示全部文件#xff0c;但是不包括.和…1.命令功能 ls命令是“list directory contents”显示当前目录下的内容和文件属性。 2.语法格式 ls [option] file ls 选项 文件名 3.选项说明 参数 参数说明 -a 显示全部文件包括隐藏文件包括.和.. -A 显示全部文件但是不包括.和..(列出除了”.”和“..”以外的文件) -l 已长文件格式显示文件属性 -B 不要列出已~结尾的隐藏文件 -F 在每个文件的末尾添加一个标识符通过标识符表明该文件的类型。“/”表示目录“”表示符号链接“|”表示FIFOS“”表示套接字。 -t 按时间进行文件排序 -R 将目录下说有的子目录的文件都列出来。 -S 以文件大小进行排序。 说明 linux文件的一些颜色含义绿色可执行文件红色压缩文件深蓝色目录浅蓝色链接文件灰色其它一些文件。 4. 使用范例 范例1 列出全部文件包括隐藏文件 [rootlocalhost cxf]# ls -a . .. .bash_history .bash_logout .bash_profile .bashrc dir1 dir2 .lesshst test 范例2 列出除了”.”和“..”以外的文件 [rootlocalhost cxf]# ls -A .bash_history .bash_logout .bash_profile .bashrc dir1 dir2 .lesshst test 范例3 长格式显示文件属性信息 [rootlocalhost cxf]# ls -l total 12 drwxr-xr-x. 2 root root 4096 Mar 13 16:43 dir1 drwxr-xr-x. 2 root root 4096 Mar 13 16:43 dir2 -rw-r--r--. 1 root root 12 Mar 13 16:41 test 范例4 在文件尾加上标识符 [rootlocalhost cxf]# ls -F dir1/ dir2/ test [rootlocalhost cxf]# ls -lF total 12 drwxr-xr-x. 2 root root 4096 Mar 13 16:43 dir1/ drwxr-xr-x. 2 root root 4096 Mar 13 16:43 dir2/ -rw-r--r--. 1 root root 12 Mar 13 16:41 test 范例5 显示目录下的所有子目录 [rootlocalhost cxf]# ls -R .: dir1 dir2 ok test ./dir1: ./dir2: ./ok: a ./ok/a: b ./ok/a/b: c ./ok/a/b/c: 转载于:https://www.cnblogs.com/joechu/p/8618072.html