hsz
hsz

Reputation: 152294

Bash pattern for dot-started directories excluding . and

Quick example - I would like to list content of all ~/.* directories, so:

ls -la ~/.*

However it lists also all current dir . and upper dir ..

How can I exclude . and .. ?

Upvotes: 2

Views: 260

Answers (2)

ayaye
ayaye

Reputation: 451

If you prefer to do it with regexp:

ls -la ~/.[^.]*

Upvotes: 2

perreal
perreal

Reputation: 98118

From ls man-page:

-A, --almost-all
              do not list implied . and ..

so it will be:

ls -lA ~/.*

Upvotes: 5

Related Questions