Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

As far as I know, there's not a unix command that lists the permissions for a file and all of its parent directories. Is there such a thing that I'm not aware of?

share|improve this question

2 Answers 2

up vote 1 down vote accepted

For traditional Unix permissions, there is namei:

$ namei -l ~/bin/git-resurrect 

f: /home/grawity/bin/git-resurrect
drwxr-xr-x root    root    /
drwxr-xr-x root    root    home
drwxr-xr-x grawity grawity grawity
drwxr-xr-x grawity grawity bin
lrwxrwxrwx grawity grawity git-resurrect -> ../src/git/contrib/git-resurrect.sh
drwxr-xr-x grawity grawity   ..
drwxrwxr-x grawity grawity   src
drwxr-xr-x grawity grawity   git
drwxr-xr-x grawity grawity   contrib
-rwxr-xr-x grawity grawity   git-resurrect.sh

A similar program to also display POSIX ACLs:

#!/usr/bin/env perl

sub follow {
    my @items = split(m|/+|, shift);
    my @paths = ();
    my $path = "/";
    while (defined(my $item = shift @items)) {
        my $file = $path . ($path eq "/" ? "" : "/") . $item;
        if (-l $file) {
            my $target = readlink($file)
                // die "Could not read link: $!\n";
            unshift @items, split(m|/+|, $target);
            push @paths, $file;
        } else {
            push @paths, $path = $file;
    return @paths;

for my $file (@ARGV) {
    system("getfacl", "-aPpt", $_) for follow($file);
share|improve this answer
wow, awesome. That's exactly what I was looking for. Thanks! –  nilbus Jan 31 '13 at 2:18

You can use a bash one-liner to list the permissions of the directory hierarchy. First change to the directory in question, and then run:

pushd .; while [ `pwd` != / ]; do ls -ld `pwd`; cd ..; done; popd
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.