【文件属性】:
文件名称:将文件和文件夹分开的lf
文件大小:10KB
文件格式:7Z
更新时间:2014-12-18 05:02:14
linux,开发,小程序,文件列表
以前常常在找让ls单独列出文件或文件夹的方法,基本上都是通过一些shell处理,不过得到的结果一般都没有格式。学linux编程,想想自己写一个好了。
root@hastray:~# lf -a /
. .. bin boot cdrom dev etc home lib lost+found media
mnt opt proc root sbin selinux srv sys tmp usr var
initrd.img vmlinuz
root@hastray:~# lf -d /
bin boot cdrom dev etc home lib lost+found media mnt opt
proc root sbin selinux srv sys tmp usr var
root@hastray:~# lf -f /
initrd.img vmlinuz
root@hastray:~# lf --file /
initrd.img vmlinuz
root@hastray:~# lf -c /
bin boot cdrom dev etc home lib lost+found media mnt opt
proc root sbin selinux srv sys tmp usr var
initrd.img vmlinuz
Directories: 20 Files: 2
root@hastray:~# lf -d / /usr
/:
bin boot cdrom dev etc home lib lost+found media mnt opt
proc root sbin selinux srv sys tmp usr var
/usr:
arm-linux-gnueabi bin games include lib lib64 local sbin share src
root@hastray:~# lf -h
lf -[adfch] directory1 directory2 ...
-a --all show all of the files include begin with '.'
-d --dir show the directories only.
-f --file show the files except directories.
-c --count count there are how much files and directories.
-h --help show this.
【文件预览】:
lf