linux 中ls命令详解

2019-09-23 09:02:58丽君

[root@localhost /]# ls -ltotal 254drwxr-xr-x  
2 root root 4096 Jun 12 04:03 bindrwxr-xr-x 
 4 root root 1024 Jun 15 14:45 bootdrwxr-xr-x 
 6 root root 4096 Jun 12 10:26 datadrwxr-xr-x 
10 root root 3520 Sep 26 15:38 devdrwxr-xr-x 
75 root root 4096 Oct 16 04:02 etcdrwxr-xr-x  
4 root root 4096 Jun 12 10:26 homedrwxr-xr-x 
14 root root 12288 Jun 16 04:02 libdrwx------ 
 2 root root 16384 Jun 11 22:46 lost+founddrwxr-xr-x  2 root root 4096 May 11 2011 mediadrwxr-xr-x  2 root root 4096 Nov 8 2010 miscdrwxr-xr-x 
 2 root root 4096 May 11 2011 mntdrwxr-xr-x 
 2 root root 4096 May 11 2011 optdr-xr-xr-x 
232 root root   0 Jun 15 11:04 procdrwxr-x--- 
 4 root root 4096 Oct 15 14:43 rootdrwxr-xr-x 
 2 root root 12288 Jun 12 04:03 sbindrwxr-xr-x 
 2 root root 4096 May 11 2011 selinuxdrwxr-xr-x  2 root root 4096 May 11 2011 srvdrwxr-xr-x 
 11 root root   0 Jun 15 11:04 sysdrwxrwxrwt 
 3 root root 98304 Oct 16 08:48 tmpdrwxr-xr-x 
13 root root 4096 Jun 11 23:38 usrdrwxr-xr-x 
 19 root root 4096 Jun 11 23:38 var

列出可读文件和文件夹详细信息

[root@localhost /]# ls -lhtotal 254Kdrwxr-xr-x 
 2 root root 4.0K Jun 12 04:03 bindrwxr-xr-x 
 4 root root 1.0K Jun 15 14:45 bootdrwxr-xr-x 
 6 root root 4.0K Jun 12 10:26 datadrwxr-xr-x
 10 root root 3.5K Sep 26 15:38 devdrwxr-xr-x 
 75 root root 4.0K Oct 16 04:02 etcdrwxr-xr-x 
 4 root root 4.0K Jun 12 10:26 homedrwxr-xr-x 
14 root root 12K Jun 16 04:02 libdrwx------ 
 2 root root 16K Jun 11 22:46 lost+founddrwxr-xr-x  2 root root 4.0K May 11 2011 mediadrwxr-xr-x  2 root root 4.0K Nov 8 2010 miscdrwxr-xr-x 
 2 root root 4.0K May 11 2011 mntdrwxr-xr-x 
 2 root root 4.0K May 11 2011 optdr-xr-xr-x 
235 root root  0 Jun 15 11:04 procdrwxr-x--- 
 4 root root 4.0K Oct 15 14:43 rootdrwxr-xr-x  
2 root root 12K Jun 12 04:03 sbindrwxr-xr-x  
2 root root 4.0K May 11 2011 selinuxdrwxr-xr-x 
 2 root root 4.0K May 11 2011 srvdrwxr-xr-x
 11 root root  0 Jun 15 11:04 sysdrwxrwxrwt 
 3 root root 96K Oct 16 08:49 tmpdrwxr-xr-x 
13 root root 4.0K Jun 11 23:38 usrdrwxr-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 -lttotal 254drwxrwxrwt 
 3 root root 98304 Oct 16 08:53 tmpdrwxr-xr-x 
 75 root root 4096 Oct 16 04:02 etcdrwxr-x--- 
 4 root root 4096 Oct 15 14:43 rootdrwxr-xr-x 
 10 root root 3520 Sep 26 15:38 devdrwxr-xr-x
 14 root root 12288 Jun 16 04:02 libdrwxr-xr-x
  4 root root 1024 Jun 15 14:45 bootdrwxr-xr-x
 11 root root   0 Jun 15 11:04 sysdr-xr-xr-x 
232 root root   0 Jun 15 11:04 procdrwxr-xr-x 
 6 root root 4096 Jun 12 10:26 datadrwxr-xr-x 
 4 root root 4096 Jun 12 10:26 homedrwxr-xr-x 
 2 root root 4096 Jun 12 04:03 bindrwxr-xr-x  
2 root root 12288 Jun 12 04:03 sbindrwxr-xr-x 
13 root root 4096 Jun 11 23:38 usrdrwxr-xr-x 
19 root root 4096 Jun 11 23:38 vardrwx------ 
 2 root root 16384 Jun 11 22:46 lost+founddrwxr-xr-x  2 root root 4096 May 11 2011 mediadrwxr-xr-x  2 root root 4096 May 11 2011 mntdrwxr-xr-x  
2 root root 4096 May 11 2011 optdrwxr-xr-x  
2 root root 4096 May 11 2011 selinuxdrwxr-xr-x
  2 root root 4096 May 11 2011 srvdrwxr-xr-x 
 2 root root 4096 Nov 8 2010 misc