根据修改时间列出所有目录
# ls -lt drwxr-xr-x. 2 root root 4096 Oct 3 18:56 Desktop drwxr-xr-x 4 root root 4096 Oct 3 14:16 rpmbuild drwxr-xr-x. 2 root root 4096 Sep 8 16:00 Documents drwxr-xr-x. 2 root root 4096 Sep 8 16:00 Music drwxr-xr-x. 2 root root 4096 Sep 8 16:00 Pictures drwxr-xr-x. 2 root root 4096 Sep 8 16:00 Public drwxr-xr-x. 2 root root 4096 Sep 8 16:00 Templates drwxr-xr-x. 2 root root 4096 Sep 8 16:00 Videos drwxr-xr-x. 2 root root 4096 Sep 8 16:00 Downloads
查看文件创建时间
# ls -l --time-style="+%d %m %Y" -rw-------. 1 root root 1478 08 09 2012 anaconda-ks.cfg drwxr-xr-x. 2 root root 4096 03 10 2012 Desktop drwxr-xr-x. 2 root root 4096 08 09 2012 Documents drwxr-xr-x. 2 root root 4096 08 09 2012 Downloads -rw-r--r--. 1 root root 53828 08 09 2012 install.log -rw-r--r--. 1 root root 10035 08 09 2012 install.log.syslog drwxr-xr-x. 2 root root 4096 08 09 2012 Music drwxr-xr-x. 2 root root 4096 08 09 2012 Pictures drwxr-xr-x. 2 root root 4096 08 09 2012 Public drwxr-xr-x 4 root root 4096 03 10 2012 rpmbuild
或者
# ls -l --time-style=+%D -rw-------. 1 root root 1478 09/08/12 anaconda-ks.cfg drwxr-xr-x. 2 root root 4096 10/03/12 Desktop drwxr-xr-x. 2 root root 4096 09/08/12 Documents drwxr-xr-x. 2 root root 4096 09/08/12 Downloads -rw-r--r--. 1 root root 53828 09/08/12 install.log -rw-r--r--. 1 root root 10035 09/08/12 install.log.syslog drwxr-xr-x. 2 root root 4096 10/08/12 Music drwxr-xr-x. 2 root root 4096 09/08/12 Pictures drwxr-xr-x. 2 root root 4096 09/08/12 Public
大多数人必须知道“ls”的用法。
在这里,将介绍 'ls' 与不同开关的一些增强用法,我们可以在这些开关中根据文件和目录的访问和修改时间以及不同的时间和日期格式查看文件和目录。
日期:2020-06-02 22:18:32 来源:oir作者:oir