Help with the Linux ls command....

GEC: Discuss gaming, computers and electronics and venture into the bizarre world of STGODs.

Moderator: Thanas

Post Reply
User avatar
TrailerParkJawa
Sith Acolyte
Posts: 5850
Joined: 2002-07-04 11:49pm
Location: San Jose, California

Help with the Linux ls command....

Post by TrailerParkJawa »

I don't know if this is possible but here is goes:

I want to run this command: ls -laR /
I'd like to search each directory at / except for one.
For example we have: /var
/etc
/tmp
/flash
/shares

I would like to get the output of the recursive search for every directory but /shares. Does anyone know if there is a way to exclude a directory?
MEMBER of the Anti-PETA Anti-Facist LEAGUE
User avatar
Pu-239
Sith Marauder
Posts: 4727
Joined: 2002-10-21 08:44am
Location: Fake Virginia

Post by Pu-239 »

Why is there a /shares? /flash normally is under /mnt

Anyway, try

Code: Select all

ls / |grep -v shares|xargs ls -laR
There may be a way to exclude stuff with one command, but this works.

There's also a third-party tree program.

ah.....the path to happiness is revision of dreams and not fulfillment... -SWPIGWANG
Sufficient Googling is indistinguishable from knowledge -somebody
Anything worth the cost of a missile, which can be located on the battlefield, will be shot at with missiles. If the US military is involved, then things, which are not worth the cost if a missile will also be shot at with missiles. -Sea Skimmer


George Bush makes freedom sound like a giant robot that breaks down a lot. -Darth Raptor
User avatar
TrailerParkJawa
Sith Acolyte
Posts: 5850
Joined: 2002-07-04 11:49pm
Location: San Jose, California

Post by TrailerParkJawa »

There is /shares directory because this is a NAS box running a modified form of Linux. The /shares directory could have 0 files if it is fresh out of the box, or hundreds of thousands of files if it is a production server.

Thanks for the tip, I'll try that syntax and see if it works.
MEMBER of the Anti-PETA Anti-Facist LEAGUE
Post Reply