File Listing

Modulok modulok at
Mon Jan 10 23:14:14 UTC 2011

On 1/10/11, peter at <peter at> 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
|-- 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/aliases -> mail/aliases

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

More information about the freebsd-questions mailing list