Sign up ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. It's 100% free, no registration required.

Say I have folder "foo" residing, the home directory. I want to get some info of it, owner, group, permissions, etc...

I then do this to try to get the information:

cd ~
ls -l foo

Of course it now lists the info of the contents of "foo"

Then I could do something like this

cd ~
ls -l $foo/.. | awk 'BEGIN { dir="'$foo'" } { if($9 == dir) { print $0 }  }'

But isn't there an easier way to do this?

share|improve this question

migrated from Aug 19 '11 at 16:24

This question came from our site for professional and enthusiast programmers.

1 Answer 1

up vote 13 down vote accepted


ls -ld foo

And you will get what you want.

But also consider stat if you want to capture information. The output of ls is for human consumption only.

stat -c %U foo # get owner of foo
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.