[GLLUG] inodes and ls -dl
dincht at securenym.net
Thu Nov 20 15:47:55 EST 2003
On Thu, 2003-11-20 at 12:35, Ben Pfaff wrote:
> Michael Cox <cox-m at sbcglobal.net> writes:
> > I am running through the IBM tutorials and come to
> > ls -dl /usr/local
> > This is supposed to display all the directories shared
> > by the inode.
> That's not what -d or -l does with GNU ls. Read the manpage.
> -d, --directory
> list directory entries instead of contents, and do not derefer-
> ence symbolic links
> -l use a long listing format
Simply put, ls -d prevents directories from being searched recursively.
This is most useful when you want to list only directory and file names
that match a particular glob pattern. Let's say you want to list, for
example, all of the files and directories in /etc start with s, so you
which might give you the following listing:
services shells shells.bak spwd.db sysctl.conf
moduli ssh_host_dsa_key.pub ssh_host_rsa_key
ssh_host_dsa_key ssh_host_key.pub sshd_config
Now this isn't too bad, but if you try a similar command where a whole
bunch of directories match, then you have to waste time sorting through
potentially hundreds or thousands of lines of extraneous information.
ls -d will prevent that:
ls -d s*
services shells.bak spwd.db ssl/ syslog.conf
shells skel/ ssh/ sysctl.conf
That's much more manageable.
More information about the linux-user