Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 10 Jan 2011 16:14:13 -0700
From:      Modulok <modulok@gmail.com>
To:        peter@vfemail.net
Cc:        freebsd-questions@freebsd.org
Subject:   Re: File Listing
Message-ID:  <AANLkTikT3eetZsX6WWV_2s24anL_SSyYvANGCbeE4tFO@mail.gmail.com>
In-Reply-To: <20110110211331.E12A6106566B@hub.freebsd.org>
References:  <20110110211331.E12A6106566B@hub.freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On 1/10/11, peter@vfemail.net <peter@vfemail.net> wrote:
>
> Is there one single-line command I can execute that will list every file in
> every directory on my FreeBSD box?  I've been fussing with the ls and du
> commands, but the output is never quite complete.

You might look into the 'tree(1)' command. It's a third party package
that can be installed as:

    # pkg_add -r tree

It has lots of flags to list files in various ways. By default it
lists all files in a tree-like format like this:

tree -a /etc
.
|-- X11
|-- aliases -> mail/aliases
|-- amd.map
|-- apmd.conf
|-- auth.conf
|-- bluetooth
|   |-- hcsecd.conf
|   |-- hosts
|   `-- protocols
|-- crontab
... and so on...

You can also list files with full paths without indents and such. See
man tree after its installed. Another example:

tree -aif /etc
/etc
/etc/X11
/etc/aliases -> mail/aliases
/etc/amd.map
/etc/apmd.conf
/etc/auth.conf
/etc/bluetooth
/etc/bluetooth/hcsecd.conf
/etc/bluetooth/hosts
/etc/bluetooth/protocols

There's also switches for how to handle symbolic links and staying on
one file system, depth limits, file limits, etc.
-Modulok-



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?AANLkTikT3eetZsX6WWV_2s24anL_SSyYvANGCbeE4tFO>