user1417683
user1417683

Reputation: 239

List the content of the last 5 hidden directories

I was asked to list the content of the last 5 hidden directories in the current working directory with a single command. I thought something like this would do the job:

ls -a -1 | grep "^\." | tail -n 5 | ls

But it just lists the names of the last five directories.. how do I list the content?

Upvotes: 0

Views: 58

Answers (1)

broccolifarmer
broccolifarmer

Reputation: 475

ls -a -1 | grep "^\." | tail -n 5 | xargs ls

Upvotes: 2

Related Questions